Wierd behavior with text box postback

G

Guest

I'm working for a company in Houston developing a web application. At one
point in the code, we have to refresh the page, but save what checkboxes have
been selected. Since these checkboxes are created programmatically according
to configuration files, they cannot be asp checkboxes.

To do this, before refreshing I save which checkboxes are selected to an asp
textbox and perform a postback. Later in the .aspx file, I have a <% %>
block that calls a method from the codebehind to output a Javascript call.
However, in this codebehind C# call, when I access the textbox's .Text field,
it is always empty, regardless of the actual values put in the text box. The
really strange part of it is that when the page refreshes, the asp textbox
has the correct values in the input tag's value attribute.

Is there some wierd execution order to ASP.NET that I am unaware of that
would cause this? And, more importantly, is there a way around it? any help
would be greatly appreciated.
 
B

Bruce Barker

<% %> code blocks run during the page init process. this is before postback
data is loaded into controls. your code behind can fetch the value from the
form variable collection.

note: databinding works by putting the binding expression in the value, then
replacing the expression with the value when databound.

-- bruce (sqlwork.com)
 
G

Guest

I'm not enitrely sure I understand what you mean. What form variable
collection? And how exactly does data binding work?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top