The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Putting request.querystring in NavigateUrl= of asp:hyperlink
Posted: 18 Dec 06 10:14 AM
|
fiogf49gjkf0d I need to add the request.querystring("event") value to the NavigateUrl of this link such as help.aspx?event=<.%.= request..querystring("event") %.>
[asp;hyperlink runat server NavigateUrl=help.aspx ]Help! [/asp;hyperlink]
(had to play with syntax to get it to display!)
What is the proper way to do this with VS .NET 2003?
Signed very green .NET newbie! |
|
|
|
Re: Putting request.querystring in NavigateUrl= of asp:hyperlink
Posted: 02 Jan 07 1:03 PM
|
fiogf49gjkf0d 'Be sure to check that the param exists first
mylink.navigateURL = "help.aspx?event=" + request.params["event"] (in codebehind or code block)
Since you asked the proper way... I dont think it is appropriate to edit the navigateurl property using <%%> as you would have with classic ASP This is why MS exposed such rich objects. If you have a need to edit it in the manner you have, then you should just use a hyperlink control from the html section (not )
|
|
|
|
Re: Putting request.querystring in NavigateUrl= of asp:hyperlink
Posted: 02 Jan 07 2:24 PM
|
fiogf49gjkf0d As Jason mentioned, you want to check for non-null existence of the param and it's probably better to do it in another place anyway. I'd probably check in the page_load for when !this.IsPostBack for the param and then set the NavigateUrl from the codebehind.
Something like this:
void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { object o = Request.QueryString["event"]; if (o != null) linkHelp.NavagateUrl = "help.aspx?event=" + o.ToString(); } }
Got it? |
|
|
|
Re: Putting request.querystring in NavigateUrl= of asp:hyperlink
Posted: 02 Jan 07 2:26 PM
|
fiogf49gjkf0d Another option is to use a LinkButton as well. Then, there is no URL for the link, but instead if raises a postback, which you could then get the event param and do a Response.Redirect("page.aspx?event=" + eventparam); |
|
|
| |
|