Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: passing values in querystring


Message #1 by Michael Bell <mbell218@p...> on Fri, 19 Jan 2001 11:46:15 -0800

Hello



How do you append querystring values in ASPX?



For example, I have the following template that produces navigation from a

database query:



<!--TOOLBAR-->

<asp:Repeater id="Toolbar" runat="server">

<template name="HeaderTemplate">

<table>

<tr>

<td

</template>

<template name="ItemTemplate">

   <asp:Hyperlink

NavigateURL='<%#Container.DataItem("navigation_url")%>'

Text='<%#Container.DataItem("navigation_title")%>' runat="server"

/>   |

</template>

<template name="FooterTemplate">

</td>

</tr>

</table>

</template>

</asp:Repeater>

<!--TOOLBAR-->



How do you format like this:

<asp:Hyperlink

NavigateURL='<%#Container.DataItem("navigation_url")%>?this=that&that=this



I would like to be able to append values from other columns in the DB table,

as well as add an external variable to the querystring.



Thanks for any tips!









Message #2 by "Jonathan Goodyear" <jon@a...> on Sat, 20 Jan 2001 09:43:30 -0500
Michael,



Here's the syntax that I used in a repeater to do what you asked...



<asp:hyperlink navigateurl='<%# "message_view.aspx?pid=" &

Container.DataItem("ID").ToString() & "&fid=" &

Request.QueryString("fid").ToString() & "&fname=" &

Server.UrlEncode(Request.QueryString("fname").ToString()) %>' text='<%#

Container.DataItem("SUBJECT").ToString() %>' runat="Server" />



Hope this helps!





----jonathan goodyear, mcsd, mcp, cls

The original "angryCoder" (watch for the upcoming launch of angryCoder.com)

president@a...





----- Original Message -----

From: "Michael Bell" <mbell218@p...>

To: "ASP+" <aspx@p...>

Sent: Friday, January 19, 2001 2:46 PM

Subject: [aspx] passing values in querystring





>

> Hello

>

> How do you append querystring values in ASPX?

>

> For example, I have the following template that produces navigation from a

> database query:

>

> <!--TOOLBAR-->

> <asp:Repeater id="Toolbar" runat="server">

> <template name="HeaderTemplate">

> <table>

> <tr>

> <td

> </template>

> <template name="ItemTemplate">

>    <asp:Hyperlink

> NavigateURL='<%#Container.DataItem("navigation_url")%>'

> Text='<%#Container.DataItem("navigation_title")%>' runat="server"

> />   |

> </template>

> <template name="FooterTemplate">

> </td>

> </tr>

> </table>

> </template>

> </asp:Repeater>

> <!--TOOLBAR-->

>

> How do you format like this:

> <asp:Hyperlink

> NavigateURL='<%#Container.DataItem("navigation_url")%>?this=that&that=this

>

> I would like to be able to append values from other columns in the DB

table,

> as well as add an external variable to the querystring.

>

> Thanks for any tips!

>

>
Message #3 by Michael Bell <mbell218@p...> on Sat, 20 Jan 2001 07:58:07 -0800
Hi Jonathan



Thanks for that snippet.

I was having problems finding documentation in the VB source, and found it

much easier in C#:



foreach (DataRow ToolBar in DStoolbar.Tables["tb_navigation"].Rows)

{

String QueryString = "?sid=" + Request.Params["sid"] + "&node=" +

ToolBar["navigation_id"].ToString();

Response.Write("<a href=" + ToolBar["navigation_url"].ToString() +

QueryString + ">" + ToolBar["navigation_title"].ToString() +

"</a>   |   " );

}



It's always good to have the code in both languages, though I prefer C# :)



Thanks again



Michael





-----Original Message-----

From: Jonathan Goodyear [mailto:jon@a...]

Sent: Saturday, January 20, 2001 6:44 AM

To: ASP+

Subject: [aspx] Re: passing values in querystring





Michael,



Here's the syntax that I used in a repeater to do what you asked...



<asp:hyperlink navigateurl='<%# "message_view.aspx?pid=" &

Container.DataItem("ID").ToString() & "&fid=" &

Request.QueryString("fid").ToString() & "&fname=" &

Server.UrlEncode(Request.QueryString("fname").ToString()) %>' text='<%#

Container.DataItem("SUBJECT").ToString() %>' runat="Server" />



Hope this helps!





----jonathan goodyear, mcsd, mcp, cls

The original "angryCoder" (watch for the upcoming launch of angryCoder.com)

president@a...





----- Original Message -----

From: "Michael Bell" <mbell218@p...>

To: "ASP+" <aspx@p...>

Sent: Friday, January 19, 2001 2:46 PM

Subject: [aspx] passing values in querystring





>

> Hello

>

> How do you append querystring values in ASPX?

>

> For example, I have the following template that produces navigation from a

> database query:

>

> <!--TOOLBAR-->

> <asp:Repeater id="Toolbar" runat="server">

> <template name="HeaderTemplate">

> <table>

> <tr>

> <td

> </template>

> <template name="ItemTemplate">

>    <asp:Hyperlink

> NavigateURL='<%#Container.DataItem("navigation_url")%>'

> Text='<%#Container.DataItem("navigation_title")%>' runat="server"

> />   |

> </template>

> <template name="FooterTemplate">

> </td>

> </tr>

> </table>

> </template>

> </asp:Repeater>

> <!--TOOLBAR-->

>

> How do you format like this:

> <asp:Hyperlink

> NavigateURL='<%#Container.DataItem("navigation_url")%>?this=that&that=this

>

> I would like to be able to append values from other columns in the DB

table,

> as well as add an external variable to the querystring.

>

> Thanks for any tips!

>


  Return to Index