C# 在rowcommand中获取gridview列的值
这是我尝试过的,但我的工作名称为空C# 在rowcommand中获取gridview列的值,c#,asp.net,gridview,C#,Asp.net,Gridview,这是我尝试过的,但我的工作名称为空 GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer); int RowIndex = row.RowIndex; // this find the index of row string job_Name = row.Cells[1].Text; job\u Name为null请尝试以下方法: private void RowCommand(object
GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
int RowIndex = row.RowIndex; // this find the index of row
string job_Name = row.Cells[1].Text;
job\u Name
为null
请尝试以下方法:
private void RowCommand(object sender, GridViewCommandEventArgs e)
{
var grid = sender as GridView;
if (grid == null)
{
return;
}
var index = Convert.ToInt32(e.CommandArgument);
var row = grid.Rows[index];
string job_Name = row.Cells[1].Text;
}
在var index=Convert.ToInt32(e.CommandArgument)上出现错误“”输入字符串的格式不正确。“”;iCommandName=“applicationshortlist”而我没有使用它Rowcommand@WajidAliKhan-是asp.net Webforms还是MVC?如果您是asp.net,请将HTML站点添加到您的问题和更多详细信息中page@WajidAliKhan-请向aspx设计器(HTML)咨询您的问题