Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- using System.Configuration;
- using System.Data.SqlClient;
- public partial class distt : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- /* SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["mycon"].ConnectionString);
- if (con.State == ConnectionState.Closed)
- {
- con.Open();
- }*/
- if (!IsPostBack)
- {
- Bind();
- }
- }
- protected void DisttList_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- protected void BlockList_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- protected void Bind()
- {
- SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["mycon"].ConnectionString);
- if (con.State == ConnectionState.Closed)
- {
- con.Open();
- }
- SqlCommand cmd = new SqlCommand("Select Distt_ID,Distt_Name FROM Distt_tb" +
- "INNER JOIN Block_tb ON Distt_tb.Distt_ID = Block_tb.Distt_ID ", con);
- SqlDataAdapter da = new SqlDataAdapter(cmd);
- DataSet ds = new DataSet();
- da.Fill(ds);
- DisttList.DataSource = ds;
- DisttList.DataTextField = "Distt_Name";
- DisttList.DataValueField = "Distt_Id";
- DisttList.DataBind();
- DisttList.Items.Insert(0, new ListItem("--Select--", "0"));
- blockbind();
- // panchbind();
- }
- protected void blockbind()
- {
- SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["mycon"].ConnectionString);
- if (con.State == ConnectionState.Closed)
- {
- con.Open();
- }
- SqlCommand cmd = new SqlCommand("Select Block_ID,Block_Name FROM Block_tb", con);
- SqlDataAdapter da = new SqlDataAdapter(cmd);
- DataSet ds = new DataSet();
- da.Fill(ds);
- BlockList.DataSource = ds;
- BlockList.DataTextField = "Block_Name";
- BlockList.DataValueField = "Block_ID";
- BlockList.DataBind();
- BlockList.Items.Insert(0, new ListItem("--Select--", "0"));
- con.Close();
- panchbind();
- }
- protected void panchbind()
- {
- SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["mycon"].ConnectionString);
- if (con.State == ConnectionState.Closed)
- {
- con.Open();
- }
- SqlCommand cmd = new SqlCommand("Select Panch_ID,Panch_Name FROM Panch_tb", con);
- SqlDataAdapter da = new SqlDataAdapter(cmd);
- DataSet ds = new DataSet();
- da.Fill(ds);
- PanchList.DataSource = ds;
- PanchList.DataTextField = "Panch_Name";
- PanchList.DataValueField = "Panch_Id";
- PanchList.DataBind();
- PanchList.Items.Insert(0, new ListItem("--Select--", "0"));
- con.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement