Azaad Abbas

Azaad Abbas

  • NA
  • 221
  • 41.6k

dropdownlist selected value from database values

Feb 20 2015 7:29 AM
if (connection.State == ConnectionState.Closed)
connection.Open();
command = new SqlCommand();
command.CommandText = "sp_Get_ControlValues";
command.CommandType = CommandType.StoredProcedure;
command.Connection = connection;
command.Parameters.AddWithValue("@uid", uid);
SqlDataAdapter daPack = new SqlDataAdapter(command);
DataSet dsPack = new DataSet();
daPack.Fill(dsPack);
//ddlPackPeriod.DataSource = dsPack;
//ddlPackName.DataSource = dsPack;
//ddlPackPeriod.DataTextField = "PackagePeriod";
//ddlPackName.DataTextField = "PackageName";
txtOldExpDate.Text = dsPack.Tables[0].Rows[0]["OldExpiryDate"].ToString();
txtNoOfExtConn.Text = dsPack.Tables[0].Rows[0]["NoOfExtraConn"].ToString();
txtAmntToPay.Text = dsPack.Tables[0].Rows[0]["Balance"].ToString();
ddlPackPeriod.DataBind();
ddlPackName.DataBind();
 
In 'pageload'  iam alredy binded those two dropdowns and those dropdowns are cascading
 
so when I click on 'Suearch' button I just want to show as selected  of  'UserId' col values
so How? 
 
 

Answers (3)