Get value from textbox in webcontrol

K

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?
 
P

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
 

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

Forum statistics

Threads
473,790
Messages
2,569,637
Members
45,346
Latest member
EstebanCoa

Latest Threads

Top