hi public
I am using postback in asp.net page to get data from the database.
{
try
{
iniData(txtCode.Text);
}
catch (Exception Ex)
{
....
}
}
initData takes a paramenter which the value of a code field on the page. The problem is txtCode.Text always reflects the old value.
Can anyone suggest how can I trap the new value the user enters and pass it.
thanks
-
-
Perheps you should try Request.Form["txtCode"].
I occasionally run into similar problem, especially when I create some of the controls "on the fly" myself. Reading the value directly from the request steam should fix it.
(In fact, one of the case you found the value doesn't change is when you didn't properly close your HTML tags, the browser is mercy enough to generate the control, but doesn't attach it to any form. Since it doesn't get included in the postback, it's value never have chance to get updated in the server-side. When you use the Request.Form[] approach, you'll see the value isn't returning in this case, and the problem becomes easier to be detected.
) -
Request.Form["txtCode"] contains the old value
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.