retreiving the values from 1dropdownlist to another in 3tier architecture

Posted by Saritha.rajeshkumar under C# on 4/21/2011 | Points: 10 | Views : 2348 | Status : [Member] | Replies : 2
hi,
this is saritha can anyone tell me how to work with 3 dropdownlist in 3tierArchitecture.
i.e iam having 3 dropdownlist "ddlcountry", "ddlstate", "ddlcity". if i select "india" in ddlcountry i should get states of india in ddlstate and if i select the "AP" in ddlstate then i should get the cities of AP in ddlcity.




Responses

Posted by: Ndebata on: 4/21/2011 [Member] Starter | Points: 25

Up
0
Down
Hi

First you set the datasource of ddlCountry dropdown and set the binding,
Then onselectedindexchanged event of ddlCountry, take the selected country and retrive the list of states for that Country and assign to ddlState and databind the dropdownlist. Same way you can populate the city drop down on selection of State.

Thanks,
Debata

Saritha.rajeshkumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Srinivas673 on: 4/22/2011 [Member] Starter | Points: 25

Up
0
Down
ResponseDTO objResponseDTO = (ResponseDTO)new TP.Services().Execute(TVCConstants.GetCitationStages);
ddlstage.DataSource = objResponseDTO.ReturnObject;
ddlstage.DataTextField = "Country";
ddlstage.DataValueField = "Country";
ddlstage.DataBind();
//dropdown selectedchangedevent of country
Country= ddlcountry.SelectedValue;
ResponseDTO objResponseDTO = (ResponseDTO)new TP.Services().ExecuteResponse(Country,TVCConstants.GetCitationStatuses);
ddlstatus.DataSource = objResponseDTO.ReturnObject;
ddlstatus.DataTextField = "state";
ddlstatus.DataValueField = "state";
ddlstatus.DataBind();
ddlstatus.Items.Insert(0, new ListItem("--Select--", "0"));
//drop selected event of state
State= ddlstate.SelectedValue;
ResponseDTO objResponseDTO = (ResponseDTO)newTP.Services().ExecuteResponse(stage,TVCConstants.GetCitationtypes);
ddltype.DataSource = objResponseDTO.ReturnObject;
ddltype.DataTextField = "cities";
ddltype.DataValueField = "cities";
ddltype.DataBind();
ddltype.Items.Insert(0, new ListItem("--Select--", "0"));

if countries,states,cities in ur database this work

Saritha.rajeshkumar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response