Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 20th, 2007, 10:30 AM
Authorized User
Join Date: Mar 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pass QueryString to DDL then run refresh


I have passed a Query String parameter from Page 1 DDL (dropdownlist) to Page 2 DDL, which I have done using the code below and calling it from the 'OnDataBound' property of the Page 2 DDL.

The problem is that a datalist control is dependant on the Page 2 DDL, which doesn't get populated until the user changes it again.

How can I force a page refresh / post based on the parameter provided in the Page 2 DDL?

(I do not wish to have the datalist based on the querysting, because I want the user to have further option to change the Page 2 DDL)

Any help is appreciated.

using System;

public partial class _Searchlocal : System.Web.UI.Page
string CountyIDFilterQS;

public void CountyIDGet (Object sender, EventArgs e) {

CountyIDFilterQS = Page.Request.QueryString["CountyIDFilter"];
CountyIDSelection.SelectedIndex = CountyIDSelection.Items.IndexOf(CountyIDSelection. Items.FindByValue(CountyIDFilterQS));



Kind Regards,

Old March 20th, 2007, 10:34 AM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

If i understand you correctly just set the DDLs Autopostback property to true.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
================================================== =========
Why can't Programmers, program??
================================================== =========
Old March 20th, 2007, 10:49 AM
Authorized User
Join Date: Mar 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

Yeah I tried that but it didn't work.

Actually I've just found another cheat. On the 2nd DDL I will base the submit button to redirect back to the same page and change the QueryString. Then I can base the datalist on the querystrings after all.

If anyone has any other ideas I would appreciate a response.

Similar Threads
Thread Thread Starter Forum Replies Last Post
how can selectedvalue of DDL make other DDL visibl hertendreef ASP.NET 2.0 Professional 4 May 20th, 2008 04:38 PM
Unable to pass Query to report at run time jdaulagar VB Databases Basics 0 November 14th, 2006 08:07 PM
How do I pass URL to querystring? Shawn Mohan .NET Web Services 0 June 28th, 2006 12:33 AM
how to pass a value in querystring lian_a Classic ASP Basics 1 July 9th, 2004 03:21 AM
How to pass plus (+) character in querystring marjorin Classic ASP Professional 4 October 31st, 2003 04:40 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.