accessing textboxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have an aspx page with some asp:textboxes. In Page_load, I can populate
the textboxes, I have a button on the page, clicking the button generates the
btton_click event.
My proble is I am not able to access the values as textbox.text in this event.
I am detting nothing as if I can not see those textbox objects. I can have
the text in thme by using request.params("mytextbox")
Tha&nks for your help
 
Can we see some summary code? Something tells me the Page_Load is
messing with / changing the values on PostBack. How about your
Page_load and btton_click event handlers...
Cheers,
Daniel
http://www.danhendricks.com
 
Hi Eliassal,

From your description, in your page's Button click event , you can't get
the TExtBox controls' reference( but can reference them in Page_load), yes?

I'm not sure whether there is anything incorrect in your page's codebehind
file. But I also recommedn that you provide a simple repro page so that we
can do some test on our local side. Also, what language are you using (c#
or vbnet), if you need I can also provide a simple test page so that you
can have a try on your side.

Please feel free to let me know if you need any further assistance. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Thanks for your help, you were both correct. It was a problem in the ispostback

I h
Thanks
salam
 
Bu mistake, I clicked on send, so I had
Sub Page_load
If not Page.Ispostback
do something
End if
textbox.text = myob.value
end sub
I put textbox.text = myob.value inside the if and it works fine. Is there an
article about the life cycle or an example in msdn that allows to see
practically what is executed (successive events) before arriving to the
button_click event ?
Thanks again
 
Hi Eliassal,

Of course, there are some good ones which can help explaining the asp.net
server control's life cycle( event exection sequence). Here are some:

#Control Execution Lifecycle
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconControlExecutionLi
fecycle.asp?frame=true

#Understanding ASP.NET View State
http://msdn.microsoft.com/library/en-us/dnaspp/html/viewstate.asp?frame=true

#The ASP.NET Page Object Model
http://msdn.microsoft.com/library/en-us/dnaspp/html/aspnet-pageobjectmodel.a
sp?frame=true

If you found anything unclear, please feel free to post here.
Enjoy them.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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

Back
Top