14 个解决方案
#1
编辑时重新绑定了吗?
#2
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
//重新绑定
}
#3
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)已经写了
{
GridView1.EditIndex = e.NewEditIndex;
}
#4
顶一下,期待答案
#5
你在事件里设一个断点,然后看一下点一下的时候是否会触发
#6
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
//重新绑定数据
}
{
GridView1.EditIndex = e.NewEditIndex;
//重新绑定数据
}
#7
正解
#8
呵呵.Up
#9
<EditItemTemplate>
<asp:LinkButton ID="LinkButton5" runat="server" CausesValidation="True" CommandName="update">保存</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" CommandName="cancel">取消</asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="edit" CausesValidation="false" OnClientClick="return confirm('确认要编辑吗?');">编辑</asp:LinkButton>
</ItemTemplate>
if (!IsPostBack)
{
BindData();
}
protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
{
gv.EditIndex = e.NewEditIndex;
gv.EditIndex = -1;
BindData();
}
<asp:LinkButton ID="LinkButton5" runat="server" CausesValidation="True" CommandName="update">保存</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" CommandName="cancel">取消</asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="edit" CausesValidation="false" OnClientClick="return confirm('确认要编辑吗?');">编辑</asp:LinkButton>
</ItemTemplate>
if (!IsPostBack)
{
BindData();
}
protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
{
gv.EditIndex = e.NewEditIndex;
gv.EditIndex = -1;
BindData();
}
#10
把代码贴上来看看哦
#11
刚才上面的说的不错,你点了两次才会进入编辑状态是因为第一个点的时候只是进入编辑状态,却没有绑定数据,第二次再点行了,那是因为页面再次刷新了,才会绑定的
protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
{
gv.EditIndex = e.NewEditIndex; //切换到编辑状态
BindData(); //绑定数据,这样才能一次点击就显示,如果这个不写,第一次便不会处于编辑状态,因为只给了索引,没有给数据,只有再次点击才会有的
}
protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
{
gv.EditIndex = e.NewEditIndex; //切换到编辑状态
BindData(); //绑定数据,这样才能一次点击就显示,如果这个不写,第一次便不会处于编辑状态,因为只给了索引,没有给数据,只有再次点击才会有的
}
#12
是的
#13
protectedvoid GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex= e.NewEditIndex;
bind()//这里加上绑定数据方法
#14
确实如此
#1
编辑时重新绑定了吗?
#2
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
//重新绑定
}
#3
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)已经写了
{
GridView1.EditIndex = e.NewEditIndex;
}
#4
顶一下,期待答案
#5
你在事件里设一个断点,然后看一下点一下的时候是否会触发
#6
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
//重新绑定数据
}
{
GridView1.EditIndex = e.NewEditIndex;
//重新绑定数据
}
#7
正解
#8
呵呵.Up
#9
<EditItemTemplate>
<asp:LinkButton ID="LinkButton5" runat="server" CausesValidation="True" CommandName="update">保存</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" CommandName="cancel">取消</asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="edit" CausesValidation="false" OnClientClick="return confirm('确认要编辑吗?');">编辑</asp:LinkButton>
</ItemTemplate>
if (!IsPostBack)
{
BindData();
}
protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
{
gv.EditIndex = e.NewEditIndex;
gv.EditIndex = -1;
BindData();
}
<asp:LinkButton ID="LinkButton5" runat="server" CausesValidation="True" CommandName="update">保存</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" CommandName="cancel">取消</asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="edit" CausesValidation="false" OnClientClick="return confirm('确认要编辑吗?');">编辑</asp:LinkButton>
</ItemTemplate>
if (!IsPostBack)
{
BindData();
}
protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
{
gv.EditIndex = e.NewEditIndex;
gv.EditIndex = -1;
BindData();
}
#10
把代码贴上来看看哦
#11
刚才上面的说的不错,你点了两次才会进入编辑状态是因为第一个点的时候只是进入编辑状态,却没有绑定数据,第二次再点行了,那是因为页面再次刷新了,才会绑定的
protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
{
gv.EditIndex = e.NewEditIndex; //切换到编辑状态
BindData(); //绑定数据,这样才能一次点击就显示,如果这个不写,第一次便不会处于编辑状态,因为只给了索引,没有给数据,只有再次点击才会有的
}
protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
{
gv.EditIndex = e.NewEditIndex; //切换到编辑状态
BindData(); //绑定数据,这样才能一次点击就显示,如果这个不写,第一次便不会处于编辑状态,因为只给了索引,没有给数据,只有再次点击才会有的
}
#12
是的
#13
protectedvoid GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex= e.NewEditIndex;
bind()//这里加上绑定数据方法
#14
确实如此