I have a group of form elements located within a hidden div which looks like this:
<div id="jDivUpdateFolder" style="display:none;">
<asp:TextBox ID="txtEditFolderName" runat="server"></asp:TextBox><br />
<asp:TextBox ID="txtEditFolderDesc" runat="server" TextMode="MultiLine"></asp:TextBox><br />
<asp:FileUpload ID="fuEditPhoto" runat="server" /><br />
<asp:DropDownList ID="ddlEditContentOrder" runat="server">
<asp:ListItem Value="0" Text="Ascending"></asp:ListItem>
<asp:ListItem Value="1" Text="Descending"></asp:ListItem>
</asp:DropDownList><br />
<asp:CheckBox ID="chkEditIsActive" runat="server" Text="Active" /><br />
<asp:CheckBox ID="chkEditShowOnHome" runat="server" Text="Show on HomePage" /><br />
<asp:LinkButton CssClass="anchorbutton green" ID="btnSaveEditFolder" Text="Save" runat="server"></asp:LinkButton>
I control the visibility of this div using a jQuery function (not included here for simplicity)
Upon submitting the form by clicking btnSaveEditFolder, I am able to retrieve the values of the TextBoxes, FileUpload control, and DropDownList accurately. However, the checkboxes always return false. It's driving me crazy..
Protected Sub btnSaveEditFolder_Click(sender As Object, e As System.EventArgs) Handles btnSaveEditFolder.Click
Dim fID As Integer = Convert.ToInt32(txtFolderID.Value.Trim) ' value is correct
Dim fname As String = txtEditFolderName.Text.Trim ' value is correct
Dim fdesc As String = txtEditFolderDesc.Text.Trim ' value is correct
Dim order As String = IIf(ddlEditContentOrder.SelectedItem.Value = "0", "Asc", "Desc") ' value is correct
Dim isactive As Boolean = IIf(chkEditIsActive.Checked, True, False) ' ## ALWAYS FALSE
Dim isvisible As Boolean = IIf(chkEditShowOnHome.Checked, True, False) ' ## ALWAYS FALSE
End Sub
When I remove the style display:block;
and make the form visible on the page from the start, then the checkboxes return the correct values (true if checked, false if not..)
Has anyone encountered a similar issue?