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

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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/>
 
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")%>'
 
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
 
Back
Top