hyperlinks in gridview

G

Guest

In my gridview i need to add hyper links but add them as such

headers - - -- ---------------------------------------------
-------------------------------------------------------------
link1 BMW 2005 25,000
link2
----------------------------------------------------------------
link1 Lexus 1996 12,000
link2

link1 url: details.aspx?id=123&carMake=BMW
link2 url: salesman.aspx?id=12&date=5/5/2006

how can i accomplish this in the gridview?
 
B

Bruno Alexandre

adding a templateHeader and the content would be something like

<asp:buttonlink id="lnk1" runat="server"
text='<%# Eval("yourCarMake") %>'
postbacknavigation='<%# string.format("details.aspx?id={0}&car={1}",
Eval("yourCarID"), Eval("yourCarMake") ) %>'


I dont know by heart the "postbacknavigation" (and I dont want to open VS2k5
just to see that :) ) but it's something like it, the rest is ok, try it.
 
G

Guest

I got the link1 working but how can I add link2 under link2? I don't want
another column for link to, I want both links in the same column. Would I do
the templateheader to do that or no?
 
B

Bruno Alexandre

forogot about link 2 :-D

just add the samething with <br/> so it will change line:

<asp:buttonlink id="lnk1" runat="server"
text='<%# Eval("yourCarMake") %>'
postbacknavigation='<%# string.format("details.aspx?id={0}&car={1}",
Eval("yourCarID"), Eval("yourCarMake") ) %>' />
<br/>
<asp:buttonlink id="lnk2" runat="server"
text='<%# Eval("yourCarMake") %>'
postbacknavigation='<%# string.format("salesman.aspx?id={0}&date={1}",
Eval("salesID"), Eval("date") ) %>' />
 

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