Dropdown To Display Respective States When Specific Country Is Selected Similarly For Cities

May 19, 2010

I need a dropdown to display respective states when specific country is selected similarly for cities. I kept 3 dropdowns for country, state and city with 3 different tables with primary, foreign key constraints and stored procedures. The Stored Procedure is as shown ALTER PROCEDURE [dbo].[Usp_countryselect]

WITH
EXECUTE AS CALLER
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SELECT [country_id], [country_name]
FROM country
Similarly for states and city.

The code for populate lists is as shown

public class PopulateLists
{
public int FillCountry(ref System.Web.UI.WebControls.DropDownList drpdown)
{
SqlDatabase db = new SqlDatabase();
DbCommand cmd=db.GetStoredProcCommand("USP_countryselect");
DataSet dsCountry= db.ExecuteDataSet(cmd);
drpdown.DataSource =dsCountry.Tables[0] ; drpdown.DataTextField=dsCountry.Tables[0].Columns["country_name"].ToString() ;
drpdown.DataValueField = dsCountry.Tables[0].Columns["country_id"].ToString() ;
drpdown.DataBind();
return 1;
}
public int FillState(ref System.Web.UI.WebControls.DropDownList drpdown)
{
SqlDatabase db = new SqlDatabase();
DbCommand cmd = db.GetStoredProcCommand("USP_statesselect");
DataSet dsStates = db.ExecuteDataSet(cmd);
drpdown.DataSource = dsStates.Tables[0];
drpdown.DataTextField = dsStates.Tables[0].Columns["state_name"].ToString();
drpdown.DataValueField = dsStates.Tables[0].Columns["state_id"].ToString();
drpdown.DataBind();
return 1;
}
.
.
.
}
protected void Page_Load(object sender, EventArgs e)
{
BindDropdowns();
}
protected void BindDropdowns()
{
PopulateLists objPopulateLists = new PopulateLists();
int bytReturn;
bytReturn = objPopulateLists.FillCountry(ref Drpcountry);
bytReturn = objPopulateLists.FillState(ref Drpstate);
bytReturn = objPopulateLists.FillCity(ref Drpcity);
}

But in the output screen it is displaying all the values in the dropdowns irrespective of country and state selection.

View 3 Replies


Similar Messages:

Retrieving Updated List Of Countries States And Cities In A Website?

Mar 4, 2010

I'm trying to create a User Registration page in ASP.NET and wondering what is the best way to get the list of up-to-date Countries and Cities? Are there any Web Services on the web that I can use to retrieve such information? If not, what are the options?

View 2 Replies

AJAX :: Get A List Of Cities With Zip Codes When Type In A Country Code?

Jan 30, 2010

The task is this: Create custom AJAX method with option to call server side ASPX page and predefined Web Service: a.) Get all cities from ASPX page by given Country Code. For ex. send country code "US" to get a result of a unknown number of cities such as "Washington", "New York", "Houston" etc. with their corresponded ZIP codes (1000, 1100, 1200 etc); b.) Call a web service, posting ZIP code which returns does the code represent palindrome string (A number that reads the same whether written forwards or backwards).

View 1 Replies

AJAX :: Like To Display All City Of Selected State In Check Box So That User Can Choose Multiple Cities?

Mar 15, 2010

Since I am new to Ajax control kit so thought to ask this question,I need to know what controls should i use for the following requirement.I've a state Drop down on selection of state drop down i would like to display all city of selected state in check box so that user can choose multiple cities and would like check box control to display only 5 city name per row for example if there are 10 cities in one state it should show 2 rows with 4 city and one row for 2 city.

View 1 Replies

Web Forms :: Display The Data Using Gridview Like Whenever Change The Country In Ddl It Should Display The Relevant Data According To The Country?

May 3, 2010

i am displaying various countries names in my dropdownlist and i want to display the data using gridview like whenever i change the country in my ddl it should display the relevant data according to the country??below is my code but i am unable to see any data whenever i change the country in my ddl gridview is not appearing??

[Code]....

View 16 Replies

C# - Display Icon With Respective File

Jan 12, 2010

