views:

63

answers:

2

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

A: 

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.

m.edmondson
Hi, I understand how you might think this. I post back to the server using __doPostBack from my own javascript. If the Load method was not run, the <asp:Label>s would not have been updated either, would they?
tkalve
Are you saying the Load method is occuring AFTER you've clicked the GridView?
m.edmondson
When I click the GridView, the UpdatePanel is updated, and the code function panelDetails_Load in Default.aspx.cs is run. My UpdatePanel refers to panelDetails_Load.
tkalve
A: 

Dude, just set the .Text in your UpdatePanels PreRender() method. It will solve your problems.

...... Thanks for all the help, guys. ;)

tkalve