GridView的问题!实在弄不出了``
<asp:GridView ID="dgd_orderstate" runat="server" AllowPaging="True" AutoGenerateColumns="False"Width="488px" DataKeyNames="OID" OnRowUpdating="DataGrid_Update" OnRowEditing="DataGrid_Edit" OnRowCancelingEdit="DataGrid_Cancel" OnRowDeleting="DataGrid_Delete" OnPageIndexChanging="DataGrid_Page" >
<Columns>
<asp:BoundField DataField="oid" HeaderText="定单号" ReadOnly="True" />
........
............
报以下错误:
错误 1 “DataGrid_Update”的重载均与委托“System.Web.UI.WebControls.GridViewUpdateEventHandler”不匹配 d:\My Documents\Visual Studio 2005\WebSites\comic\orderstate.aspx 33
错误 2 “DataGrid_Edit”的重载均与委托“System.Web.UI.WebControls.GridViewEditEventHandler”不匹配 d:\My Documents\Visual Studio 2005\WebSites\comic\orderstate.aspx 33
错误 3 “DataGrid_Cancel”的重载均与委托“System.Web.UI.WebControls.GridViewCancelEditEventHandler”不匹配 d:\My Documents\Visual Studio 2005\WebSites\comic\orderstate.aspx 33
错误 4 “DataGrid_Delete”的重载均与委托“System.Web.UI.WebControls.GridViewDeleteEventHandler”不匹配 d:\My Documents\Visual Studio 2005\WebSites\comic\orderstate.aspx 33
public void DataGrid_Edit(Object sender, GridViewPageEventArgs E)
{
dgd_orderstate.EditItemIndex = (int)E.Item.ItemIndex;
BindGrid();
}
错误 7 “System.Web.UI.WebControls.GridView”并不包含“EditItemIndex”的定义 d:\My Documents\Visual Studio 2005\WebSites\comic\orderstate.aspx.cs 75 30 d:\...\comic\
其他的DataGrid_Update DataGrid_Cancel DataGrid_Delete也是出现错误7一样的错误
补充下:我用的版本是VS2005
--------------------编程问答-------------------- 你用的是GridView控件,可用的事件是DataGrid的,当然不行... --------------------编程问答-------------------- 没人知道,
31231232321 --------------------编程问答-------------------- 瀑布汗啊~
好像GridView 和 DataGrid 都混淆了哦
方法原型错了,主要是 事件参数类型 错了,
如果你不知道该方法原型,请选择中GridView,选择属性面版,切换到事件,双击对应事件,自动生成,处理程序原型
public void DataGrid_Edit(Object sender, GridViewEditEventArgs E)
//public void DataGrid_Edit(Object sender, GridViewPageEventArgs E)
{
dgd_orderstate.EditRowIndex = (int)E.Row.RowIndex;
//dgd_orderstate.EditItemIndex = (int)E.Item.ItemIndex;
BindGrid();
}
--------------------编程问答-------------------- 对于 GridView 的几个事件处理程序原型应该如下;
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
} --------------------编程问答-------------------- amandag(高歌) 说的对,把事件定义全部删了重新建立吧 --------------------编程问答-------------------- 双击你的gridview,另外gridview的属性窗有个闪电一样的图.点下..看看里面有你要的 --------------------编程问答-------------------- 其实是你每一个后台函数的参数错误了!~你自己看下
Object sender, GridViewPageEventArgs E
你应该是复制的函数,改了函数名没该参数
补充:.NET技术 , ASP.NET