I have a gridview control which is displaying the files and directory names in one column. Now i want to display the file icon of that particular file in the other column... eg test.txt will have a different icon form image1.jpg and here.xsl i have found two examples but don't kno if they will work or not. [URL] or [URL]
how to incorporate this with my gridview..?

View 2 Replies

Web Forms :: Dropdown Selected Item Not Display?

Mar 16, 2010

I use telerik radgrid, where i add dropdown column for add and edit new grid row.When i update grid row item the dropdown value is not disply in dropdown list, but disply in dropdown first data.

View 1 Replies

Forms Data Controls :: Display The Selected Value In Dropdown From DB

Oct 14, 2010

this is with ref & continuation of post [URL]

in which day drop is dynamicalluy populated at run time based on the month selected

the values selected are stored in the database.

suppose the user selects NOV 22 of the current year

when the user want to rertive the same stored data i need NOV in month dropdown & 22 in day dropdown

i get the month correctly but day dropdown is balnk

View 14 Replies

Web Forms :: Label Control Can't Display The Value Selected In Dropdown List

Jan 18, 2011

I try to display the selected value with dropdown list by using label control but cant display it in firefox but works fine in internet explorer.

Below are my code:

[Code]....

View 3 Replies

Data Controls :: Display Selected Item In Dropdown And Textbox In GridView

Apr 14, 2012

i am making a web page in which there is a dropdown list and a text box.i want to display the selected item in dropdown and textbox in a Gridview.

View 1 Replies

Web Forms :: How To Get Other Country And State Option In Dropdown

Feb 2, 2011

i am entering the value in a txtCountry and txtState if the other country and other state option is been selected. while i am entering the otherCountry and OtherState option at the dropdown lists Databound event.

so at the time of getting the data from database if the other option is selected then i am giving the variable value to the txtCountry and txtState likewise. but here i am not getting the exact output and getting error.

my code looks like below.

[Code]....

in above Code the ViewData function gets the data at edit time from the database

View 1 Replies

Web Forms :: Particular Country Get Marked If Selected From Dropdownlist

Jan 3, 2010

learning asp.net and prepare my final year project. i've problem in dropdownlist hope i found answer here. I've two dropdown list each consist four listitem as follows

dropdownlist1
uk,usa,india,singapore.

dropdownlist2
uk,usa,india,singapore.

if anyone of the country selected from dropdownlist1 then dropdownlist2 that particular country automatically get masked or readomly

View 4 Replies

Forms Data Controls :: Can Create Country State City Dropdown In C#

Nov 26, 2010

How we can create country state city dropdown in asp.net?

View 6 Replies

AJAX :: ValidatorCalloutExtender - Unable To Refresh City DDL Depending On New Selected Country

Apr 6, 2010

I'm building a WebControl for user registration. To expedite its use checks I used clientside validation through AjaxControlToolkit.ValidatorCalloutExtender. The validation is triggered when REGISTER button is pressed and popup information for missing or incorrect fields is showed. But I have a problem about a cascading dropdownlist(DDL) [Country]>>[City], because during the client-side validation I'm no more able to refresh my City DDL depending on the new selected Country. Server side, SelectedIndexChanged event is triggered but the DDL in the browser is not refreshed! (The DDL Country and City are Causevalidation=false) This occurs for each control on the page changed by server during client-side validation. How can I fix?

View 1 Replies

Web Forms :: Dropdownlist Contain The Country List From Country Table When Load Page

Aug 10, 2010

i have one dropdownlist in the gridview. i have to load that dropdownlist when that page is loaded. dropdownlist should contain the country list from country table

View 7 Replies

Web Forms :: Binding DroupDownList / Bind Country Names Along With Country Flag?

Apr 3, 2010

In My project I have DoupDownList(ddl). In my ddl in need to bind country names along With Country Flag..So Can Any One Help Me In thi issue...Country Name And Country Flag Bouth i need to Bind in my ddl

View 5 Replies

AJAX :: Display Cascading Dropdown List Based On Checkbox List Selected Value

Nov 10, 2010

How can i generate dropdown lists based on what has been selected in the checckbox list. Below is an example of what i need. if the user selects the options day, lotID and waferID, then 3 cascading dropdown lists should be displayed. And then a gridview displays data based on what has been chosen in the dropdown lists.

