我有一个内置gridview的更新面板。另外,我在更新面板中有一个按钮,可以在点击事件中触发它。在gridview模板字段中,我有一个linkbutton,它应该在点击时重置用户密码。当我点击重置按钮时,它什么都不做。
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" Height="240px" Width="952px" Visible = "False" EnableModelValidation="True" EnableViewState="false">
<Columns>
<asp:BoundField DataField="personid" HeaderText="Person ID" />
<asp:BoundField DataField="firstname" HeaderText="Account No" />
<asp:BoundField DataField="surname" HeaderText="Skin Centre" />
<asp:BoundField DataField="email" HeaderText="Email" />
<asp:BoundField DataField="password" HeaderText="Password" ControlStyle-Width="200px">
<ControlStyle Width="200px"></ControlStyle>
</asp:BoundField><asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:LinkButton ID="lnkBtn" runat="server" OnCommand="lnkBtn_Command" CommandArgument='<%# Eval("CmdArgument") %>' Text='<%# Eval("CmdArgument", " reset ") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:UpdateProgress ID="UPCalendarUpdateProgress" runat="server" DisplayAfter="0">
<ProgressTemplate>
<div style="width:100%; height: 100%; border: 0px solid; position: absolute; top: 0; left: 0; text-align: center;">
<div id="loadingMessage">
<asp:Label ID="LbLoadingMessage" runat="server" ForeColor = "Red" Font-Size="XX-Large" Text="Loading the account details..." CssClass="loading-message-text">
</asp:Label><br />
<img src="images/loadingAnimation.gif" alt="" style="margin-top: 20px;" /></div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<div style="margin-top:50px;">
<asp:button ID="rstButton" runat="server" text="Complete Reset" OnClick ="rstButton_Click" Visible ="false"/>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rstButton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
任何想法都会受到赞赏。
答案 0 :(得分:0)
将您的EventName从Click更新为确切的按钮事件名称
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rstButton" EventName="rstButton_Click" />
</Triggers>
希望这会有所帮助..
答案 1 :(得分:0)
请再试一次
<asp:ScriptManager ID="scm" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" Height="240px" Width="952px"
Visible="False" EnableModelValidation="True" EnableViewState="false">
<Columns>
<asp:BoundField DataField="personid" HeaderText="Person ID" />
<asp:BoundField DataField="firstname" HeaderText="Account No" />
<asp:BoundField DataField="surname" HeaderText="Skin Centre" />
<asp:BoundField DataField="email" HeaderText="Email" />
<asp:BoundField DataField="password" HeaderText="Password" ControlStyle-Width="200px">
<ControlStyle Width="200px"></ControlStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:LinkButton ID="lnkBtn" runat="server" OnCommand="lnkBtn_Command" CommandArgument='<%# Eval("CmdArgument") %>'
Text='<%# Eval("CmdArgument", " reset ") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<div style="margin-top: 50px;">
<asp:Button ID="rstButton" runat="server" Text="Complete Reset" OnClick="rstButton_Click"
Visible="true" />
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rstButton" />
<asp:AsyncPostBackTrigger ControlID="gv" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UPCalendarUpdateProgress" runat="server" DisplayAfter="0">
<ProgressTemplate>
<div style="width: 100%; height: 100%; border: 0px solid; position: absolute; top: 0;
left: 0; text-align: center;">
<div id="loadingMessage">
<asp:Label ID="LbLoadingMessage" runat="server" ForeColor="Red" Font-Size="XX-Large"
Text="Loading the account details..." CssClass="loading-message-text">
</asp:Label><br />
<img src="images/loadingAnimation.gif" alt="" style="margin-top: 20px;" /></div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
我希望它能解决你的问题......