我正在使用UpdatePanel異步更新ASP.NET頁面上的控件。在回發期間,我想獲得TextBox控件的值。然而,我得到的值始終是TextBox的原始文本值,而不是用戶輸入的文本。如何在回發中獲取TextBox服務器端的更新值?在Async Postback上獲取ASP.NET TextBox的值
在此先感謝您提供的任何建議。
下面的代碼:在GridView
<asp:UpdatePanel ID="GridUpdatePanel" runat="server">
<ContentTemplate>
<asp:GridView ID="AdminGridView" runat="server"
onrowcreated="AdminGridView_RowCreated" AutoGenerateColumns="False"
RowStyle-HorizontalAlign="Center" CssClass="Grid" Font-Size="100%"
BorderColor="Black" oninit="AdminGridView_Init">
</asp:GridView>
<asp:TextBox ID="SortLabel" runat="server" Text="Recipients"></asp:TextBox>
<asp:TextBox ID="DirectionLabel" Text="DESC" runat="server"></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
- 編輯 -
我要補充一點,我試圖找回在_Init(TextBox的值)事件 - 也許有更好的地方來檢索TextBox的值?
是生成回發的UpdatePanel內的文本? –
是的,我試圖訪問的文本框是在被調用的UpdatePanel中。 –
你能否貼一些代碼?我想知道是否在某處重置了文本框的值,例如在page_load上。 –