Day
LotID
SlotID
WaferID
VendorID
ToolID
LocationDetected
ProcessStep
Stage
Precipe
WaferStartMaterial
WaferStartVendor
WaferStartLot
WaferDiameterCOA
WaferMapTitle
BreakPoint
BreakpointSide
BreakpointMeasurement

View 3 Replies

Data Controls :: Display Data In GridView On DropDown Selected Index Change

Dec 18, 2013

I have a drop down which contain dealer name..i want to do when i select name in dropdown it show releated item list how we can perform.

View 1 Replies

Web Forms :: Populate The Dropdownlist1 With Country And Dropdownlist2 With City Of That Country From Web

Dec 3, 2010

I want populate the dropdownlist1 with Country and dropdownlist2 with City of that Country from web

Is there a place on web where we can get a list of countries and cities handy, and then populate into our dropdownlists in ASP.net page.

View 2 Replies

Social Networking :: Display One Country On Map Using Google Map API V3

Aug 18, 2015

Refer link [URL]..... but when I run page in chrom it show this message...

if I click allow it will show googlemap and if I click deny it doesn't show googlemap...

And in firefox it doesn't show googlemap anymore...

I want it shows google map with out any message in all browser...

View 1 Replies

Data Controls :: How To Display Country Images In GridView

Apr 24, 2013

I have a scenario for displaying news[continent,country wise] binding from continent [dropdownlist]..

If I choose continent ASIA.. NEWS RELATED TO COUNTRIES IN ASIA HAS TO BE DISPLAYED IN GRIDVIEW..

I have 5 fields..

CONTINENTCOUNTRYCOMPANYPOSTEDDATENEWS

Have to add Field Country image in gridview.. How to add countries images to database and bind display in gridview...

CONTINENTCOUNTRYFLAG||COMPANYPOSTEDDATENEWS

View 1 Replies

Web Forms :: Populate One DropDown According To Selected Value From Another DropDown Without Refreshing Page

Mar 11, 2014

I have seen article in code snippet but i have never used web services so that is complicated .

View 1 Replies

Using 2 Drop Down Lists To Display Dress Size By Country Version?

Nov 20, 2010

I have a Dress Version Table with Colums UK, EU, USA.

Also a Dress Size table which has a VersionId Column corresponding to the Version Table

On my aspx, i have two drop down lists. DD1 is binded to an objectdatasource which

has a select Method to the DAL and retrives the 3 Verions.

DD2 has Get DressSize by Version Method with a Select Parameter which is the DD1 selected Value.

I have wrapped the above in an update panel and the full code is below.

This works but I wonder if there is a better way of doing this?? I also have a probem in that the Dropdowns are in a panel that is within a modal pop up extender. When the dropdowns post back the whole panel disappears. Not sure why??

Dress Size:

</p>
<asp:UpdatePanel ID="UpdatePanel2"
runat="server">
<ContentTemplate>

[Code]....

View 1 Replies

Can Populate Second Dropdown With Results From Table Selected In First Dropdown

Dec 9, 2010

I have a dozen tables, and two dropdown lists.The first drop down list shows the table names. The second dropdown list needs to be poulated with the data from the specific table selected in the first dropdown list.I wrote a stored procedure that will query the selected table name choosen in the the first dropdown list. My results though are only showing this...

[Code]....

View 7 Replies

SQL Reporting :: Values In Multiselect Dropdown Not Getting Selected When Select All Option Is Selected

Sep 22, 2010

Values in multiselect dropdown not getting selected when Select All option is selected for a SSRS dropdown. There are multiple dropdowns on the page. We have one dropdown whose output is being used to populate the second dropdown using a stored procedure. When we check the Select All checkbox on the dropdown then ideally upon page refresh all the values should get selected in the dropdown, but in this case the page refreshes back to the blank dropdown, forcing the user to select the values again. The next dropdown too does not get populated. This makes it impossible to run the report for all the cases by using Select All. We ran the report on differnet database environments. My current location is Mumbai,India, the report worked fine when we ran it on a Bangalore,india database. This issue occurs when we try running it on a Chicago database server. I am using SSRS 2005, SQL2005.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved