populating a dropdownlist of states based on selection of country in dropdownlist and populating a dropdownlist of cities based on selection state in state dropdownlist

My code is this but i m not getting states in dropdownlist of states based on selection of country and  cities based on selection of state

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<strong> Country &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp

State &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp

&nbsp &nbsp &nbsp &nbsp &nbsp city

</strong>

<asp:DropDownList ID="ddlcountry" runat="server" Style="z-index: 100; left: 13px;

position: absolute; top: 47px" Width="166px" AutoPostBack="true" OnSelectedIndexChanged="ddlcountry_selectedindexchanged">

</asp:DropDownList>

<asp:DropDownList ID="ddlstate" runat="server" Style="z-index: 101; left: 219px;

position: absolute; top: 48px" Width="165px" AutoPostBack="true" OnSelectedIndexChanged="ddlstate_selectedindexchanged">

</asp:DropDownList>

<asp:DropDownList ID="ddlcity" runat="server" Style="z-index: 102; left: 417px;

position: absolute; top: 49px" Width="162px" >

</asp:DropDownList>

<asp:Label ID="lblmsg" runat="server" Style="z-index: 104; left: 73px; position: absolute;

top: 120px" Text="Label"></asp:Label>

 

</div>

</form>

</body>

</html>

 

 

Imports System.Data

Imports System.Data.SqlClient

 

Partial Class _Default

Inherits System.Web.UI.Page

Protected Sub ddlcountry_selectedindexchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlcountry.SelectedIndexChangedDim CountryID As String = ddlstate.SelectedValue.ToString()

FillStates(CountryID)

 

End Sub

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

fillcountry()

End If

End Sub

Protected Sub ddlstate_selectedindexchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlstate.SelectedIndexChangedDim StateID As String = ddlstate.SelectedValue.ToString()

FillCities(StateID)

 

End Sub

Private Sub fillcountry()

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select CountryID, Country from Countrys", con)

Dim ds As New DataSetDim da As New SqlDataAdapter()

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alicountry")

con.Close()

If ds.Tables(0).Rows.Count > 0 Then

ddlcountry.DataSource = ds.Tables(0)

ddlcountry.DataTextField = "Country"

ddlcountry.DataValueField = "CountryID"

ddlcountry.DataBind()

ddlcountry.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No Countries found"

End If

End Sub

Private Sub FillStates(ByVal countryID As String)

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select StateID, State from States where CountryID =' & CountryID & '", con)

Dim ds As New DataSetDim da As New SqlDataAdapter

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alistate")

con.Close()

If ds.Tables(0).Rows.Count > 0 Then

ddlstate.DataSource = ds.Tables(0)

ddlstate.DataTextField = "State"

ddlstate.DataValueField = "StateID"

ddlstate.DataBind()

ddlstate.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No states found"

End If

End Sub

Private Sub FillCities(ByVal stateID As String)

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select City from Cities where StateID =' & StateID & '", con)

Dim ds As New DataSetDim da As New SqlDataAdapter

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alcities")

con.Close()

If (ds.Tables(0).Rows.Count > 0) Then

ddlcity.DataSource = ds.Tables(0)

ddlcity.DataTextField = "City"

ddlcity.DataValueField = "CItyID"

ddlcity.DataBind()

ddlcity.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No Cities found"

End If

 

End Sub

 

End Class

 

0
usha
4/10/2009 8:28:30 AM
asp.net.web-forms 93655 articles. 5 followers. Follow

6 Replies
1373 Views

Similar Articles

[PageSpeed] 52

The best option is to use AJAX Cascading drop down list.

http://www.asp.net/ajax/ajaxcontroltoolkit/samples/CascadingDropDown/CascadingDropDown.aspx

To bind data from data base to cascading drop down

http://www.asp.net/ajax/ajaxcontroltoolkit/samples/Walkthrough/CCDWithDB.aspx

And if you don't want to use ajax

