chechbox OnCheckChanged doesn't work!


V

Vittorix

Hi all,

Here's a matter I can't fix:
the method OnCheckedChanged is correctly fired when the checkbox is
selectioned, but not when the checkbox is deselectioned! (the page just
reloads)
Please help, thanks in advance.

I've an Ajax Accordion and a Repeater inside, both connected with a
database.
here is the fundamental structure:
======================aspx page========================================
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Shipping.aspx.cs"
Inherits="test" MaintainScrollPositionOnPostback="true" %>


<ajaxToolkit:ToolkitScriptManager EnablePartialRendering="true"
runat="Server" ID="ToolkitScriptManager1" />

<ajaxToolkit:Accordion ID="MyAccordion" runat="server"
SelectedIndex="0" HeaderCssClass="accordionHeader"
HeaderSelectedCssClass="accordionHeaderSelected"
ContentCssClass="accordionContent"
FadeTransitions="false" FramesPerSecond="1"
TransitionDuration="1" AutoSize="None"
RequireOpenedPane="true" SuppressHeaderPostbacks="false"
Width="900px" >

<ContentTemplate>

<asp:Repeater ID="Repeater1" runat="server"
DataSourceID="SqlDataSource1">
<ItemTemplate>

<asp:CheckBox ID="ManifestCheckBox"
runat="server" AutoPostBack="true"
Checked="True" OnCheckedChanged =
"ManifestCheckBox_CheckedChanged" />

</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</ajaxToolkit:Accordion>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:XXXXXXXXXXXXXXX %>"
SelectCommand="SELECT * FROM [tblPICManifest] WHERE ([PICBatchID] =
@PICBatchID)">
<SelectParameters>
<asp:ControlParameter ControlID="selectedLbl" DefaultValue=""
Name="PICBatchID"
PropertyName="Text" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>

======================aspx.cs code========================================

protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
else
{
............
}

protected void ManifestCheckBox_CheckedChanged(object sender, EventArgs e)
{
Control ctrSender = (Control)sender;
string controlID = ctrSender.ClientID;

............
}
 
Ad

Advertisements

V

Vittorix

the method OnCheckedChanged is correctly fired when the checkbox is
selectioned, but not when the checkbox is deselectioned! (the page just
reloads)

update: I found that the method OnCheckedChanged is triggered by a
wrong sender (a different checkbox sender ClientID) when I deselect.
How is that possible?! further, it is wrongly passed Checked=false!

heeeeeelp
 
Ad

Advertisements

V

Vittorix

correction:
the problem happens when I check the checkbox.
when I uncheck the checkbox the ManifestCheckBox_CheckedChanged is
called witth the right ClientID.
I use this ClientID to modify a record in a database.
for example, un/checking the checkbox number 17 i have the ClientID:
ctl34_Repeater1_ctl17_ManifestCheckBox
from this I extract "17" that i use to cheange the record number 17 of
a table

please help!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top