gridview中的Editmode指向不同的行 [英] Editmode in gridview is pointing to different row

查看:75
本文介绍了gridview中的Editmode指向不同的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





使用下拉列表我在gv(第8条记录)中选择一行,所以现在gv只显示一行(第8条记录),我点击编辑,编辑模式指向网格中的第一条记录(所以现在网格显示所有记录,编辑模式指向gv中的第一条记录)。



我希望editmode指向我选择的记录。我已经在很多方面尝试过rowindex,但我无法修复它.Plz help.Thanks.This是mycodebehind:

  protected   void  editEmployee( object  sender ,GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex; // 这里我应该给控件
BindGrid();

}

解决方案

hi

试试这个

gridview_RowUpdating命令



Convert.ToInt32(GridView1.Rows [e.RowIndex] .Cells [1] .Text);

通过这个你将获得你点击并更新此记录的ID



希望这会有所帮助。

请标记它是否对你有所帮助

Hi,

Using a dropdownlist iam selecting a row in gv(8th record),so now the gv is displaying only one row(8th record),when I click edit ,the editmode is pointing to first record in the grid(so now the grid is showing all the records and the editmode is pointing to the firstrecord in the gv).

I wanted the editmode to be pointing to the record which I have selected.I have tried the rowindex in many ways,but I couldn't fix it .Plz help.Thanks.This is mycodebehind:

protected void editEmployee(object sender,GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;//here I should give the control
        BindGrid();

    }

解决方案

hi
try this on
gridview_RowUpdating command

Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[1].Text);
by this u will get id on which you have clicked and update this record

Hope this will help.
Please mark if it helps you


这篇关于gridview中的Editmode指向不同的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