Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Defining GridView columns dynamically
Message
From
18/07/2006 10:16:06
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Defining GridView columns dynamically
Environment versions
Environment:
ASP.NET
Miscellaneous
Thread ID:
01137233
Message ID:
01137233
Views:
59
I am trying to create and fill columns in a ASP.Net webform GridView dynamically. I can successfully add a BoundField column to the GridView, but how can I add a HyperLinkField column to the GridView? I keep getting an error on the DataNavigateUrlFields line.

Below is my routine
private void AddField(GridView gv, string datafield, string caption)
{
HyperLinkField hf = new HyperLinkField();
hf.HeaderText = caption;
hf.DataNavigateUrlFields = datafield   //Gives error
hf.DataNavigateUrlFormatString = "myform.aspx?part={0}"
hf.DataTextField = datafield;
hf.DataTextFormatString = datafield;
gv.Columns.Add(hf);
}
Thanks,

Jerry
Reply
Map
View

Click here to load this message in the networking platform