Page_Load, Textbox1.Text is empty?

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/12/2011 4:56:42 AM
Gravatar
Total Posts 3

Page_Load, Textbox1.Text is empty?

hi. i have simple ascx module with a textbox and a button.

user enters something in textbox and presses button. in Page_Load of my ascx Textbox1.Text is empty.

but later in Button_Click Textbox1.Text  contains user text. WHY? 

 

without mojo this ascx work fine.

3/13/2011 12:05:42 PM
Gravatar
Total Posts 18439

Re: Page_Load, Textbox1.Text is empty?

Make sure you are not wiring up events twice.If you have AutoEventWireup="true" in the .ascx but are wiring up events also in the code then it can cause the page load event to fire twice and this can cause strange results.

Also you may need to add this line of code to your page load event

Page.EnableViewState = true;

Hope it helps,

Joe

1/27/2012 6:55:07 AM
Gravatar
Total Posts 1

Re: Page_Load, Textbox1.Text is empty?

Hi,

I've had a similar issue with hidden fields inside a module. After posting back, their values were empty strings (after being set in the browser) until  the event handler for the button control was reached.

I assumed this was because the module/user controls aren't loaded until the mojoportal page's page load event and (for some reason) their state wasn't available until later in the page's life cycle.

After a bit of refactoring, I found that it was unnecessary to access the hidden fields until the event handler ran anyway.

But I can confirm that (under some circumstances?) the controls' values were not available during page load (with AutoEventWireup="false")

You must sign in to post in the forums. This thread is closed to new posts.