Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 10, 2012 07:04 PM by hariniv
Member
337 Points
729 Posts
Dec 11, 2007 06:03 AM|LINK
i am trying to pass the querystring thru the navigateUrl of hyperlink .This hyperlink is inside grid view template.What is the correct syntax for that..i have tried couple of different combination but nothing works//thanks
NavigateUrl="~/InputScreen/PlayerRelationship.aspx?id" + Eval("PLAYER_ID") > // whats the correct syntax???
All-Star
126946 Points
17922 Posts
MVP
Dec 11, 2007 07:14 AM|LINK
Hi,
You can set the NavigateUrl in the code behind on page_load event.
hpl.NavigateUrl = "~/InputScreen/PlayerRelationship.aspx?id=" + Request.QueryString["id"];
73649 Points
7914 Posts
Moderator
Dec 11, 2007 08:01 AM|LINK
Hello,
You have to use inline format as follows :
<asp:TemplateColumn> <ItemTemplate> <asp:HyperLink ID="hpl" runat="server" Text='<%# getPlayerFullName((int)DataBinder.Eval(Container.DataItem,"PLAYER_ID")) %>' NavigateUrl='<%# DataBinder.Eval(Container.DataItem,"PLAYER_ID", "~/InputScreen/PlayerRelationship.aspx?id={0}") %>'> </asp:HyperLink> </ItemTemplate> </asp:TemplateColumn>
Contributor
6164 Points
1130 Posts
Dec 11, 2007 08:02 AM|LINK
Hi nb123,
Try this.
In ASPX.
NavigateUrl='<%#getURL(Server.UrlEncode(Request.QueryString["id"])) %>'
In ASPX.CS
{
}
This will do.
Regards,
Naveen
Dec 13, 2007 08:28 PM|LINK
Thanks guys ,i am currently using inline format but its good to know other options..
2 Points
6 Posts
Jul 10, 2012 07:04 PM|LINK
You can pass more than 1 parameter in the URL using the following syntax.
NavigateUrl='<%# string.Format("catering.aspx?ID={0}&Location={1}", Eval("ID"), Eval("Location")) %>'
I hope this helps somebody.
nb123
Member
337 Points
729 Posts
navigateurl - querystring syntax
Dec 11, 2007 06:03 AM|LINK
i am trying to pass the querystring thru the navigateUrl of hyperlink .This hyperlink is inside grid view template.What is the correct syntax for that..i have tried couple of different combination but nothing works//thanks
<ItemTemplate> <asp:HyperLink ID="hpl" runat=server Text='<%# getPlayerFullName((int)DataBinder.Eval(Container.DataItem,"PLAYER_ID")) %>'NavigateUrl="~/InputScreen/PlayerRelationship.aspx?id" + Eval("PLAYER_ID") > // whats the correct syntax???
</asp:HyperLink>
</ItemTemplate>vinz
All-Star
126946 Points
17922 Posts
MVP
Re: navigateurl - querystring syntax
Dec 11, 2007 07:14 AM|LINK
Hi,
You can set the NavigateUrl in the code behind on page_load event.
hpl.NavigateUrl = "~/InputScreen/PlayerRelationship.aspx?id=" + Request.QueryString["id"];
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
anas
All-Star
73649 Points
7914 Posts
Moderator
Re: navigateurl - querystring syntax
Dec 11, 2007 08:01 AM|LINK
Hello,
You have to use inline format as follows :
<asp:TemplateColumn> <ItemTemplate> <asp:HyperLink ID="hpl" runat="server" Text='<%# getPlayerFullName((int)DataBinder.Eval(Container.DataItem,"PLAYER_ID")) %>' NavigateUrl='<%# DataBinder.Eval(Container.DataItem,"PLAYER_ID", "~/InputScreen/PlayerRelationship.aspx?id={0}") %>'> </asp:HyperLink> </ItemTemplate> </asp:TemplateColumn>naveenj
Contributor
6164 Points
1130 Posts
Re: navigateurl - querystring syntax
Dec 11, 2007 08:02 AM|LINK
Hi nb123,
Try this.
In ASPX.
NavigateUrl='<%#getURL(Server.UrlEncode(Request.QueryString["id"])) %>'
In ASPX.CS
protected string getURL(object oQString){
return ("~/InputScreen/PlayerRelationship.aspx?id=" + (string)oQString);}
This will do.
Regards,
Naveen
Naveen Jose
ASP.NET Freelancer, Consultant
Please remember to click Mark as Answer on the post that helps you
nb123
Member
337 Points
729 Posts
Re: navigateurl - querystring syntax
Dec 13, 2007 08:28 PM|LINK
Thanks guys ,i am currently using inline format but its good to know other options..
hariniv
Member
2 Points
6 Posts
Re: navigateurl - querystring syntax
Jul 10, 2012 07:04 PM|LINK
You can pass more than 1 parameter in the URL using the following syntax.
NavigateUrl='<%# string.Format("catering.aspx?ID={0}&Location={1}", Eval("ID"), Eval("Location")) %>'
I hope this helps somebody.