protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\userside.mdf;Integrated Security=True;User Instance=True"); string str; str = "select * from Screen_managment where screenname = 'Screen_1'"; SqlCommand cmd = new SqlCommand(str, con); con.Open(); SqlDataReader dr; dr = cmd.ExecuteReader(); //DataList1.DataSource = dr; //DataList1.DataBind(); drptheatre.DataSource = m.GetDataReaderQuery("select * from TheatreMaster"); drptheatre.DataValueField = "TheatreId"; drptheatre.DataTextField = "TheatreName"; drptheatre.DataBind(); drptheatre.Items.Insert(0, "Select Theatre"); drpcity.DataSource = m.GetDataReaderQuery("select * from City"); drpcity.DataValueField = "CityId"; drpcity.DataTextField = "CityName"; drpcity.DataBind(); drpcity.Items.Insert(0, "Select City"); } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { drptheater.DataSource = m.GetDataReaderQuery("select * from TheatreMaster"); drptheater.DataValueField = "TheatreId"; drptheater.DataTextField = "TheatreName"; drptheater.DataBind(); drptheater.Items.Insert(0, "Select Theatre"); drpcity.DataSource = m.GetDataReaderQuery("select * from City"); drpcity.DataValueField = "CityId"; drpcity.DataTextField = "CityName"; drpcity.DataBind(); drpcity.Items.Insert(0, "Select City"); } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { SqlDataReader dr = m.GetDataReaderQuery("select * from Seat_Master,Screen_managment where Seat_Master.Seattype = '" + DropDownList1.SelectedItem.Text + "' and Screen_managment.movieid=" + Session["movieid"] + " and Screen_managment.TheatreId=Seat_Master.TheatreId"); while (dr.Read()) { lblSeatType.Text = dr["Price"].ToString(); lblRate.Text = dr["Price"].ToString(); } if (IsPostBack == true) { int a = Convert.ToInt32(lblSeatType.Text); int b = Convert.ToInt32(DropDownList2.SelectedItem.Text); int c = a * b; lblRate.Text = Convert.ToString(c); } if (DropDownList1.SelectedItem.Text == "Club") { DataList5.Visible = false; DataList8.Visible = false; DataList7.Visible = true; } else if (DropDownList1.SelectedItem.Text == "Gold") { DataList7.Visible = false; DataList8.Visible = false; DataList5.Visible = true; } else { DataList7.Visible = false; DataList5.Visible = false; DataList8.Visible = true; } }