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 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsForums
Top experts
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Midhun TpRank #388 · 6.5K reputationPosted Dec 28, 2016, 12:02 AM EST