首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

.net 2005 的GridView 的模板列中,怎么取得当前行

2012-02-09 
.net 2005 的GridView 的模板列中,如何取得当前行?protectedvoidGridView1_RowCommand(objectsender,GridV

.net 2005 的GridView 的模板列中,如何取得当前行?
protected   void   GridView1_RowCommand(object   sender,   GridViewCommandEventArgs   e)
        {


                if   (e.CommandName   ==   "del ")
                {            
                        int   a   =   Convert.ToInt32(e.CommandArgument);                  
                        GridViewRow   row   =   GridView1.Rows[a];
                        string   xh3   =   row.Cells[0].Text;
                        ClientScript.RegisterStartupScript(typeof(Page), " ", " <script> alert( ' "+xh3+ " '); </script> ");
                }
        }
为什么提出来的是空值?

[解决办法]
第一列有没有文字?还是控件?如果是控件就要用findcontrol

热点排行