|
Once you start dynamically adding controls in PAge_load or after, their viewstate will not be restored, so their events will not fire. One easy way around this is to have them just redirect to the same page with something on the URL telling you which link was pressed.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian
Thank you for the answer. so far i have 4 solutions (your hint is one of them) to avoid the problem i have, but still: the way i would like to do it seems to be the 'natural way'. all the 'hacks' (at least from my point of view) dont satisfy me (i can be very stubborn ).
you gave me the last hint i needed: why it doesnt work. since i call the addLinkButton-method twice, the second time the viewstate wont be restored.
Yves
|
|
|
|
|
Hi
I am trying to update a field in a database using a stored procedure.
The field in the database is type smallint
The value that I am inserting is from a textbox, so I have the following code:
cmdsqlcommandupdate.Parameters.Add(new SqlParameter("@Height", SqlDbType.SmallInt));
cmdsqlcommandupdate.Parameters["@Height"].Value = tbheight.Text;
However it is not updating the field, when I hard code the value in, it updates
So I'm wondering do I need to convert the textbox value to int before I enter?
any help would be great
cheers!
|
|
|
|
|
.netman wrote: So I'm wondering do I need to convert the textbox value to int before I enter?
actually to a short, as thats the C# equivalent to SmallInt.
short.Parse or, btter still, short.TryParse
|
|
|
|
|
hi
thanks for the answer, however i tried the following and it didnt work:
cmdsqlcommandupdate.Parameters.Add(new SqlParameter("@Height", SqlDbType.SmallInt));
cmdsqlcommandupdate.Parameters["@Height"].Value = short.Parse(tbheight.Text)
it showed the error
'short' does not contain a definition for 'cmdsqlcommandupdate'
why would this be?
thanks so far
|
|
|
|
|
OK ignore that post i used this
short shorttest = short.Parse(tbheight.Text);
cmdsqlcommandupdate.Parameters.Add(new SqlParameter("@Height", SqlDbType.SmallInt));
cmdsqlcommandupdate.Parameters["@Height"].Value = shorttest;
but it is still not updating the field
The textbox where the value comes from is in a panel, the update button is in a different area , would this make a difference?
cheers
|
|
|
|
|
No, not in the slightest. Have you taken the params passed into the debugger and run them through the proc in your DB to see if the issue is your database code ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Because you don't have a semicolon at the end ?
You should use TryParse, or this code will blow up if the text is not a short.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">Christian Graus wrote:</div>Because you don't have a semicolon at the end ?</blockquote>
I cant see where I am missing one from the statement above
I tried:
short shorttest = short.TryParse(tbheight.Text);
but it gives the error:
No overload for method 'TryParse' takes '1' arguments
Thanks christian
|
|
|
|
|
I guess if you paid attention to the intellisense, or read the docs...
short shorttest;
if ( short.TryParse(tbheight.Text, out shorttest))
{
// This means the parse was successful.
}
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
.netman wrote: No overload for method 'TryParse' takes '1' arguments
have you checked out the documentation for short.TryParse??
If you did you'll see it returns a boolean and has a second parameter.
short shorttest = 0;<br />
if(short.TryParse(tbHeight.Text, out shorttest)<br />
{<br />
}
|
|
|
|
|
OK
I think the problem runs deeper, I have just tried updating another field and it hasnt worked either, the field is a nvarchar
If i hardcode values in it works, but when I get them from textbox it doesnt
The texboxes are in panels but the update button is outside the panel, would this affect it?
thanks!
|
|
|
|
|
.netman wrote: The texboxes are in panels but the update button is outside the panel, would this affect it?
No, it shouldn't. When you set breakpoints, are the right values being found ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yeah the right values are found
The weird thing is, i am using one of the textboxes to find the correct field in the database and update that row.
It finds that textbox ok, but when I try and use any other textbox it just wont update
If I hardcode it does
Shall I post some code
I tried the
short shorttest;
if ( short.TryParse(tbheight.Text, out shorttest))
{
// This means the parse was successful.
}
but this didnt work either
|
|
|
|
|
OK, I've found the problem
Im so stupid!
Basically I had textfields which were displaying data from a database, this data was selected on pageload and applied to the textboxes
I moved this code to page init and it worked
how annoying
thanks for the help thouhg guys
|
|
|
|
|
can i write this code?
window.open('C:/webpart/a.htm')
or i should write a url instead of 'c:/webpart/a.htm'
|
|
|
|
|
window.open should use a URL, for reasons that I hope are obvious. Being javascript, it runs on the client, so cannot see your servers file system.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
does http protocol and its authentication remains same?? When it comes to mobile web form(in mobile browsers) and desktop webform(in normal IE/firefox...)
CAN U Give Me Various mobile web Browsers????
thanks,
Prashanth
prashanth,
s/w Engineer
|
|
|
|
|
Yes, if HTTP was not the same, it would not work.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks, But I was helpless, I mean I surfed in google too, but couldn't found my answer....
I want few test cases on Http Authentication for mobile browser..
Thanks,
|
|
|
|
|
Hello,
does anyone know of a asp.net control which has a ASP:SELECT with, when a list-item "Other" is selected, allows for a textbox where the user can enter an alternative answer besides the ones listed in the select?
Thansk a lot!
Morten
|
|
|
|
|
sounds easy to write.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hello friends
I am having a form with few text-boxes... and a button ..i am displaying ajax calender on button click ..problem is calender is appearing behind the other textboxes....
please suggest how to solve it
Thank You
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
Use a different calendar control. I'm not sure of the exact reason, but it has nothing to do with AJAX, some popups just appear behind some controls.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
thank you for the suggestion
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|