同一个gridview中,点击查看时,rowcommand正常运行。
而点击编辑和删除时出现错误:
回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件设置了EnableEventValidation= "false"以后到时不出现错误了,但是页面不执行任何操作。设置了断点查看,发现rowcommand事件没有执行,有遇到相同问题的给个答案吧?-----------------
在线结贴,诚信模范!
而点击编辑和删除时出现错误:
回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件设置了EnableEventValidation= "false"以后到时不出现错误了,但是页面不执行任何操作。设置了断点查看,发现rowcommand事件没有执行,有遇到相同问题的给个答案吧?-----------------
在线结贴,诚信模范!
解决方案 »
- 关于submit提交表单键提交的值
- GPS车辆监控系统web版
- 高人帮我征服 repeater 这个鸟物 !!
- DataGrid 模板列的问题(在线等)
- 请问在添加新闻内容时 ,插图片问题?怎样把图片插在新闻内容之间
- [在线] Response.Write(...alert('')....) 后接 Response.Redirect, 如何让前者起作用?
- 急急急 求高手帮我调试一个ASP程序 在线等
- 如何用将文字转换成一张背景透明的图片,能否给源码?
- 请问:VB.NET中如何根据控件的ID(字符串形式)得到该控件(的引用)?
- dataset更新。100分
- 运行出错,服务启不来高手救急
- css样式
如果在客户端修改了内容,那么就会报这个错。
BackColor="White" BorderColor="#C0C9D0" BorderStyle="Solid" BorderWidth="1px"
CellPadding="3" CssClass="font12px" EmptyDataText="---------------------没有数据-------------------"
GridLines="Vertical" OnRowCommand="GridView2_RowCommand" OnRowDataBound="GridView2_RowDataBound"
PageSize="5" UseAccessibleHeader="False" Width="100%" OnRowEditing="GridView2_RowEditing" OnPageIndexChanging="GridView2_PageIndexChanging">
<PagerSettings Visible="False" />
<footerstyle BackColor="#CCCCCC" ForeColor="Black" />
<RowStyle BackColor="White" ForeColor="Black" />
<columns>
<asp:TemplateField HeaderText="序号">
<itemtemplate> <%# Container.DataItemIndex+1 %> </itemtemplate>
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"
Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="名称">
<itemtemplate>
<asp:LinkButton ID="lkBT" runat="server" CommandArgument='<%# Eval("QSTCODE") %>'
CommandName="ShowDetails" CssClass="whgl_link" Text='<%# Eval("QUESTION")%>'></asp:LinkButton>
</itemtemplate>
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Left"/>
</asp:TemplateField>
<asp:BoundField DataField="Difficulty" HeaderText="难度">
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
</asp:BoundField>
<asp:BoundField HeaderText="认知度" DataField="LEVELOFCOGNIZING">
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
</asp:BoundField>
<asp:BoundField HeaderText="题型" DataField="TYPEOFQUESTION">
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
</asp:BoundField>
<asp:BoundField HeaderText="分值" DataField="GRADE">
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
</asp:BoundField>
<asp:BoundField HeaderText="试题范围" DataField="HSE">
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
</asp:BoundField>
<asp:BoundField HeaderText="HSE属性" DataField="PROPERTY">
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
</asp:BoundField>
<asp:BoundField DataField="ENABLED" HeaderText="是否可用" HtmlEncode="False">
<headerstyle BorderColor="Transparent" Font-Bold="False" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center" Width="50px" />
</asp:BoundField>
<asp:TemplateField HeaderText="修改">
<itemtemplate>
<asp:ImageButton ID="btnDetails" runat="server" AlternateText="编辑" CommandArgument='<%# Eval("QSTCODE") %>' CommandName="EditData" ImageUrl="~/Image/eidt.gif" /> </itemtemplate>
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"
Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="删除">
<itemtemplate>
<asp:ImageButton ID="lkbtnDelete" runat="server" AlternateText="删除" CommandArgument='<%# Eval("QSTCODE") %>'
CommandName="del" ImageUrl="~/Image/bt_del.gif" onclientclick="return confirm('确认要删除?')" /> </itemtemplate>
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"
Width="50px" />
</asp:TemplateField>
</columns>
<pagerstyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<headerstyle CssClass="GridView_head" Font-Bold="True" ForeColor="Black" Height="25px" />
<EditRowStyle HorizontalAlign="Center" />
<AlternatingRowStyle BackColor="WhiteSmoke" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px" />
</asp:GridView> protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
{
String ComA = e.CommandArgument.ToString();
if (e.CommandName == "del")
{
DeleteData(ComA);
}
if (e.CommandName == "EditData")
{
this.tableTK_1.Visible = true;
SetUnReadOnly2();
ShowDetail(ComA);
}
if (e.CommandName == "ShowDetails")
{
this.tableTK_1.Visible = true;
SetReadOnly2();
ShowDetail(ComA);
}
}
关键在于点击“名称”时,正常执行了rowcommand;而点击编辑图标时,根本没执行就出现错误了。
那把编辑的commandname换成ShowDetails什么情况呢?
<itemtemplate>
<asp:ImageButton ID="lkbtnDelete" runat="server" AlternateText="删除" CommandArgument='<%# Eval("QSTCODE") %>'
CommandName="del" ImageUrl="~/Image/bt_del.gif" onclientclick="return confirm('确认要删除?')" /> </itemtemplate>
<headerstyle BorderColor="Transparent" Font-Bold="False" HorizontalAlign="Center" />
<itemstyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"
Width="50px" />
</asp:TemplateField>
---------------
SetUnReadOnly2();
ShowDetail(ComA);
这两个函数的问题?????
添加正常,查看正常(查看就是点击名称,然后再gridview下面出现查看界面),执行完了gridviewdatabind()后继续执行了rowcommand。
点击编辑用的也是查看的界面(只不过文本框可用了,增加了按钮保存和取消),这时候就出现如一楼诉说的错误,经查执行了gridviewdatabind()后未执行rowcommand就直接出现了错误。
ShowDetail(ComA);
这两个函数的问题?????
=============================
这两个函数还没有执行就报错了,showdetail(coma)在查看时执行过应该也没有问题。