http://www.infinitezest.com/articles/cascading-dropdown-without-using-the-ajax-control-toolkit.aspx


Regards,
Ram Reddy Mekha, +91-994-840-4315
http://abhiramreddymekha.blogspot.com

Please Mark as Answer if the post helps you.
0
Ram
4/10/2009 8:42:38 AM

Hi,

Your code seems to be good but I want to ask one question so that I can try to solve the probelm.

Is the State DropDown comes empty after selection or there is any thing in it?

If it is showing some kind of output please write that also.

Thanks


Muhammad Shoaib
Software Engineer,
Lahore, Pakistan
www.heartofpakistan.com (U/C)
--------------------------------
Mark it as ANSWER if it Helps U
0
mshoaib83
4/10/2009 8:46:26 AM

I would use SqlDataSource with a Control Parameter Set to the First Dropdown menu ID. On SelectedIndexChanged just rebind the depended dropdownlist.


Efthimis P Papanikolaou
0
epapas
4/10/2009 8:56:15 AM

Got it 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title> </head>

<body>

<form id="form1" runat="server">

<div>

<strong> Country &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp

State &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp

&nbsp &nbsp &nbsp &nbsp &nbsp city

</strong>

<asp:DropDownList ID="ddlcountry" runat="server" Style="z-index: 100; left: 13px;

position: absolute; top: 47px" Width="166px" AutoPostBack="true" OnSelectedIndexChanged="ddlcountry_selectedindexchanged">

</asp:DropDownList>

<asp:DropDownList ID="ddlstate" runat="server" Style="z-index: 101; left: 219px;

position: absolute; top: 48px" Width="165px" AutoPostBack="true" OnSelectedIndexChanged="ddlstate_selectedindexchanged">

</asp:DropDownList>

<asp:DropDownList ID="ddlcity" runat="server" Style="z-index: 102; left: 417px;

position: absolute; top: 49px" Width="162px" >

</asp:DropDownList>

<asp:Label ID="lblmsg" runat="server" Style="z-index: 104; left: 73px; position: absolute;

top: 120px" Text="Label"></asp:Label>

 

</div>

</form> </body>

</html>

Imports System.Data

Imports System.Data.SqlClient

 

Partial Class _Default

Inherits System.Web.UI.Page

Protected Sub ddlcountry_selectedindexchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlcountry.SelectedIndexChangedDim CountryID As String = ddlcountry.SelectedValue.ToString()

FillStates(CountryID)

 

End Sub

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

fillcountry()

End If

End Sub

Protected Sub ddlstate_selectedindexchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlstate.SelectedIndexChangedDim StateID As String = ddlstate.SelectedValue.ToString()

FillCities(StateID)

 

End Sub

Private Sub fillcountry()

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select CountryID, Country from Countrys", con)

Dim ds As New DataSetDim da As New SqlDataAdapter()

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alicountry")

con.Close()

If ds.Tables(0).Rows.Count > 0 Then

ddlcountry.DataSource = ds.Tables(0)

ddlcountry.DataTextField = "Country"

ddlcountry.DataValueField = "CountryID"

ddlcountry.DataBind()

ddlcountry.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No Countries found"

End If

End Sub

Private Sub FillStates(ByVal countryID As String)

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select StateID, State from States where CountryID ='" & countryID & "'", con)

Dim ds As New DataSetDim da As New SqlDataAdapter

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alistate")

con.Close()

If ds.Tables(0).Rows.Count > 0 Then

ddlstate.DataSource = ds.Tables(0)

ddlstate.DataTextField = "State"

ddlstate.DataValueField = "StateID"

ddlstate.DataBind()

ddlstate.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No states found"

End If

End Sub

Private Sub FillCities(ByVal stateID As String)

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select City from Cities where StateID ='" & stateID & "'", con)

Dim ds As New DataSetDim da As New SqlDataAdapter

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alcities")

con.Close()

If (ds.Tables(0).Rows.Count > 0) Then

