TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Thulasiram pakala
900
872
116.6k
Rebind dropdowncheckbox list multiple district values
Dec 28 2016 4:45 AM
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
<tr>
<td>
District :
</td>
<asp:TextBox ID="txtdistrict" Text="Select District" runat="server" CssClass="txtbox"
Height="20px" Width="163px"></asp:TextBox>
<asp:Panel ID="PnlDistrict" runat="server" ScrollBars="Auto" Height="20%" CssClass="PnlDesign">
<asp:CheckBoxList ID="chldistrict" runat="server">
</asp:CheckBoxList>
</asp:Panel>
<cc1:popupcontrolextender ID="PceSelectCustomer" runat="server" TargetControlID="txtdistrict"
PopupControlID="PnlDistrict" Position="Bottom">
</cc1:popupcontrolextender>
</td>
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());
}
}
}
}
Reply
Answers (
1
)
Asp chart Refresh method
Service Layer in ASP.NET MVC