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
ToBe
NA
164
94.3k
listitem not showing all values
May 2 2013 8:00 AM
Hi
I have and Edit form contain a checkboxlist and when I'm trying to check the selected values from my databse it goes will in the loop but it will always show the first item in the Checkboxlist even if the saved values is morethan that .
this is my code :
string sqlstr4 = "SELECT REG.ID, CETYPE.Type FROM tblReges INNER JOIN tblGE ON tblReges.ID = CETYPE.ID where ID = tblReges.ID";
SqlCommand cmd4 = new SqlCommand(sqlstr4, con);
cmd4.CommandType = CommandType.Text;
cmd4.CommandTimeout = 15;
SqlDataAdapter ad = new SqlDataAdapter(cmd);
DataSet DS = new System.Data.DataSet(cmd.CommandText);
ad.Fill(DS);
if (DS.Tables[0].Rows.Count > 0)
{
foreach (ListItem litem in CheckBoxList.Items)
{
if (litem.Text == DS.Tables[0].Rows[0].ItemArray[1].ToString())
{
litem.Selected = true;
}
}
}
Reply
Answers (
4
)
How to validate the date already appered on gridview or not?
Saving individual images from folder and save to server