protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
String conStr = ConfigurationManager.ConnectionStrings["connectionStringCSD"].ConnectionString;
using (SqlConnection con = new SqlConnection(conStr))
{
using (SqlCommand cmd = new SqlCommand("Select Count(*) from db_accessadmin.SURVEY_MASTER_DATA_FILE_CORE", con))
{
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
con.Open();
int count = Convert.ToInt32(cmd.ExecuteScalar());
GridView1.VirtualItemCount = count;
con.Close();
}
using (SqlDataAdapter da1 = new SqlDataAdapter("Select top 10 A_Q102_STATE, A_Q103_DISTRICT, A_Q104_SUB_DISTRICT from db_accessadmin.SURVEY_MASTER_DATA_FILE_CORE", con))
{
DataTable dt = new DataTable();
da1.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
using (SqlDataAdapter da2 = new SqlDataAdapter("SELECT DISTINCT A_Q102_STATE FROM db_accessadmin.SURVEY_MASTER_DATA_FILE_CORE", con))
{
DataTable dt = new DataTable();
da2.Fill(dt);
ddlState.DataSource = dt;
ddlState.DataBind();
ddlState.Items.Insert(0, new ListItem("--Select State--", "0"));
}
}
}
}
}
No comments:
Post a Comment