Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Defining GridView columns dynamically
Message
De
18/07/2006 10:16:06
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Defining GridView columns dynamically
Versions des environnements
Environment:
ASP.NET
Divers
Thread ID:
01137233
Message ID:
01137233
Vues:
60
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
Répondre
Fil
Voir

Click here to load this message in the networking platform