Able
Able

Reputation: 3912

How I can do page navigation ASP.net

I would like to know how to do the page navigation in ASP.Net.

For example the following web page http://www.moneyguruindia.com/article.php?cid=1539&id=4 (this is in php).

After the .php there is a ? mark and cid value. In this case as per the cid value the web pages contents only will change while we press navigation button.

This is we can do it in ASP.net with Master pages and Content pages, but the problem is we need to create separate content pages(.aspx) to do this.

I would like to know any other mechanism to achieve this scenario.

Upvotes: 1

Views: 441

Answers (2)

ChrisLively
ChrisLively

Reputation: 88072

It's probably best to understand what the PHP page is doing.

Article.php is loading a particular article from the database based on the ID's supplied (cid=1539 and id=4). This isn't a different "page", just different content for that page.

In .Net you can do the exact same thing. This doesn't require master pages and content sections. It just requires that the page inspect the query string to determine what database records it needs to pull.

Now, in a .net site, like any other type of web app, you can have as many real pages as you want. Whether they are titled Article.aspx or whatever.aspx.

With that, your question is unclear at best as to exactly what it is you are trying to do. Specifically you state "the problem is we need to create separate content pages(.aspx) to do this"

Are you saying that you want to have multiple pages with different types of content or are you saying you only want a single page that delivers different, but related, content?

Upvotes: 1

Waqar Janjua
Waqar Janjua

Reputation: 6123

You can navigate to different pages in asp.net using Response.Redirect or Server.Redirect Method. In your link the url consist of query string with name cid .After ? querystring starts and multiple query strings feilds are separated by &.

For Example your link in asp.net can be used as Response.Redirect("http://www.moneyguruindia.com/article.aspx"+?cid=1539&id=4")

On the requested page get the content of query string by using the Request Object. string cid=Request.QueryString["cid"];

Master Page is not required, You can use query string with or with out masterpage.

Upvotes: 0

Related Questions