Click here to Skip to main content
15,921,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
VB
CType(DataGridView1.Rows(0).Cells(0).Value, DataGridViewLinkCell).Value = "Click"

Anybody can help me Please

Thank you
Posted
Updated 9-Jan-12 23:26pm
v2

your conversion is wrong..

change to this..

VB
CType(DataGridView1.Rows(0).Cells(0), DataGridViewLinkCell).Value = "Click"


hope it will works..
 
Share this answer
 
Hi,

Try like this.
C#
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);
        }
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900