Skip to main content

Implementation Of DropDownList

 1. Implementation Of DropDownList-  

(i)Design-


(ii)Code-

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;


public partial class Assign1 : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {


    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)

    {

        if (DropDownList1.Text == "UG")

        {

            DropDownList2.Items.Clear();

            DropDownList2.Items.Add("CSE");

            DropDownList2.Items.Add("IT");

            DropDownList2.Items.Add("CIVIL");

            DropDownList2.Items.Add("MECH");

            DropDownList2.Items.Add("ETC");

            DropDownList2.Items.Add("ETRX"); 

        }


        if (DropDownList1.Text == "PG")

        {

            DropDownList2.Items.Clear();

            DropDownList2.Items.Add("MCA");

            DropDownList2.Items.Add("MBA");

            DropDownList2.Items.Add("MTECH");

        }


        

    }

    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)

    {

        if (DropDownList2.Text == "CSE")

            Label1.Text = "70%";

        else if (DropDownList2.Text == "IT")

            Label1.Text = "60%";

        else if (DropDownList2.Text == "CIVIL")

            Label1.Text = "50%";

        else if (DropDownList2.Text == "MECH")

            Label1.Text = "55%";

        else if (DropDownList2.Text == "ETC")

            Label1.Text = "65%";

        else if (DropDownList2.Text == "ETRX")

            Label1.Text = "70%";

        else if (DropDownList2.Text == "MCA")

            Label1.Text = "60%";

        else if (DropDownList2.Text == "MBA")

            Label1.Text = "65%";

        else if (DropDownList2.Text == "MTECH")

            Label1.Text = "70%";

    }

}



    


Comments