I'm currently working on a project using bootstrap theme. I have an updatepanel that uploads an image. The updatepanel has PostBackTrigger. The problem occurs when an image is uploaded. So, the other checkboxes (outside of the update panel) will reset ( loose their values). I can simply use runat="server" attribute for each checkboxes and that works fine, but since i'm using bootstrap switchery, it will not work with attribute runat="server".
My code looks like this:
uploading image section:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<Triggers>
<asp:PostBackTrigger ControlID="btnBgUpload" />
</Triggers>
<ContentTemplate>
<asp:FileUpload ID="fileBgUpload" runat="server" />
<asp:Image ID="imgBackground" runat="server" />
<asp:Button ID="btnBgUpload" runat="server" Text="Upload" OnClick="btnBgUpload_Click" />
</ContentTemplate>
</asp:UpdatePanel>
checkbox outside of update panel:
<div class="switch">
<div class="onoffswitch">
<input type="checkbox" class="onoffswitch-checkbox" id="chkSlileActive" />
<label class="onoffswitch-label" for="chkSlileActive">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
I have tried to use jquery function to re-assign values for checkboxes. but It always returns False
<script type="text/javascript">
function Confirm(InputValue) {
if(InputValue==true)
$("#chkSlileActive").attr("checked", "checked");
}
</script>
code behind on page load event:
if (!Page.IsPostBack)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "Confirm(" + Session["checkboxSlideActive"] + ");", true);
}
Any suggestions?
Aucun commentaire:
Enregistrer un commentaire