Saturday, April 16, 2011 | |

Dropdown onclick ,change items of another dropdown


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class drop : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection();
    protected void Page_Load(object sender, EventArgs e)
    {
  
    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedValue== "Tamilnadu")
        {
            this.DropDownList2.Items.Clear();
            this.DropDownList2.Items.Add("chennai");
            this.DropDownList2.Items.Add("trichy");
          
        }
        else if (DropDownList1.SelectedValue == "Kerala")
        {
            this.DropDownList2.Items.Clear();
            this.DropDownList2.Items.Add("aaa");
            this.DropDownList2.Items.Add("ccc");

        }
        else
        {
            this.DropDownList2.Items.Clear();
            this.DropDownList2.Items.Add("bbb");
            this.DropDownList2.Items.Add("ddd");
        }
        GridView1.Visible = true;
    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
 

    }
}

0 comments:

Post a Comment