帮助!
我有一个<asp:TemplateField><ItemTemplate>
组合的 GridView。在这个组合中,我有一个<asp:ImageButton ...>
看起来不错但每次单击此按钮时都会出现错误:
Microsoft JScript 运行时错误:Sys.WebForms.PageRequestManagerServerErrorException:处理服务器上的请求时发生未知错误。服务器返回的状态码是:500
我什至不知道按钮触发的事件。
这是我的 HTML 代码:
<asp:GridView
ID="PuckGridView"
runat="server"
EmptyDataText="Sorry, no data available"
AutoGenerateColumns="False"
AllowSorting="True"
Font-Size = "X-Small"
Width = "1150px"
Height = "410px"
onselectedindexchanged="PuckGridView_SelectedIndexChanged"
onrowcommand="RowUserActivity"
onpageindexchanging="PuckGridView_PageIndexChanging"
onrowdatabound="PuckGridView_RowDataBound"
GridLines="Horizontal"
onsorting="PuckGridView_Sorting"
HeaderStyle-HorizontalAlign="Left">
<AlternatingRowStyle BackColor="#99CCFF" ForeColor="Black" />
<Columns>
<asp:TemplateField SortExpression="Status" HeaderText="Status">
<ItemTemplate>
<asp:ImageButton runat="server" ImageUrl='<%# "~/Images/" + Eval("StatusImage").ToString() %>' CommandName="UpdateStatus" />
<%-- <asp:Image ID="statusImage" runat="server" ImageUrl='<%# "~/Images/" + Eval("StatusImage").ToString() %>' />--%>
<asp:Label ID="status" runat="server" Text='<%# Bind("StatusText") %>'></asp:Label>
<br />
<asp:Image ID="onCallImage" runat="server" ImageUrl='<%# "~/Images/" + DisplayCorrectOnCallImage(Eval("OnCallImage")) %>' />
<asp:HiddenField ID="HiddenEmail" runat="server" Value='<%# Eval("Email") %>' />
<asp:HiddenField ID="HiddenUserName" runat="server" Value='<%# Eval("UserName") %>' />
<asp:HiddenField ID="HiddenFirstName" runat="server" Value='<%# Eval("FirstName") %>' />
<asp:HiddenField ID="HiddenLastName" runat="server" Value='<%# Eval("LastName") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" SortExpression="FirstName" DataField="FirstName" HeaderText="FirstName" Visible="true" />
<asp:BoundField ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" SortExpression="LastName" DataField="LastName" HeaderText="LastName" Visible="true" />
<asp:BoundField ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" DataField="OfficePhone" HeaderText="Phone" Visible="true" />
<asp:BoundField ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" SortExpression="TeamRole" DataField="TeamRole" HeaderText="Team/Role" Visible="true" />
<asp:BoundField ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" SortExpression="Location" DataField="Location" HeaderText="Location" Visible="true" />
<asp:ButtonField HeaderText="Mail" ButtonType="Image" CommandName="SendMail" ImageUrl="~/Images/mail.gif" Visible="true"/>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="imgHours" ToolTip=' <%# Eval("Hours") %> ' ImageUrl='<%# "~/Images/clock.gif" %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField ItemStyle-HorizontalAlign="Left" DataField="Message" HeaderText="Message" Visible="true" />
</Columns>
<HeaderStyle BackColor="#CCCCCC" />
</asp:GridView>