datagrid autogenerate columns

Y

ypul

Hi ,

Getting to the point directly,
my query output doesnt have fixed columns , so I choosed "autogenerate
columns" datagrid.
I assign this dataset to my datagrid, but now I want my data should be
hyperlinks, so that I can navigate from that page to another, depending on
the link clicked.

how can I do in autogenerate columns

regards
ypul
 
G

Guest

Although in autogeneratecolumns option, the datagrid does not automatically
generate hyperlink for you, you can implement your code to create hyperlinks.
Following code snippet show how to do it:

In datagrid_ItemDataBound event:

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem){
foreach (TableCell cell in e.Item.Cells){
cell.Text = "<a href='myUrlSite/myPage.aspx?id=" + cell.Text + "'
target=_blank>" + cell.Text + "</a>"
}
}


HTH

Elton Wang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top