hi,
in data base district id s splt and store the values like 1,2 like that now what i am doing remove (, ) rebind to dropdown check boxex to related district help
aspx
District :
Height="20px" Width="163px">
PopupControlID="PnlDistrict" Position="Bottom">
try
{
// ddldistrict.Items.Clear();
SqlCommand cmddt=new SqlCommand("select * from WeatherStations where StationID=1",con);
// DataTable dt = new DataTable();
con.Open();
cmddt.CommandType = CommandType.Text;
SqlDataReader dr = cmddt.ExecuteReader();
while (dr.Read())
{
PopulateCheckboxlist(dr["districtID"].ToString(), chldistrict);
}
private void PopulateCheckboxlist(string value, CheckBoxList chl)
{
if (!string.IsNullOrEmpty(value))
{
string[] values_array = value.Split(',');
foreach (string s in values_array)
{
if (!string.IsNullOrEmpty(s))
{
if (s.Split(',').Length > 0)
{
chldistrict.Items.FindByValue(s.Trim());
}
}
}
}
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Midhun TpPosted Dec 28, 2016, 5:02 AM