在onrowcommand 事件中

   前台的模板列中通过红色字体 将当前行号绑定给 CommandArgument

 
 

 CommandArgument='<%#Container.DataItemIndex %>'/>
 

 

 

后台

 protected voidgridCorpReport_RowCommand(object sender, GridViewCommandEventArgse)
       {
           if (e.CommandName == "CorpDateReject")
           {

                             int LB = Int32.Parse(e.CommandArgument.ToString());

                              varlbl =(HyperLink)gridCorpReport.Rows[LB].FindControl("lblcorptip");
               string corpid = gridCorpReport.Rows[LB].Cells[0].Text;

           }

     }

 

你可能感兴趣的:(在onrowcommand 事件中)