Hi everyone,
Can someone please explain to me how I can include a boundfield (Emp_ID) to the hyperlinkfield (IDNumber) in a code generated gridview using C#? So that the url string would be "'../Pages/Home.aspx?Emp_ID=(Emp_ID)'>(IDNumber)"
Thanks
Snippet code below:
IDColumn.DataField = "Emp_ID";
IDColumn.HeaderText = "Emp_ID";
string[] id = new string[] { "Emp_ID" };
IDColumn.Visible = false;
grid.Columns.Add(IDColumn);
hyperlinkedColumn.DataTextField = "IDNumber";
hyperlinkedColumn.HeaderText = "ID No.";
hyperlinkedColumn.DataNavigateUrlFields = id;
hyperlinkedColumn.DataTextFormatString = "<a href='../Pages/Home.aspx?Emp_ID='>{0}</a>";
hyperlinkedColumn.Visible = true;
grid.DataKeyNames = id;
grid.Columns.Add(hyperlinkedColumn);