ddlcity.DataSource = ds.Tables(0)

ddlcity.DataTextField = "City"

ddlcity.DataBind()

ddlcity.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No Cities found"

End If

 

End Sub

 

End Class

0
usha
4/10/2009 9:28:49 AM

Got it 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title> </head>

<body>

<form id="form1" runat="server">

<div>

<strong> Country &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp

State &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp

&nbsp &nbsp &nbsp &nbsp &nbsp city

</strong>

<asp:DropDownList ID="ddlcountry" runat="server" Style="z-index: 100; left: 13px;

position: absolute; top: 47px" Width="166px" AutoPostBack="true" OnSelectedIndexChanged="ddlcountry_selectedindexchanged">

</asp:DropDownList>

<asp:DropDownList ID="ddlstate" runat="server" Style="z-index: 101; left: 219px;

position: absolute; top: 48px" Width="165px" AutoPostBack="true" OnSelectedIndexChanged="ddlstate_selectedindexchanged">

</asp:DropDownList>

<asp:DropDownList ID="ddlcity" runat="server" Style="z-index: 102; left: 417px;

position: absolute; top: 49px" Width="162px" >

</asp:DropDownList>

<asp:Label ID="lblmsg" runat="server" Style="z-index: 104; left: 73px; position: absolute;

top: 120px" Text="Label"></asp:Label>

 

</div>

</form> </body>

</html>

Imports System.Data

Imports System.Data.SqlClient

 

Partial Class _Default

Inherits System.Web.UI.Page

Protected Sub ddlcountry_selectedindexchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlcountry.SelectedIndexChangedDim CountryID As String = ddlcountry.SelectedValue.ToString()

FillStates(CountryID)

 

End Sub

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

fillcountry()

End If

End Sub

Protected Sub ddlstate_selectedindexchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlstate.SelectedIndexChangedDim StateID As String = ddlstate.SelectedValue.ToString()

FillCities(StateID)

 

End Sub

Private Sub fillcountry()

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select CountryID, Country from Countrys", con)

Dim ds As New DataSetDim da As New SqlDataAdapter()

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alicountry")

con.Close()

If ds.Tables(0).Rows.Count > 0 Then

ddlcountry.DataSource = ds.Tables(0)

ddlcountry.DataTextField = "Country"

ddlcountry.DataValueField = "CountryID"

ddlcountry.DataBind()

ddlcountry.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No Countries found"

End If

End Sub

Private Sub FillStates(ByVal countryID As String)

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select StateID, State from States where CountryID ='" & countryID & "'", con)

Dim ds As New DataSetDim da As New SqlDataAdapter

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alistate")

con.Close()

If ds.Tables(0).Rows.Count > 0 Then

ddlstate.DataSource = ds.Tables(0)

ddlstate.DataTextField = "State"

ddlstate.DataValueField = "StateID"

ddlstate.DataBind()

ddlstate.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No states found"

End If

End Sub

Private Sub FillCities(ByVal stateID As String)

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select City from Cities where StateID ='" & stateID & "'", con)

Dim ds As New DataSetDim da As New SqlDataAdapter

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alcities")

con.Close()

If (ds.Tables(0).Rows.Count > 0) Then

ddlcity.DataSource = ds.Tables(0)

ddlcity.DataTextField = "City"

ddlcity.DataBind()

ddlcity.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No Cities found"

End If

 

End Sub

 

End Class

0
usha
4/10/2009 9:29:12 AM

Got it 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<strong> Country &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp

State &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp

&nbsp &nbsp &nbsp &nbsp &nbsp city

</strong>

<asp:DropDownList ID="ddlcountry" runat="server" Style="z-index: 100; left: 13px;

position: absolute; top: 47px" Width="166px" AutoPostBack="true" OnSelectedIndexChanged="ddlcountry_selectedindexchanged">

</asp:DropDownList>

