How to keep a field in datagrid as html link...

I

Its_Me_SunnY

Hi,
can any one help me how to make a cell in data grid link to another
page.... like i have a field "refno" in my table so when in get the
values from table to datagrid the refno's of every record must link to
another page..
thanks in advance...
SUNNY
 
T

TJS

<asp:templatecolumn headertext="">
<itemtemplate>
<asp:hyperlink
navigateurl='<%# "targetpage.aspx?refno=" &
Container.DataItem("refno")) %>'
id="Hyperlink1"
runat="server"
target="_blank"
text="View" />
</itemtemplate>
</asp:templatecolumn>
 
D

dan.c.roth

Hi

See the NavigateUrl in the datagrid def below.

<asp:datagrid id="DataGridILTables" runat="server" Width="100%"
PageSize="20" AllowPaging="True"
Font-Names="tahoma" BackColor="#F2F0E4" GridLines="None"
BorderStyle="Solid" cellSpacing="1"
cellPadding="1" BorderWidth="3px" BorderColor="Black">
<SelectedItemStyle
BackColor="WhiteSmoke"></SelectedItemStyle>
<AlternatingItemStyle
BackColor="White"></AlternatingItemStyle>
<ItemStyle BackColor="WhiteSmoke"></ItemStyle>
<HeaderStyle BackColor="Control"></HeaderStyle>
<Columns>
<asp:TemplateColumn>
<HeaderStyle Width="50%"></HeaderStyle>
<HeaderTemplate>
Table Name
</HeaderTemplate>
<ItemTemplate>
<TABLE style="BACKGROUND-COLOR: transparent"
cellSpacing="0" cellPadding="1" border="0">
<TR>
<TD>
<asp:HyperLink id=HyperLinkMaintainTableIMG
runat="server" Width="3px" NavigateUrl='<%#
DataBinder.Eval(Container.DataItem, "OnClick")%>' Height="7px"
ImageUrl="images/i_data_table_off.gif">
</asp:HyperLink></TD>
<TD>
<asp:HyperLink id=HyperLinkMaintainTableLabel
runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Table
Name")%>' NavigateUrl='<%# DataBinder.Eval(Container.DataItem,
"OnClick")%>' Font-Underline="True">
</asp:HyperLink></TD>
</TR>
</TABLE>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle Mode="NumericPages"></PagerStyle>
</asp:datagrid>


Reagards,

Daniel Roth
MCSD.NET
 

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,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top