Dear All,
(ASP.NET USING C# CODING)
I designed one form with the following tools in ASP.NET:
label 1(Select your branch) Dropdownlist 1(Select,MCA,OR&CA)
label 2(MCA) label 3(OR&CA)
Dropdownlist 2(Select,Sem1,sem2) Dropdownlist 3(Select,sem1,sem2,sem3)
here when i select my branch is MCA from DropDownlist1 then the label2 and dropdownlist2 must be visible and when i select my branch is OR&CA then the label 3 and dropdownlist3 must be invisible.
kindly send me codings for this yaar..
I will be very much thankfull to you..
Loading

Vishal GilbileRank #268 · 9.4K reputationPosted Mar 13, 2013, 6:27 PM EDT
All you need to do is setting the visibility of control on selection of a particular dropdownlist i.e on Selection of dropdownlist value you need to set certain control to visible as true or false. For this you have to make use of DropDownList SelectedIndexChanged Event.
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if(DropDownList1.SelectedItem.Text.Equals("mca",StringComparison.InvariantCultureIgnoreCase))
{
label2.Visibile=DropDownList2.Visible=true;
label3.Visible=DropDownList3.Visible=false;
}
else if(DropDownList1.SelectedItem.Text.Equals("OR&ca",StringComparison.InvariantCultureIgnoreCase))
{
label2.Visibile=DropDownList2.Visible=false;
label3.Visible=DropDownList3.Visible=true;
}
}
Hope that solves your problem.
With Regards,
Vishal Gilbile.
Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 13, 2013, 9:06 AM EDT
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace WebApplication17
{
public partial class WebForm5 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label2.Visible = false;
Label3.Visible = false;
DropDownList2.Visible = false;
DropDownList3.Visible = false;
if (!IsPostBack)
{
DropDownList1.Items.Add("Select");
DropDownList1.Items.Add("MCA");
DropDownList1.Items.Add("OR&CA");
DropDownList2.Items.Add("Select");
DropDownList2.Items.Add("Sem1");
DropDownList2.Items.Add("Sem2");
DropDownList3.Items.Add("Select");
DropDownList3.Items.Add("Sem1");
DropDownList3.Items.Add("Sem2");
DropDownList3.Items.Add("Sem3");
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedItem.Text == "MCA")
{
Label2.Visible = true;
DropDownList2.Visible = true;
Label3.Visible = false;
DropDownList3.Visible = false;
}
else if (DropDownList1.SelectedItem.Text == "OR&CA")
{
Label3.Visible = false;
DropDownList3.Visible = false;
Label2.Visible = false;
DropDownList2.Visible = false;
}
else
{
Label2.Visible = false;
Label3.Visible = false;
DropDownList2.Visible = false;
DropDownList3.Visible = false;
}
}
}
}
Jonna jo32 reputationPosted Mar 14, 2013, 11:59 PM EDT
Jonna jo32 reputationPosted Mar 15, 2013, 12:02 AM EDT