By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

Simple NavigateURL, I Think

P: n/a
Sorry, very Newbie question here. I don't know what I'm doing wrong. I have
to use a <asp:hyperlink> to go to another page. I want to pick up the value
in a text box. This is what I've tried and It tells me it won't work. Not
sure how to do it.

NavigateUrl="~/secure/Confirm.aspx?No=201, IDate=" & TxtBx1.text & ", ODate
= "
& TxtBx2.text
Thank you in advance.
Mar 21 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Since the TextBox is a server control, your strategy will not get the
navigateUrl value to include the user entry until you post the form back to
the server. In which case, you should compose the NavigateUrl property upon
postback, e.g.

HyperLink1.NavigateUrl ="~/secure/Confirm.aspx?No=201, IDate=" + TxtBx1.text
& ", ODate= " & TxtBx2.text
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Vear" wrote:
Sorry, very Newbie question here. I don't know what I'm doing wrong. I have
to use a <asp:hyperlink> to go to another page. I want to pick up the value
in a text box. This is what I've tried and It tells me it won't work. Not
sure how to do it.

NavigateUrl="~/secure/Confirm.aspx?No=201, IDate=" & TxtBx1.text & ", ODate
= "
& TxtBx2.text
Thank you in advance.

Mar 21 '06 #2

P: n/a
On more aside note is that when composing querystring parameters you should
use the & instead of the commas as separators of parameters, e.g.

hl1.NavigateUrl = "~/secure/Confirm.aspx?No=201&IDate=" &
Server.HtmlEncode(TxtBx1.text) + "&ODate= " & Server.HtmlEncode(TxtBx2.text)

However, if you will compose the NavigateUrl on the server based on the
user's entry, you might as well consider using the Response.Redirect to
redirect the user's display to the requested page instead of just composing a
hyperlink on which the user still has to click on to navigate to the required
page.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Phillip Williams" wrote:
Since the TextBox is a server control, your strategy will not get the
navigateUrl value to include the user entry until you post the form back to
the server. In which case, you should compose the NavigateUrl property upon
postback, e.g.

HyperLink1.NavigateUrl ="~/secure/Confirm.aspx?No=201, IDate=" + TxtBx1.text
& ", ODate= " & TxtBx2.text
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Vear" wrote:
Sorry, very Newbie question here. I don't know what I'm doing wrong. I have
to use a <asp:hyperlink> to go to another page. I want to pick up the value
in a text box. This is what I've tried and It tells me it won't work. Not
sure how to do it.

NavigateUrl="~/secure/Confirm.aspx?No=201, IDate=" & TxtBx1.text & ", ODate
= "
& TxtBx2.text
Thank you in advance.

Mar 21 '06 #3

P: n/a
Hi,

Thanks for your reply. The reason I've using a Hyperlink is because I want
them to click on an image with contains the link.

So if I understand properly, I can't refer to a text box through a hyperlink
unless I add it in code.
Thank you

"Phillip Williams" wrote:
On more aside note is that when composing querystring parameters you should
use the & instead of the commas as separators of parameters, e.g.

hl1.NavigateUrl = "~/secure/Confirm.aspx?No=201&IDate=" &
Server.HtmlEncode(TxtBx1.text) + "&ODate= " & Server.HtmlEncode(TxtBx2.text)

However, if you will compose the NavigateUrl on the server based on the
user's entry, you might as well consider using the Response.Redirect to
redirect the user's display to the requested page instead of just composing a
hyperlink on which the user still has to click on to navigate to the required
page.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Phillip Williams" wrote:
Since the TextBox is a server control, your strategy will not get the
navigateUrl value to include the user entry until you post the form back to
the server. In which case, you should compose the NavigateUrl property upon
postback, e.g.

HyperLink1.NavigateUrl ="~/secure/Confirm.aspx?No=201, IDate=" + TxtBx1.text
& ", ODate= " & TxtBx2.text
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Vear" wrote:
Sorry, very Newbie question here. I don't know what I'm doing wrong. I have
to use a <asp:hyperlink> to go to another page. I want to pick up the value
in a text box. This is what I've tried and It tells me it won't work. Not
sure how to do it.

NavigateUrl="~/secure/Confirm.aspx?No=201, IDate=" & TxtBx1.text & ", ODate
= "
& TxtBx2.text
Thank you in advance.

Mar 21 '06 #4

P: n/a
Using the HyperLink control to display an image that can link to a URL is
quite alright. You just cannot compose its NavigateUrl property value from a
server control (such as the TextBox) without causing a round trip to the
server.

