hyper link in DataGrid

A

Alexander Kaplunov

I have a DataGrid, which gets populated by DataSet.

DataGrid1.DataSource=ds;
DataGrid1.DataBind();

What I need to do is when the DataGrid is populated each item in first
column should be a link (or something clickable). I need to be able to know
when user has clicked on a particular item and then I can take some action.

Maybe I shouldn't use DataGrid? Any help would be appreciated.

Thank you,
Alex.
 
M

Mahesh ChandraMouli[MVP]

Hi,

Here is the sample.

<asp:DataGrid runat="server" id="DataGridID"
AutoGenerateColumns="False"
...>

<Columns>
...
<asp:HyperLinkColumn Text="Hyperlink Text"
DataNavigateUrlField="SomeDataSourceField"
DataNavigateUrlFormatString="/details.aspx?ID=
{0}"
Target="_blank" />
...
</Columns>
</asp:DataGrid>

on the ItemDataBound column you can raise ur method.


Regards
Mahesh ChandraMouli
Microsoft .NET MVP|MCAD (Charter Member)
 
A

Alexander Kaplunov

Make a DB call and repopulate the DataGrid with new stuff returned from DB.
 

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

Similar Threads

Gridview with hyper link 1
Hyper link in Datagrid 1
DataGrid 1
Wrong event handler firing in DataGrid 0
how to use hyper columns in datagrid 1
Datagrid problems 0
NEWBIE & datagrid 2
XML, DataSet, DataGrid 3

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top