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
Cally K
1.2k
507
15.6k
Unable to uncheck a checkbox at first click
Jan 23 2019 6:34 PM
Hi,
I am not able to uncheck a checkbox at first click, on the second click it works fine. I am pretty new to .Net and this is my first time facing it, checking the checkboxes works fine with no issue. I am not able to debug as unchecking the checkbox does not even trigger a page refresh or the event attached to it. This is my code. Please help.
protected
void
CheckBox1_CheckedChanged(
object
sender, EventArgs e)
{
//List<string> user_select_weeks_list = new List<string>();
AllLists create1 =
new
AllLists();
for
(
int
i = 0; i < rptItemsInCart.Items.Count; i++)
{
CheckBox ref_to_checkBox = (CheckBox)rptItemsInCart.Items[i].FindControl(
"Checkbox1"
);
if
(ref_to_checkBox.Checked)
{
Ok_prompt_to_upload_Button.Visible =
true
;
ref_to_checkBox.ID =
"Week"
+ (i + 1);
Label2.Text = ref_to_checkBox.ID;
create1.user_select_weeks_list.Add(ref_to_checkBox.ID);
//user_select_weeks_list.Add(ref_to_checkBox.ID);
}
else
{
create1.user_select_weeks_list.Remove(ref_to_checkBox.ID);
}
}
selected_weeks_repeater.DataSource = create1.user_select_weeks_list;
selected_weeks_repeater.DataBind();
}
public
class
AllLists
{
public
List<
string
> user_select_weeks_list {
get
;
set
; }
public
AllLists()
{
user_select_weeks_list =
new
List<
string
>();
}
}
I don't have anything in my page load, am I missing something.
Reply
Answers (
2
)
group table by foreign key table in mvc5 using linq
How to get values from repeater control rows?