3
Answers

dropdownlist selected value from database values

Azaad Abbas

Azaad Abbas

9y
555
1
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)