In my asp:net app, I have 2 checkboxes set up the same way. One works fine:
ASPX
<asp:CheckBox ID="uxOwnershipCheckBox" runat="server" OnCheckedChanged="uxOwnershipCheckBox_CheckedChanged" Checked="false" AutoPostBack="true"/>
C#
protected void uxOwnershipCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (uxOwnershipCheckBox.Checked)
{
DataTable ownershipDT = _dtMgr.GetTicketByStatus_Everyone(uxStatusDropdownList.SelectedValue);
uxTktGridView.DataSource = ownershipDT;
uxTktGridView.DataBind();
uxTicketCounter.Text = ownershipDT.Rows.Count.ToString();
}
else
{
DataTable ownershipDT = _dtMgr.GetTicketByStatus(uxStatusDropdownList.SelectedValue, Session["UserNameSession"].ToString());
uxTktGridView.DataSource = ownershipDT;
uxTktGridView.DataBind();
uxTicketCounter.Text = ownershipDT.Rows.Count.ToString();
}
}
The other one always shows uxCloseDateCheckbox.Checked
value as false; even when its been checked. Therefore, the stuff in the conditional statement never gets fired! What am I doing incorrectly here?
ASPX
<asp:CheckBox runat="server" style="padding-right:1px; float:right; margin-right:170px;" ID="uxCloseDateCheckbox" Text="Closure Date" TextAlign="Right" OnCheckedChanged="uxCloseDateCheckbox_CheckedChanged" Checked="false" AutoPostBack="true"/>
C#
protected void uxCloseDateCheckbox_CheckedChanged(object sender, EventArgs e)
{
if (uxOwnershipCheckBox.Checked)
{
DateTime dateTicketClosed = DateTime.ParseExact(uxDateTimeLocalTextbox.Text, "MM-dd-yyyy HH:mm:ss", CultureInfo.InvariantCulture);
}
}
Aucun commentaire:
Enregistrer un commentaire