查看此照片Plz Grid Photo
这是“删除”按钮功能
protected void Delete_Click(object sender, EventArgs e)
{
RadButton btn = (RadButton)sender;
GridDataItem data = (GridDataItem)btn.NamingContainer;
string name= data["Name"].Text;
Label1.Text = name;
}
答案 0 :(得分:1)
我需要更多有关您的模型达到100%的样子的信息,但是您应该能够从点击的项目中获得DataContext
。
protected void Delete_Click(object sender, EventArgs e)
{
var sendr = sender as RadioButton;
if (sendr != null)
{
var clickedItem = sendr.DataContext as YourModel;
if (clickedItem != null)
{
Label1.Text = clickedItem.Name;
}
}
}