Hi,
Im having an issue with a checkbox control parameter.
It seems to be ok when the page first runs (checked - value A)
but once its unchecked it keeps that value..
When the page loads, the checkbox is selected
(I assign it to a page parameter, hdActiveGroups) and the value relating to it 'A' is sent to the datasource correctly
Once I uncheck it, it correctly sends Z to the datasource.
Then when I check it again (value A) it seems to send value Z to the datasource.. ie I get results as if Z was passed (unchecked)
(even though hdActiveGroups displays as A..)
Realistically I just need a way for the checkbox parameter to be A if checked, Z if unchecked and for it refresh the ddl when checkchanged
code:
<asp:textbox ID="hdActiveGroups" runat="server" />
<asp:CheckBox ID="chkActiveGroups" runat="server" Checked="true" OnCheckedChanged="Check_GroupStatus" AutoPostBack="true"/>
<asp:SqlDataSource ID="SqlDataSourceGroupDisc" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="aspGetDGroups" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="123" Name="iClientid" QueryStringField="iClientid" Type="Int32" />
<asp:Parameter DefaultValue="0" Name="iGroupDiscountid" Type="Int32" />
<asp:ControlParameter ControlID="hdActiveGroups" Name="cStatus" Type="String" />
</SelectParameters>
codebehind
</asp:SqlDataSource>
protected void Page_Load(object sender, EventArgs e)
{
if (chkActiveGroups.Checked)
{
hdActiveGroups.Text = "A";
}
else
{
hdActiveGroups.Text = "Z";
}
etc
}
protected void Check_GroupStatus(Object sender, EventArgs e)
{
if (chkActiveGroups.Checked)
{
hdActiveGroups.Text = "A";
}
else
{
hdActiveGroups.Text = "Z";
}
ddlGroupDiscount.DataBind();
}
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.