我有一个具有编辑/更新功能的GridView。但是,当我点击一次时,它不会触发。我必须再次点击才能触发。休息部分工作正常。GridView编辑点击2次后触发事件
有人可以告诉我发生了什么事吗?这里是我的GV标记:
<asp:GridView ID="gvShowRegistration" runat="server"
Height="204px" Width="678px"
OnRowEditing = "gvShowRegistration_RowEditing"
OnRowUpdating = "gvShowRegistration_RowUpdating"
OnRowCancelingEdit = "gvShowRegistration_RowCancelingEdit" CssClass="menu">
<Columns>
<asp:CommandField HeaderText="Edit" ShowEditButton="True" ShowHeader="True" ShowSelectButton="True" />
</Columns>
</asp:GridView>
public partial class Testing : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string getEntity = Request.QueryString["EntityID"];
int getIntEntity = Int16.Parse(getEntity);
TestLinq2SqlVs1DataContext dt = new TestLinq2SqlVs1DataContext();
var tr = from r in dt.Users
join s in dt.Entities on r.Entity_ID equals s.ID
where s.ID == getIntEntity
select new
{
};
gvShowRegistration.DataSource = tr;
gvShowRegistration.DataBind();
}
protected void gvShowRegistration_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//Update code goes here!!!
}
protected void gvShowRegistration_RowEditing(object sender, GridViewEditEventArgs e)
{
gvShowRegistration.EditIndex = e.NewEditIndex;
}
protected void gvShowRegistration_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
gvShowRegistration.EditIndex = -1;
}
}
当你绑定网格,可能你的网格在回发上被反弹 – kd7 2011-03-23 20:23:58
那么我该怎么做? – 2011-03-23 20:27:14
您的网格在哪个页面事件中绑定其数据? – kd7 2011-03-23 20:30:12