Home All Groups Group Topic Archive Search About

Get value from textbox in webcontrol

Author
7 Nov 2006 10:21 AM
Kevin Attard
Hi there,

Here is the problem
I have 2 textboxes, one normal and the other in a webusercontrol and both
have
'1' set as text. If I change the text to '2' and press save, the normal
textbox saves 2 while the textbox in the usercontrol saves 1.

Thus the value of the textboxes after postback is
normal textbox: 2
textbox in webcontrol: 1

why?

Author
9 Nov 2006 4:58 PM
Phil H
Hi Kevin

You need to check that whatever code you have written to save the
contents of the textbox in the webusercontrol is actually being
executed on postback.

If the postback event is triggered by a control on the normal page
(e.g. a button or return key) then you will need to capture the event
using the webusercontrol's page load event in conjunction with testing
the IsPostBack boolean flag. No other event handlers will be executed
in the webusercontrol if it was triggered by a control on the normal
page.

Another thing to check is the viewsetting for the textbox control. If
set to false then content will not be preserved.

Hope that helps

Phil Hall