2012年3月26日月曜日

retrieve info dynamically created textbox in update panel

I have a textbox that is created in code in an Ajax Update Panel when then the user clicks on a dropdownlist.

I would then like to retreive the text that user types in:

Dim strTitleAsString =CType(Me.FindControl("txtPrimaryPersonTitle" + intSuggestedPrimaryPersonCount.ToString), TextBox).Text

It gives me an error that it can't find the control.

Can you offer any help??

Have you made sure that the textbox is re-created on postback?

You may also consider creating the textbox statically (in markup) instead of dynamically.
Set Visible=False in the markup, and make it visible in your dropdownlist code.
This prevents most of the problems inherent to dynamic controls.

Jos


hello.

how about a demo page so that we can see what you're doing? it has to be simple enough so that we ca simply copy/paste it in order to test it


Hi,

it can't find the control?

If the contorl still exist, the Id must not write.

I think it is easy to debug to see if the contorl is exist or not, and it is easy to find out what is the correct id of the contorl.

If you still have question,post up a repro of your issue.

Best Regards,

0 件のコメント:

コメントを投稿