Simply put, I have a series of videos with check boxes in a gridview. After hitting submit, there is a postback, and they go to another gridview on the same page. My question is simply this, how do I make the initial check boxes where the user first picks the videos be unchecked? Every time a user hits the submit button after selecting a few videos the boxes stay checked and if you pick some more and hit enter without realizing the other ones were still checked you now have duplicate entries.
I am sorry for what I estimate is a simple answer, but all the research I have done deals with much more elaborate problems.
Thanks in advance!
EDIT: I am sorry, I should have mentioned this is in C# ASP.NET. This is the check box in question:
<asp:CheckBox ID="cbAdd" runat="server" />
This code would at the end of the method which handles the submit button
foreach (GridViewRow row in gv.Rows)
{
var cb = row.FindControl("cbAdd") as CheckBox;
if (cb != null)
cb.Checked = false;
}
您可以尝试为他们禁用视图状态(快速且肮脏)
well you can always handle the check-boxes to be checked or unchecked after a specific event. for example you have this check-box
<input type="checkbox" name="check" checked="" />
so you can say if something happened, make this checked or unchecked.
<input type="checkbox" name="check" checked="<?php if(condition) echo 'checked'; ?>" />
or make it unchecked in the same way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.