发生问题的datagridview事件 [英] Problem occured datagridview event
本文介绍了发生问题的datagridview事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当将行添加到gridview时,它会自动添加链接,因此我对datagridview行添加事件进行了以下编码,但它不起作用,发生了错误,因此哪个事件对此有所帮助
When the rows added to the gridview it is automatically added the Link so i give the following coding to datagridview rows added event but it is not working the error occured, so which event is help for this
CType(DataGridView1.Rows(0).Cells(0).Value, DataGridViewLinkCell).Value = "Click"
任何人都可以帮助我
谢谢
Anybody can help me Please
Thank you
推荐答案
您的转换错误..
更改为此..
your conversion is wrong..
change to this..
CType(DataGridView1.Rows(0).Cells(0), DataGridViewLinkCell).Value = "Click"
希望它能工作..
hope it will works..
尝试这样.
Hi,
Try like this.
protected void grdData_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HyperLink link = new HyperLink();
link.Text = "This is a link!";
link.NavigateUrl = "Navigate somewhere based on data: " + e.Row.DataItem;
e.Row.Cells[ColumnIndex.Column1].Controls.Add(link);
}
}
这篇关于发生问题的datagridview事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文