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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Question Dynamic Hyperlinks 1

Status
Not open for further replies.

lawlegacy

IS-IT--Management
Jun 5, 2006
53
0
0
US
I am implementing paging in my asp site. To do this I need to have a hyperlink for each page. For example, Previous 1 2 3 Next.

How do I create the 1 2 3 links dynamically? I am new to asp and so far I dont know how to write code on the page without using controls.

Thanks
 
I would use a datagrid or gridview for this, you can easily implement paging with either of them.
 
Is there anyway to write code to display hyperlinks without using controls?
 
My background is PHP, so I am a little confused. Doesn't seem like a datagrid would be efficient. All I really need is to do this...

for (int i=0; i < totalPages; i++)
{
response.write("<a href=?page=i>i</a>");
}
 
Yes, but as jbenson001 says, the GridView already has this functionality. Why try recreate it (especially as you are new to ASP.NET it will be easier if you take advantage of the built in features)?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
how would u use the gridview to do this?
 
[google]GridView Paging[/google]


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
oh.. that doesn't really help since Im using a datalist.
 
You could use an <asp:Literal />. Anything you add to the literal from the code behind page will render as html, so you can write whatever you want.

You could also add a placeholder, or a panel, then use the control.add() method to add a new control.

J
 
I'm a rocker through and through bro! ;-)

tek-tips has helped me so much I'm just glad to give a little back.

J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top