<asp:DropDownList ID="ddlstate" runat="server" Style="z-index: 101; left: 219px;

position: absolute; top: 48px" Width="165px" AutoPostBack="true" OnSelectedIndexChanged="ddlstate_selectedindexchanged">

</asp:DropDownList>

<asp:DropDownList ID="ddlcity" runat="server" Style="z-index: 102; left: 417px;

position: absolute; top: 49px" Width="162px" >

</asp:DropDownList>

<asp:Label ID="lblmsg" runat="server" Style="z-index: 104; left: 73px; position: absolute;

top: 120px" Text="Label"></asp:Label>

 

</div>

</form>

</body>

</html>

Imports System.Data

Imports System.Data.SqlClient

 

Partial Class _Default

Inherits System.Web.UI.Page

Protected Sub ddlcountry_selectedindexchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlcountry.SelectedIndexChangedDim CountryID As String = ddlcountry.SelectedValue.ToString()

FillStates(CountryID)

 

End Sub

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

fillcountry()

End If

End Sub

Protected Sub ddlstate_selectedindexchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlstate.SelectedIndexChangedDim StateID As String = ddlstate.SelectedValue.ToString()

FillCities(StateID)

 

End Sub

Private Sub fillcountry()

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select CountryID, Country from Countrys", con)

Dim ds As New DataSetDim da As New SqlDataAdapter()

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alicountry")

con.Close()

If ds.Tables(0).Rows.Count > 0 Then

ddlcountry.DataSource = ds.Tables(0)

ddlcountry.DataTextField = "Country"

ddlcountry.DataValueField = "CountryID"

ddlcountry.DataBind()

ddlcountry.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No Countries found"

End If

End Sub

Private Sub FillStates(ByVal countryID As String)

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select StateID, State from States where CountryID ='" & countryID & "'", con)

Dim ds As New DataSetDim da As New SqlDataAdapter

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alistate")

con.Close()

If ds.Tables(0).Rows.Count > 0 Then

ddlstate.DataSource = ds.Tables(0)

ddlstate.DataTextField = "State"

ddlstate.DataValueField = "StateID"

ddlstate.DataBind()

ddlstate.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No states found"

End If

End Sub

Private Sub FillCities(ByVal stateID As String)

Dim strsqlcon As String = ConfigurationManager.ConnectionStrings("country_state_city").ConnectionString

Dim con As New SqlConnection(strsqlcon)

Dim cmd As New SqlCommand("Select City from Cities where StateID ='" & stateID & "'", con)

Dim ds As New DataSetDim da As New SqlDataAdapter

da.SelectCommand = cmd

con.Open()

da.Fill(ds,
"alcities")

con.Close()

If (ds.Tables(0).Rows.Count > 0) Then

ddlcity.DataSource = ds.Tables(0)

ddlcity.DataTextField = "City"

ddlcity.DataBind()

ddlcity.Items.Insert(0,
"--Select--")

Else

lblmsg.Text = "No Cities found"

End If

 

End Sub

 

End Class

0
usha
4/10/2009 9:31:06 AM
Reply:

Similar Artilces:

