Gridview Rowcommand 单元格到 public 字符串
Gridview Rowcommand cell to public string
我有一个带有 rowcommand 事件的 gridview。
我希望在我的行命令之外使用 temp
字符串的值。
这可能吗?
protected void gwActivity_RowCommand(object sender, GridViewCommandEventArgs e)
{
GridViewRow row = ((e.CommandSource as Control).NamingContainer as GridViewRow);
string temp = row.Cells[1].Text;
}
您可以在 class 中创建一个私有字段,例如:
private string _temp;
然后将您的 temp
字符串分配给它:
protected void gwActivity_RowCommand(object sender, GridViewCommandEventArgs e)
{
GridViewRow row = ((e.CommandSource as Control).NamingContainer as GridViewRow);
string temp = row.Cells[1].Text;
_temp = temp;
}
我有一个带有 rowcommand 事件的 gridview。
我希望在我的行命令之外使用 temp
字符串的值。
这可能吗?
protected void gwActivity_RowCommand(object sender, GridViewCommandEventArgs e)
{
GridViewRow row = ((e.CommandSource as Control).NamingContainer as GridViewRow);
string temp = row.Cells[1].Text;
}
您可以在 class 中创建一个私有字段,例如:
private string _temp;
然后将您的 temp
字符串分配给它:
protected void gwActivity_RowCommand(object sender, GridViewCommandEventArgs e)
{
GridViewRow row = ((e.CommandSource as Control).NamingContainer as GridViewRow);
string temp = row.Cells[1].Text;
_temp = temp;
}