Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Parameters for DataNavigateUrlFormatString 2

Status
Not open for further replies.

sbushway

Programmer
Jan 27, 2003
58
US
Hi,
On one of my pages, I'm passing a variable to another page via a URL variable like this:

<asp:HyperLinkColumn DataNavigateUrlFormatString=&quot;details.aspx?ID={0}&quot; DataNavigateField=&quot;OrderID&quot; DataTextField=&quot;Quantity&quot;></asp:HyperLinkColumn>

And that works fine.

But what if I want to pass two parameters via URL? I want to pass the OrderID and the Quantity.

How do I do that?

Thanks in advance,
Suzanne
 
Sorry, but I have another question relating to this:

In the code that was in the FAQ:

<asp:TemplateColumn HeaderText=&quot;Select Site&quot;>
<ItemTemplate>
<asp:HyperLink
id=HyperLink1
runat=&quot;server&quot;
Text='<%# DataBinder.Eval(Container, &quot;DataItem.AWWCode&quot;)%>'
NavigateUrl='<%# &quot;ChemOT.aspx?AwwCode=&quot; & DataBinder.Eval(Container, &quot;DataItem.AWWCode&quot;)& &quot;&GroupName=&quot; & DataBinder.Eval(Container, &quot;DataItem.Group_Name&quot;)%>'
/>
</ItemTemplate>
</asp:TemplateColumn>

I tried to use this in my Datagrid, but i got an error saying that &quot;the active scheme does not support the element <asp:hyperlink>&quot;

I'm not using ItemTemplates or TemplateColumns. I'm strictly using a Datagrid:

<asp:datagrid>
<columns>
<asp:BoundColumn DataField=&quot;Rate&quot; HeaderText=&quot;Rate&quot;>
<asp:HyperLinkColumn DataNavigateUrlFormatString=&quot;details.aspx?ID={0}&quot; DataNavigateField=&quot;OrderID&quot; DataTextField=&quot;Quantity&quot;></asp:HyperLinkColumn>
</columns>
</asp:datagrid>

Can someone point me to the right direction so that I can pass multiple parameters via URL?

Thanks in advance~
Suzanne
 
Suz -

You can use ItemTemplates in a DataGrid, the FAQ examples are all datagrids. Is there a reason you cannot? Here is a complete datagrid form one of my pages:

<asp:DataGrid id=&quot;dgGroups&quot; runat=&quot;server&quot; AutogenerateColumns=&quot;false&quot; OnItemDataBound=&quot;dgGroups_ItemDataBound&quot; AllowSorting=&quot;True&quot; OnSortCommand=&quot;Sort_Grid&quot; align=&quot;left&quot; BorderColor=&quot;#CC9966&quot; BorderStyle=&quot;None&quot; BorderWidth=&quot;1px&quot; BackColor=&quot;White&quot; CellPadding=&quot;3&quot;>
<ItemStyle ForeColor=&quot;#330099&quot; BackColor=&quot;white&quot; Font-Size=&quot;12px&quot;></ItemStyle>
<HeaderStyle Font-Size=&quot;10&quot; horizontalalign=&quot;Center&quot; verticalalign=&quot;Middle&quot; ForeColor=&quot;#FFFFCC&quot; BackColor=&quot;#990000&quot;></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText=&quot;Select Site&quot;>
<ItemTemplate>
<asp:HyperLink
id=HyperLink1
runat=&quot;server&quot;
HeaderText=&quot;Select Site&quot;
Text='<%# DataBinder.Eval(Container, &quot;DataItem.AWWSiteCode&quot;)%>'
NavigateUrl='<%#strURL & DataBinder.Eval(Container, &quot;DataItem.AWWSiteCode&quot;) & &quot;&GroupName=&quot; & lblGrpName.Text & &quot;&ChartID=&quot; & ddType.SelectedItem.Value%>'
Sortexpression=&quot;AwwSiteCode&quot;
/>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField=&quot;Waterbody_Name&quot; HeaderText=&quot;Waterbody Name&quot; ItemStyle-width=&quot;100px&quot; Sortexpression=&quot;Waterbody_Name&quot;/>
<asp:BoundColumn DataField=&quot;Description&quot; HeaderText=&quot;Site Description&quot; ItemStyle-width=&quot;240px&quot; Sortexpression=&quot;Description&quot;/>
<asp:BoundColumn DataField=&quot;County&quot; HeaderText=&quot;Site County&quot; ItemStyle-width=&quot;70px&quot;/>
<asp:BoundColumn DataField=&quot;Latitude&quot; HeaderText=&quot;Latitude&quot; DataFormatString=&quot;{0:f4}&quot; ItemStyle-width=&quot;50px&quot;/>
<asp:BoundColumn DataField=&quot;Longitude&quot; HeaderText=&quot;Longitude&quot; DataFormatString=&quot;{0:f4}&quot; ItemStyle-width=&quot;50px&quot;/>
<asp:BoundColumn DataField=&quot;LastDate&quot; HeaderText=&quot;Last Date&quot; DataFormatString=&quot;{0:d}&quot; ItemStyle-width=&quot;60px&quot; Sortexpression=&quot;LastDate&quot;/>
<asp:BoundColumn DataField=&quot;ChemCt&quot; HeaderText=&quot;#Chm&quot; Sortexpression=&quot;ChemCt&quot;/>
<asp:BoundColumn DataField=&quot;BacCt&quot; HeaderText=&quot;#Bac&quot; Sortexpression=&quot;BacCt&quot;/>
<asp:TemplateColumn HeaderText=&quot;Active?&quot;>
<HeaderStyle horizontalalign=&quot;Center&quot; verticalalign=&quot;Middle&quot;></HeaderStyle>
<ItemStyle horizontalalign=&quot;Center&quot;></ItemStyle>
<ItemTemplate>
<asp:Image id=&quot;img_HUC11&quot; RunAt=&quot;Server&quot; ImageUrl=<%# WhichImage(Container.DataItem(&quot;Active&quot;)) %> />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText=&quot;HUC11 <br> 303(d)&quot;>
<HeaderStyle horizontalalign=&quot;Center&quot;></HeaderStyle>
<ItemStyle horizontalalign=&quot;Center&quot;></ItemStyle>
<ItemTemplate>
<asp:CheckBox id=&quot;chk_303&quot; RunAt=&quot;Server&quot; Checked=<%# Container.DataItem(&quot;IPStreams&quot;)%>/>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>

...this examples also shows calls to code-behind funtion during binding, q.v.,

Protected Function WhichImage(Active As Object) As String
If Active = 1 Then
Return &quot;Images/GreenFlag.gif&quot;
Else
Return &quot;Images/RedFlag.gif&quot;
End If
End Function

...to bind images. Hope this helps.

.
 
This is what I am using for my namespaces:

<%@ Page Language=&quot;VB&quot; EnableViewState=&quot;true&quot; Debug=&quot;false&quot;%>
<%@Import Namespace = &quot;Microsoft.VisualBasic&quot;%>
<%@Import Namespace = &quot;System&quot;%>
<%@Import Namespace = &quot;System.Web&quot;%>
<%@Import Namespace = &quot;System.Web.UI&quot;%>
<%@Import Namespace = &quot;System.Web.UI.HtmlControls&quot;%>
<%@Import Namespace = &quot;System.Web.UI.WebControls&quot;%>
<%@Import Namespace = &quot;System.Data&quot;%>
<%@Import Namespace = &quot;System.Data.OleDb&quot;%>

...post back, we can figure this out, I'm sure.

.
 
That worked! Thank you so much for your help, I really appreciate it :)

~Suzanne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top