on selecting country from one dropdownlist ...states of selected country is not getting populated in second dropdownlist
 hi iam having a dropdownlist which loads the country names on page load....my problem is wen i select india the corresponding states are not coming in another dropdownlist my code isi have two tablescountryname:countryid identity,countrynamestatename:stateid identity,statename SqlConnection cn = new SqlConnection(ConfigurationSettings.AppSettings["con"].ToString());       protected void Page_Load(object sender, EventArgs e)    {                   &...

Populate DropdownList based on selection of other DropdownList in DetailsView
Hi, All     I have two dropdownlists in a detailsview control called (ddlLeagues and ddlTeams). I want to be able to filter the teams by ddlLeagues. I use 2 objectdatasources to populate the dropdownlist controls. The method i have gone for is to use the find control method to get the ddlLeagues selectedvalue so i can pass the objectdatasource a  required LeagueID, which returns me the teams for that LeagueID. If i databind the detailsview control the required teams are shown in the teams dropdownlist for the selected LeagueID. The ddlLeagues goes back to the o...

VB.NET
I have a DataGrid (see code at end of my question) with several dropdownlist controls within TemplateColumns for Editing.  For the first 2 ddls in my grid, ddlMedType and ddlMedicationName, I would like to populate ddlMedicationName based on the selecteditem of ddlMedType, but I don't know how to reference this. Thank you for saving me from confusion!!!! Here is my DataGrid code: NOTE: I've bolded the 2 controls that I need help with -- the rest you can really ignore!! ================== <asp:datagrid id="dgMeds" runat="server" OnEditCommand="dgMeds_EditRow" OnUpdateComm...

populating items in dropdownlist box based on a selection from another dropdownlist box
I need to populate the respective states from the states dropdownlist when a user chooses a country from the country dropdownlist. Similary when the state is selected from the states dropdownlist the corresponding cities should get displayed in the cities dropdownlistbox. Pls provide me with the coding? Here is the following code which i developed. Code:====Private Sub fillcountry()        ddlcountry.Items.Add("India")        ddlcountry.Items.Add("UK")        ddlcount...

How to get states based on selected country from dropdownlist using webservices
 How to get states based on selected country from dropdownlist using webservices,I am new to asp.net,if anybody knows plz kindly help me. Thanks in advance Krishnamurthy CConsultant,Holmdel Consulting,krishnamurthy@holmdelconsulting.comwww.holmdelconsulting.com Start at the Basics first and undertand WebService before moving on...http://www.c-sharpcorner.com/UploadFile/fbesterwitch/ReturningDataSetFromWebServices11252005004535AM/ReturningDataSetFromWebServices.aspx http://blogs.interfacett.com/dan-wahlins-blog/2007/3/10/video-creating-web-services-with-the-net-framework.html...

How to populate a dropdownlist based on another dropdownlist?
Hi, I have two dropdownlists (cboTournament, cboTeam). So, when the user selects a Tournament value from the first dropdownlist, the second dropdownlist will be populated with values based on the first dropdownlist's values. The first one is done but when I tried to programmatically populate the second one, it only shows a system.data.dataviewmanagerlistitem. I am just a starter and does not know much what that means. Anyway, if I substitute the second dropdownlist with a datagrid (for testing purpose). the grid is able to show the desired results. Please help. Thanks.Glory Glory Man United!...

Country -> State -> City (Three DropDownLists) using Cascaded DropDownList
Hey Friends!!!! How are you all? Well! I am building a project using ASP.Net and C#. In this project I have Three DropDownLists which stores values of Country,States and City Respectively. The Country DropDownList has only two values i.e. India and UK. What I want is when the user select country from countrydropdownlist the state dropdown list should be populated and when the user select state from statedropdownlist the citydropdownlist should be populated. (i.e. like country -> state -> city). I am very new to AJAX Technology and I dont know how to u...

populate second dropdownlist based on value of first dropdownlist
 I have two dropdownlists.one dropdownlist contains countries and second states.i get the the countries and states from back end sql server 2005.after getting countries and states i put them in cache in global.asax and bind it to two dropdownlistsnow what i have to do is. my two dropdown's contains ALL.when i select ALL in countries dropdown i need to get all statesbut when i select certain country i should get only states belong to that country.So i have to apply row filter.all the countries and states are in the same dataset.can some one tell me how to do that.i can show you my co...

Form: Focus on selected values in dropdownlists, Refresh after selection and hidding formfields based on selection.
Hello again,I have a form with several dropdown lists. Depending on the selected value in the dropdown lists other fields become available in that same form. It is working in classic ASP in combination of JavaScript. I want to migrate it to ASP.NET. I have posted a part of the form at the end of this post.My questions:1. I use <option <%If iFood="0" then%>selected<%End If%> value="0">No value selected</OPTION> to select the selected item when the form is reloaded after the selecting. I know that this also works in ASP.NET, but isn't there a typical ASP....

DropDownList to DropDownList
I want to take the selected value of DropDownListA and based on that value do a query to the database and populate DropDownListB. For example, DropDownListA contains Entity values. If the user selects entity101 then I call stored procedure where I pass in the entity value, run a select statement and get a list of properties associated with the entity name. I want to take that list and populate DropDownListB. Easy enough to do with ASP.NET using the AutoPostBack. Would be real nice to do this with Atlas. Is it possible? If so, how? Atlas control toolkit has cascading dropdowns-please downlo...

Populating Labels based on Dropdownlist selection
I have a dropdownlist that will pull software names from the database. Next to the dropdownlist, I want to populate a label or readonly textbox with the software titles manufacturer name and then next to that, I want to populate a label or a readonly textbox that will have the softwaretype for the particular software title. All of these tables, Software, Manufacturers, and SoftwareTypes are related in the database and their values are obtained using a SELECT query. I am using custom business objects and a multi-tiered design (DAL, BLL, Presentation) What is the best way to design my presenta...

populating formview based on selection from dropdownlist
I have a page that allows a user to add, edit or delete a manufacturer.  I have a dropdownlist databound to all manufacturers, and would like to make it so that the manufacturer selected in the list is the one shown in a formview set to edit mode as default.  Each change in the dropdownlist would cause a postback and when the page reloads the formview is still set to edit mode, but the display is updated with the currently selected manufacturers information.Is this possible?Thanks,Jason I just figured it out, through the use of the pageIndex property....

Bound City dropdownlist after selecting country dropdownlist in dynamic generated gridView
Hi, I am generating Gridview dynamically.......In that gridview I have 4 textboxes and two Dropdownlists named "Country" and "City".........I am filling Country Dropdownlist through database from "country" table with fields countryid and countryname....I also have "city" table with fields countryid,cityid,cityname.... Country column in gridview is filling properly with all other textbox vaalues.....but i want to fill "City" column of Grid after user select a country in the "Country" column using dropdownlist.........I am...

Bound City dropdownlist after selecting country dropdownlist in dynamic generated gridView
Hi, I am generating Gridview dynamically.......In that gridview I have 4 textboxes and two Dropdownlists named "Country" and "City".........I am filling Country Dropdownlist through database from "country" table with fields countryid and countryname....I also have "city" table with fields countryid,cityid,cityname.... Country column in gridview is filling properly with all other textbox vaalues.....but i want to fill "City" column of Grid after user select a country in the "Country" column using dropdownlist.........I am...

Web resources about - populating a dropdownlist of states based on selection of country in dropdownlist and populating a dropdownlist of cities based on selection state in state dropdownlist - asp.net.web-forms

Tag Synonyms - Stack Overflow
Q&A for professional and enthusiast programmers

Accidental entities - what about the UI?
This post is a follow-up to my previous blog post " Accidental entities - you don't need that identity ". In that post, we followed a consultant ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Air Astana - Join Now
Thank you for considering membership of Nomad Club – Kazakhstan’s first Frequent Flyer Program. You could soon be on your way to earning free ...

Languages -> C# Articles, Tutorials, Examples: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Blog - Avisra
Avisra Web Development Home Blog Services Contact The Blog Latest Module Builder: How can we make it better? Sitefinity by Chris on July 2, 2013 ...

Online Booking Tool Support
This Online Booking Tool Support page might help you as you navigate through the process of booking travel through your OBT provided by CWT. ...

@Html and beyond
... ); } return string .Format( “{0}{1}” , me.Member.Name, id); } The Html building methods are quite simple. Building a dropdownlist for a ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Unit Testing DateTime.Now Without Isolation
public virtual void SeedWithYearsSince(DropDownList list, int year){ for (int index = year; index

Resources last updated: 1/15/2016 6:05:46 AM