Help with hyperlinkcolumn, I can't seem to get it work!

G

Guest

I've tried several posting examples to no avail.
I'm trying to pass two parameters to the hyperlink inside of the grid. I've
gone to this link that was posted, and besides the typo (missing '>') I can't
get it to work.
http://www.extremeexperts.com/Net/faq/PassingMulitpleParameterinURLLink.aspx

Does anyone have a working example?
need: pagename?tab=(tabname)&id={0}
first is a request.param value (tabname)
second is a container field (SurveyResponseheaderid)

Help......Thanx.
 
G

Gopal \(FMS, Inc.\)

How about this? Does this work for you?
<asp:datagrid id="Datagrid1" runat="server" AutoGenerateColumns="False"
BorderColor="black"
HeaderStyle-CssClass="tableHeader" ItemStyle-CssClass= "tableItem">
<Columns>
<asp:TemplateColumn HeaderText="MyCol">
<ItemTemplate>
<asp:Hyperlink runat="server"
Text='<%#DataBinder.Eval(Container.DataItem,"Name")%>'
NavigateUrl='pagename?tab=<%Request.QueryString("tabname")%>&id=<%#DataBinde
r.Eval(Container.DataItem,"SurveyResponseheaderid")%>' ID="Hyperlink1"/>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

--
Gopal Rangaswamy
Microsoft Certified Solutions Developer
FMS, Inc.
<http://www.fmsinc.com/consulting>
<http://www.fmsinc.com/dotnet/SourceBook/>
 
G

Guest

I tried this and as I thought, it doesn't appear to allow <% %>.
So when you look at the link it lists the text
<%Request.Params("tab")%>&id=<%#DataBinder.Eval(Container.DataItem,"SurveyResponseheaderid")%>'
 
S

Saravana

Here is the corrected version,

<asp:datagrid id="Datagrid1"
runat="server" AutoGenerateColumns="False" BorderColor="black"
HeaderStyle-CssClass="tableHeader"


ItemStyle-CssClass="tableItem">

<Columns>


<asp:TemplateColumn HeaderText="Order">


<ItemTemplate>


<asp:Hyperlink runat="server" Text= '<%#
DataBinder.Eval(Container.DataItem,"ProductName").tostring %>'


NavigateUrl='<%# "page.aspx?Name=" & DataBinder.Eval
(Container.DataItem,"ProductName").tostring & _

"&ProductID=" &
DataBinder.Eval(Container.DataItem,"ProductID").tostring %>'
ID="ProductName"/>


</ItemTemplate>


</asp:TemplateColumn>

</Columns>

</asp:datagrid>


Check out now, if you still face problem. Let me know about it.

--
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
 

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,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top