我有一個具有編輯/更新功能的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