In programming for web applications, as opposed to desktop application, one
must understand the difference between the web server controls and the
objects that they render on the browser. The values that the user enter on
the objects displayed on the browser can be retrieved using the server
controls properties (such as the Text property of the TextBox) only when
posted back to the server; at which stage the ASP.NET engine constructs back
the server controls (e.g. the TextBox) from the browser objects.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Vear" wrote:
Hi,

Thanks for your reply. The reason I've using a Hyperlink is because I want
them to click on an image with contains the link.

So if I understand properly, I can't refer to a text box through a hyperlink
unless I add it in code.
Thank you

"Phillip Williams" wrote:
On more aside note is that when composing querystring parameters you should
use the & instead of the commas as separators of parameters, e.g.

hl1.NavigateUrl = "~/secure/Confirm.aspx?No=201&IDate=" &
Server.HtmlEncode(TxtBx1.text) + "&ODate= " & Server.HtmlEncode(TxtBx2.text)

However, if you will compose the NavigateUrl on the server based on the
user's entry, you might as well consider using the Response.Redirect to
redirect the user's display to the requested page instead of just composing a
hyperlink on which the user still has to click on to navigate to the required
page.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Phillip Williams" wrote:
Since the TextBox is a server control, your strategy will not get the
navigateUrl value to include the user entry until you post the form back to
the server. In which case, you should compose the NavigateUrl property upon
postback, e.g.

HyperLink1.NavigateUrl ="~/secure/Confirm.aspx?No=201, IDate=" + TxtBx1.text
& ", ODate= " & TxtBx2.text
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Vear" wrote:

> Sorry, very Newbie question here. I don't know what I'm doing wrong. I have
> to use a <asp:hyperlink> to go to another page. I want to pick up the value
> in a text box. This is what I've tried and It tells me it won't work. Not
> sure how to do it.
>
> NavigateUrl="~/secure/Confirm.aspx?No=201, IDate=" & TxtBx1.text & ", ODate
> = "
> & TxtBx2.text
>
>
> Thank you in advance.

Mar 21 '06 #5

P: n/a
Thanks so much for your help. I have a better understanding of the process.

"Phillip Williams" wrote:
Using the HyperLink control to display an image that can link to a URL is
quite alright. You just cannot compose its NavigateUrl property value from a
server control (such as the TextBox) without causing a round trip to the
server.

In programming for web applications, as opposed to desktop application, one
must understand the difference between the web server controls and the
objects that they render on the browser. The values that the user enter on
the objects displayed on the browser can be retrieved using the server
controls properties (such as the Text property of the TextBox) only when
posted back to the server; at which stage the ASP.NET engine constructs back
the server controls (e.g. the TextBox) from the browser objects.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Vear" wrote:
Hi,

Thanks for your reply. The reason I've using a Hyperlink is because I want
them to click on an image with contains the link.

So if I understand properly, I can't refer to a text box through a hyperlink
unless I add it in code.
Thank you

"Phillip Williams" wrote:
On more aside note is that when composing querystring parameters you should
use the & instead of the commas as separators of parameters, e.g.

hl1.NavigateUrl = "~/secure/Confirm.aspx?No=201&IDate=" &
Server.HtmlEncode(TxtBx1.text) + "&ODate= " & Server.HtmlEncode(TxtBx2.text)

However, if you will compose the NavigateUrl on the server based on the
user's entry, you might as well consider using the Response.Redirect to
redirect the user's display to the requested page instead of just composing a
hyperlink on which the user still has to click on to navigate to the required
page.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Phillip Williams" wrote:

> Since the TextBox is a server control, your strategy will not get the
> navigateUrl value to include the user entry until you post the form back to
> the server. In which case, you should compose the NavigateUrl property upon
> postback, e.g.
>
> HyperLink1.NavigateUrl ="~/secure/Confirm.aspx?No=201, IDate=" + TxtBx1.text
> & ", ODate= " & TxtBx2.text
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Vear" wrote:
>
> > Sorry, very Newbie question here. I don't know what I'm doing wrong. I have
> > to use a <asp:hyperlink> to go to another page. I want to pick up the value
> > in a text box. This is what I've tried and It tells me it won't work. Not
> > sure how to do it.
> >
> > NavigateUrl="~/secure/Confirm.aspx?No=201, IDate=" & TxtBx1.text & ", ODate
> > = "
> > & TxtBx2.text
> >
> >
> > Thank you in advance.

Mar 21 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.