最佳解答者
UpdatePanel內容更新問題

問題
-
UpdatePanel中有一個 Reset button, 按下如何清除txtSearchTitle 的內容,
但執行btnReset_Click後, UpdatePanel沒有更新.
<asp:UpdatePanel ID="UpdatePanel_Input" runat="server">
<ContentTemplate>
<table style="width: 960px" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:TextBox ID="txtSearchTitle" runat="server" Height="20px" Width="280px"
CssClass="field_search_input"></asp:TextBox>
<
</td>
<td rowspan="2" align="center">
<asp:Button ID="btnSearch" runat="server" CssClass="button1" Text="檢索" Width="88px" />
<br />
<br />
<asp:Button ID="btnReset" runat="server" CssClass="button1" Font-Size="10pt" Text="重 設"
Width="88px" CausesValidation="false" />
</nobr>
</td>
<tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click
Me.txtSearchTitle.Text=""
End Sub
2009年3月17日 上午 04:28
解答
-
You could try to copy and paste the Table and its items out from the UpdatePanel, and test it without UpdatePanel, can it update the txtSearchTitle.Text. If no, then it should be same as KeFang Chen said, you miss to add OnClick=btnReset_Click in the aspx.
大家一齊探討、學習和研究,謝謝! Microsoft MVP, Microsoft Community Star(TW & HK), MCT, MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP- 已標示為解答 KeFang Chen 2009年3月23日 上午 06:33
2009年3月19日 上午 06:05
所有回覆
-
楼主,你好
你的html代码有问题吧。Lam0706 表示:
<asp:Button ID="btnReset" runat="server" CssClass="button1" Font-Size="10pt" Text="重 設"
Width="88px" CausesValidation="false" />
Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click
Me.txtSearchTitle.Text=""
End Sub
你看上面加粗的这行代码中并没有为btnReset指定事件啊。
如果是的,请加上“onclick=btnReset_Click”试试。
Microsoft Online Community Support2009年3月19日 上午 02:03 -
You could try to copy and paste the Table and its items out from the UpdatePanel, and test it without UpdatePanel, can it update the txtSearchTitle.Text. If no, then it should be same as KeFang Chen said, you miss to add OnClick=btnReset_Click in the aspx.
大家一齊探討、學習和研究,謝謝! Microsoft MVP, Microsoft Community Star(TW & HK), MCT, MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP- 已標示為解答 KeFang Chen 2009年3月23日 上午 06:33
2009年3月19日 上午 06:05 -
Lam0706 表示:
我有 Handles btnReset.Click
所以不用加onclick=btnReset_Click
而且我在DEBUG 看到是有執行 btnReset_Click 的.
執行完後就沒有在畫面上更新.
Did u try my way? Is it working when outside of the updatePanel?
大家一齊探討、學習和研究,謝謝! Microsoft MVP, Microsoft Community Star(TW & HK), MCT, MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP2009年3月20日 上午 08:42