Cannot update .Text property of asp:TextBox inside asp:UpdatePanel
I have several dropdownlists and textboxes inside an <asp:UpdatePanel>
, which should let me edit some details after selecting an item inside an <asp:GridView>
. The grid is not inside the updatepanel.
From the UpdatePanels' .Load() method, I change the .Text of a few <asp:Label>
, <asp:TextBox>
, and I set the .SelectedValue of some <asp:DropDownList>
.
All labels are updated correcly,开发者_开发百科 but the new .Text of the <asp:TextBox>
and .SelectedValue of <asp:DropDownList>
are not visible in the HTML output. After setting the new value, I can see that it has been set with QuickWatch from Visual Studio.
What is causing this, and how can I solve my problem?
I am using Visual Studio 2008 with .Net 3.5
I think the problem is when you select an item in the <asp:GridView>
nothing is being posted back to the server? Is autopostback on?
In addition you need to set the update panel trigger to postback (and hence get the new value) whenever a selection is made in <asp:GridView>
.
Please comment if I've got the wrong end of the stick.
Dude, just set the .Text in your UpdatePanels PreRender() method. It will solve your problems.
...... Thanks for all the help, guys. ;)
精彩评论