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

Form database contents hyperlink

P: n/a
I'm using ASP.Net and SQL Server. I have a table called states. I have 2
forms.
On form 1 is the 50 states in textboxes created with a loop.
I want to have those 50 or 45 or whatever amount of states have a hyperlink.
Once you click the hyperlink it will take the stateId from the click event
and use the Get method to send it to the next page.
Page 2 will simply use the browswer get method to show information based on
that stateid.
So my question is how to create a text hyperlink using a loop that onclick
of hyperlink it opens up the next page like: http://www.etc.com?stateid.
How do I create that hyperlink?

Thanks.
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
First of all, if you have a table called states, you probably have there a
record for every state. Then why do you need a loop to create textboxes? You
can use a datagrid or datalist or repeater and databind it to the table.
Even if you for whatever reason want textboxes, you can make a templated
column.

Now, there is a server control called HyperLink You can either use it
instead of the textbox or next to the textbox. You will have to setup in
runtime its property NavigateUrl. If you are using a loop, do it in the
loop. If you switch to a datagrid/datalist/repeater, use either databinding
expression or ItemDataBound event. That is the direction. The details you
can work out yourself.

Eliyahu

"Big E" <no****@nospam.com> wrote in message
news:Ov*************@tk2msftngp13.phx.gbl...
I'm using ASP.Net and SQL Server. I have a table called states. I have 2
forms.
On form 1 is the 50 states in textboxes created with a loop.
I want to have those 50 or 45 or whatever amount of states have a hyperlink. Once you click the hyperlink it will take the stateId from the click event
and use the Get method to send it to the next page.
Page 2 will simply use the browswer get method to show information based on that stateid.
So my question is how to create a text hyperlink using a loop that onclick
of hyperlink it opens up the next page like: http://www.etc.com?stateid.
How do I create that hyperlink?

Thanks.

Nov 18 '05 #2

P: n/a
Another way would be to use Literal control and add the content between an
<a> tag.

"Eliyahu Goldin" <re*************@monarchmed.com> bl
news:uC**************@tk2msftngp13.phx.gbl g...
First of all, if you have a table called states, you probably have there a
record for every state. Then why do you need a loop to create textboxes? You can use a datagrid or datalist or repeater and databind it to the table.
Even if you for whatever reason want textboxes, you can make a templated
column.

Now, there is a server control called HyperLink You can either use it
instead of the textbox or next to the textbox. You will have to setup in
runtime its property NavigateUrl. If you are using a loop, do it in the
loop. If you switch to a datagrid/datalist/repeater, use either databinding expression or ItemDataBound event. That is the direction. The details you
can work out yourself.

Eliyahu

"Big E" <no****@nospam.com> wrote in message
news:Ov*************@tk2msftngp13.phx.gbl...
I'm using ASP.Net and SQL Server. I have a table called states. I have 2
forms.
On form 1 is the 50 states in textboxes created with a loop.
I want to have those 50 or 45 or whatever amount of states have a

hyperlink.
Once you click the hyperlink it will take the stateId from the click event and use the Get method to send it to the next page.
Page 2 will simply use the browswer get method to show information based

on
that stateid.
So my question is how to create a text hyperlink using a loop that onclick of hyperlink it opens up the next page like: http://www.etc.com?stateid.
How do I create that hyperlink?

Thanks.


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.