的一列的值,我列的GridView
和一个具有使用LinkButton
(ButtonField
) 我可以得到一个特定的细胞在我的网格就好了价值TemplateField
。使用:获取通过使用ButtonField字段
GridViewRow row = GridView1.SelectedRow;
lblSalesmanCustomers.Text = row.Cells[2].Text;
我然后显示从细胞中Label
文本。
但是我不能让这与ButtonField
模板工作。它只适用于非模板列。
如何在使用ButtonField
/TemplateField
的列中获取特定单元格的值?
编辑:这是我的按钮域代码我的GridView中: <asp:ButtonField DataTextField="Customer" HeaderText="Customer" ButtonType="Link" CommandName="Select" />
而且,这是在这种情况下发生:
protected void gvManagerCustomers_SelectedIndexChanged(object sender, EventArgs e)
你能提供你的GridView的aspx代码? – 2012-02-27 21:51:22
在网站上有26个问题,您应该知道如何在帖子中设置代码的格式。 (*不太明显,不要把签名放在最后。*) – jadarnel27 2012-02-27 22:01:33
我不知道如何格式化我的代码。不熟悉标记。如果我在任何结尾处留下我的名字,你会关心什么? – 2012-02-28 16:34:04