Mulitple datafields in a template column

G

Guest

Hi folks

This is what I would like to do

<asp:TemplateColumn HeaderText="Purchase Order"><ItemTemplate><asp:HyperLink
runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.ID1") %>'
NavigateUrl='page.aspx?var1='<%# DataBinder.Eval(Container, "DataItem.ID1") %>'var2='<%# DataBinder.Eval(Container, "DataItem.ID2") %
ID="Hyperlink1"></asp:HyperLink></ItemTemplate></asp:TemplateColumn

What I want to do is build a Hyperlink with 2 variables from the dataset, not just one. Can something like this be done

thx...sonny
 
S

Scott Allen

You are very close, but you probably found out the TemplateColumn does
not have a NavigateUrl property. One solution is to add an anchor tag
yourself:

<asp:TemplateColumn HeaderText="PurchaseOrder">
<ItemTemplate>
<a href='page.aspx?
param1= <%#DataBinder.Eval(Container.DataItem,"ID1")%>
&param2=<%#DataBinder.Eval(Container.DataItem, "ID2")%>'>
<%#DataBinder.Eval(Container.DataItem, "ID1")%>
</a>
</ItemTemplate>
</asp:TemplateColumn>

HTH,
 

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,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top