Loading ...

Dynamic links, query string and datalist problem

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  web forms / data controls   » Dynamic links, query string and datalist problem

Dynamic links, query string and datalist problem

Posts under the topic: Dynamic links, query string and datalist problem

Posted: 7/5/2010

Lurker 10  points  Lurker
  • Joined on: 7/5/2010
  • Posts: 2

Here's the scenario:

Let's say I passed a couple of querystring to populate my datalist on another page. Then I want to filter/refine that datalist further by clicking on links( which are dynamically created depending on the data on the datalist) and when clicked will pass another querystring to create a new refined datalist.

Can anyone guide me on how to do this?

 


Posted: 7/5/2010

Lurker 270  points  Lurker
  • Joined on: 1/3/2009
  • Posts: 14

hi dumont,

as per my understating you want to refine/filter the datalist on current page by using querystring generated on this page. for this you can redirect to same page with newly created querystring when link is clicked.

suppose when first time your datalist is created you query string is like  "http://www.mydomain.com/Default.aspx?query1=1&query2=2"

and after filter/refine you want to change it to "http://www.mydomain.com/Default.aspx?query3=1&query4=4"

simplest way is use following code on link click event.

 

Response.Redirect("Default.aspx?query3=3&query4=4"); 

Posted: 7/5/2010

Lurker 10  points  Lurker
  • Joined on: 7/5/2010
  • Posts: 2

Not exactly but what I'm after is like this, example, http://www.mydomain.com/Default.aspx?query1=1. Now when I click a link, the URL will become http://www.mydomain.com/Default.aspx?query1=1&query2=2". and this goes on until the datalist contains maybe 5 or less records. 

 

Another question, what if I want my link to display how many records will be it produce if I click on that link? How can I display that?

Example: For the 1st page, I clicked US, the second page will display a datalist of landmarks in the US. Then there's a list of states like New York (5), Texas (8) <----How can I display this 5 and 8? (5 is the number of landmarks in New York)


Posted: 7/5/2010

Lurker 270  points  Lurker
  • Joined on: 1/3/2009
  • Posts: 14
  Answered

dumont said:

Not exactly but what I'm after is like this, example, http://www.mydomain.com/Default.aspx?query1=1. Now when I click a link, the URL will become http://www.mydomain.com/Default.aspx?query1=1&query2=2". and this goes on until the datalist contains maybe 5 or less records. 

 

Another question, what if I want my link to display how many records will be it produce if I click on that link? How can I display that?

Example: For the 1st page, I clicked US, the second page will display a datalist of landmarks in the US. Then there's a list of states like New York (5), Texas (8) <----How can I display this 5 and 8? (5 is the number of landmarks in New York)

To do this you need to count the total number of records when you are creating link dynamically as your example when datalist will be display at the same time you also calculate total number of landmarks

for example when you get the list of state e.g NY, CA in the same sql query or SP you need to calculate number of landmarks in that state. for more info can you please post your code which you have done.


Page 1 of 1 (4 items)