Gridview, DataNavigateUrlFormatString and request.querystring

I

Ixnay

Thanks in advance for any help you can give me on this.

I am trying to include the value from a request.querystring in the
DataNavigateUrlFormatString

I am able to include one of the values which comes from the database
to make a link with the syntax

http://server/work_order.asp?WorkOrder=12345678&Site=NYC but I cannot
get the NYC value to work from a request.querystring when submitted
from http://server/default.aspx?Site=NYC

<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" CellPadding="4"
Font-Size="Small" ForeColor="#333333" GridLines="None">
<Columns>
<asp:HyperLinkField
DataNavigateUrlFields="Work_Order"

DataNavigateUrlFormatString="http://server/work_order.asp?WorkOrder={0}&amp;Site="
DataTextField="Work_Order"
HeaderText="LinkField"
Target="_blank" />



DataNavigateUrlFormatString="http://server/work_order_print.asp?WorkOrder={0}&amp;Site=<%=Site
%>"

Becomes

<a
href="http://server/work_order.asp?WorkOrder=12345678&amp;Site=&lt;%=Site
%>

If I try

DataNavigateUrlFormatString="http://server/work_order.asp?WorkOrder={0}&amp;Site="
+ <%=Site %>
It errors with
DataNavigateUrlFormatString="http://server/work_order.asp?WorkOrder={0}&amp;Site="
+') is not allowed within a
'System.Web.UI.WebControls.DataControlFieldCollection'.

Line 27:
DataNavigateUrlFormatString="http://server/work_order.asp.asp?WorkOrder={0}&amp;Site="
+ <%=Site %>

Thanks again from a new asp.net user.
 
K

Keith

Thanks in advance for any help you can give me on this.

I am trying to include the value from a request.querystring in the
DataNavigateUrlFormatString

I am able to include one of the values which comes from the database
to make a link with the syntax

http://server/work_order.asp?WorkOrder=12345678&Site=NYCbut I cannot
get the NYC value to work from a request.querystring when submitted
from http://server/default.aspx?Site=NYC

<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" CellPadding="4"
Font-Size="Small" ForeColor="#333333" GridLines="None">
<Columns>
<asp:HyperLinkField
DataNavigateUrlFields="Work_Order"

DataNavigateUrlFormatString="http://server/work_order.asp?WorkOrder={0}&amp;Site="
DataTextField="Work_Order"
HeaderText="LinkField"
Target="_blank" />

DataNavigateUrlFormatString="http://server/work_order_print.asp?WorkOrder={0}&amp;Site=<%=Site
%>"

Becomes

<a
href="http://server/work_order.asp?WorkOrder=12345678&Site=<%=Site
%>

If I try

DataNavigateUrlFormatString="http://server/work_order.asp?WorkOrder={0}&amp;Site="
+ <%=Site %>
It errors with
DataNavigateUrlFormatString="http://server/work_order.asp?WorkOrder={0}&amp;Site="
+') is not allowed within a
'System.Web.UI.WebControls.DataControlFieldCollection'.

Line 27:
DataNavigateUrlFormatString="http://server/work_order.asp.asp?WorkOrder={0}&amp;Site="
+ <%=Site %>

Thanks again from a newasp.netuser.

Was wondering if you ever found a solution - I am trying to do the
exact same thing and having no luck.
 
B

bpd

Was wondering if you ever found a solution - I am trying to do the
exact same thing and having no luck.- Hide quoted text -

- Show quoted text -

I haven't used DataNavigateUrlFields (yet), but have you tried:
DataNavigateUrlFields="Work_Order",
Request.Querystring["site"].ToString().Trim()
DataNavigateUrlFormatString="http://server/work_order_print.asp?
WorkOrder={0}&amp;Site={1}"
 

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,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top