[求助]asp.net gridview 模板内控件的取值
我在dataview的模板列内扔了一堆控件....然后我要取它某一行内的控件的值(任意谁 都行).....
protected void IB_Del_Click1(object sender, ImageClickEventArgs e)
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
Label lb = (Label)(GridView1.Rows[i].FindControl("Label6"));
ImageButton ib = (ImageButton)(GridView1.Rows[i].FindControl("IB_Del"));
string xx = ib.CommandArgument;
TextBox1.Text += (lb.Text + " , ");
}这种方式能把这一PAGE内的所有行的都取出来...但定不了具体的行
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string id = GridView1.SelectedValue.ToString();
}这个方式能准确取到...不过用到了SelectedIndexChanged事件....感觉这不是长远之计....