Passing multiple query string params from datagrid hyperlink column

B

bpschmid

Ive got a datagrid with a hyperlink column.
I want to click on that column and go to another page, but
here's the kicker, I need and want to pass not one, but
two different query string parameters and format strings
from 2 different bound columns. I know I could do this
using session variables, but I really want to do it using
query string parameters. Anyone know a way to do this?
 
S

Sonali.NET[MVP]

Try
<asp:DataGrid id="DataGrid1" AutoGenerateColumns="False" style="Z-INDEX: 101; LEFT: 66px; POSITION: absolute; TOP: 79px" runat="server">
<Columns>
<asp:TemplateColumn HeaderText="Order">
<ItemTemplate>
<asp:Hyperlink runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderID")%>' NavigateUrl='<%# "page.aspx?Orderid=" + DataBinder.Eval(Container.DataItem,"Orderid") + "&ProductID=" + DataBinder.Eval(Container.DataItem,"ProductID")%>' ID="Hyperlink1" NAME="Hyperlink1"/>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
Use & in case of Vb.NET
HTH
Regards
Sushila
..NET MVP
 
B

bpschmid

Thanks!

Do you have to use a template column?

-----Original Message-----
Try
<asp:DataGrid id="DataGrid1" AutoGenerateColumns="False"
style="Z-INDEX: 101; LEFT: 66px; POSITION: absolute; TOP:
79px" runat="server">
<Columns>
<asp:TemplateColumn HeaderText="Order">
<ItemTemplate>
<asp:Hyperlink runat="server" Text='<%
#DataBinder.Eval(Container.DataItem,"OrderID")%>'
NavigateUrl='<%# "page.aspx?Orderid=" + DataBinder.Eval
(Container.DataItem,"Orderid") + "&ProductID=" +
DataBinder.Eval(Container.DataItem,"ProductID")%>'
ID="Hyperlink1" NAME="Hyperlink1"/>
 
S

Sonali.NET[MVP]

To pass 2 variable you wud use template column

bpschmid said:
Thanks!

Do you have to use a template column?


style="Z-INDEX: 101; LEFT: 66px; POSITION: absolute; TOP:
79px" runat="server">
#DataBinder.Eval(Container.DataItem,"OrderID")%>'
NavigateUrl='<%# "page.aspx?Orderid=" + DataBinder.Eval
(Container.DataItem,"Orderid") + "&ProductID=" +
DataBinder.Eval(Container.DataItem,"ProductID")%>'
ID="Hyperlink1" NAME="Hyperlink1"/>
 

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

Top