I have one dropdownlist which contain value of school and office i have also table in school and office i have also grid. when i select school in dropdownlist the grid display must the school table and vivice-versa.
Thank You,
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manoj Kumar Mandal198 reputationPosted May 10, 2015, 11:36 PM EDT
Sample Code
protected void DropDownList1_SelectedIndexChanging(object sender, EventArgs e)
{
int TypeId= Convert.ToInt32(DropDownList1.SelectedValue);
//Call your procedure with TypeId as argument
}
Inside Procedure use condition
IF (TypeId = 1 )
BEGIN
//Query to fetch data of School
END
ELSE IF (TypeId = 2)
BEGIN
//Query to fetch data of College
END
ELSE
BEGIN
//Query to fetch data of Office
END
Khargesh RajputRank #616 · 3.9K reputationPosted May 11, 2015, 12:12 AM EDT
and on selectedindexchenged
check if(DropDownList1.selectedItem.Text=="School")
{
//bind grd from School table
}
else
{
// bind from Office
}
ashok kumar30 reputationPosted May 15, 2015, 4:44 AM EDT
thanks,