Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

chechbox OnCheckChanged doesn't work!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vittorix - 19 Dec 2007 16:11 GMT
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;

       ............
}

Signature

ciao
Vittorix

Vittorix - 19 Dec 2007 18:29 GMT
> 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

--
ciao,
Vittorix
Vittorix - 19 Dec 2007 19:16 GMT
> > the method OnCheckedChanged is correctly fired when the checkbox is
> > selectioned, but not when the checkbox is deselectioned! (the page just
> > reloads)

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!!!

--
ciao,
Vittorix

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.