Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Iam able to create the ajax accordian control.In contentTemplate I had created the Button with the name of "Fill" and added the event onitemcommand ,

Iam facing the problem with the event.it was firing sometimes and it was not firing sometime, please Help me

I had created the Accordian Control with the dynamic button control

<asp:Accordion ID="Accordion1" runat="server" ContentCssClass="accordionContent"
    FadeTransitions="true" FramesPerSecond="250" HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected" OnItemCommand="Accordion1_ItemCommand"
    TransitionDuration="50" EnableTheming="True" RequireOpenedPane="False" SuppressHeaderPostbacks="True">
    <HeaderTemplate runat="server">
      </HeaderTemplate>
    <ContentTemplate  runat="server">
        <table width="100%">

            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="Button3" runat="server" CommandName="Scrap" Text="Scrap" />
                </td>
                <td>
                    <asp:Button ID="Button4" runat="server" CommandName="fill" Text="Fill" />
                </td>
            </tr>
        </table>
    </ContentTemplate>
</asp:Accordion>


I am firing the event

as
  protected void Accordion1_ItemCommand(object sender, CommandEventArgs e)
    {
  if (e.CommandName == "fill")
            {
//  some   code
}

}



This event may or maynot fire,
ex: for one time it fires
another time may or maynot fires
......

just like that

In page load code is

    if (!IsPostBack)
    {
        pageno = 0;
         PagedDataSource pg = new PagedDataSource();
pg.AllowPaging = true;
pg.PageSize = 10;
pg.CurrentPageIndex = pageno;
LinkButton1.Visible = true;
LinkButton2.Visible = true;
con = new MySqlConnection(ConfigurationManager.ConnectionStrings["tablename"].ConnectionString);
MySqlCommand cmd = new MySqlCommand("some  query", con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "invoicereview");
pg.DataSource = ds.Tables["tablename"].DefaultView;
LinkButton1.Enabled = !pg.IsFirstPage;
LinkButton2.Enabled = !pg.IsLastPage;
Accordion1.DataSource = pg;
Accordion1.DataBind();
    }


Here i am also using the paging

so please specify me where excately it was going wrong
Posted
Comments
Sandeep Mewara 4-Jul-12 4:22am    
Can you explain on when is it not firing when you expected it to? Scenario?
[no name] 4-Jul-12 4:24am    
i am thinking that alternative , it was not firing

Even i had tried with the onclick event, it was also reacting as same , i am thinking that the problem was with page load code
DamithSL 4-Jul-12 4:32am    
Are you using latest Ajax control tool kit? if you remove IsPostBack condition in page load, is this event firing correctly?
[no name] 4-Jul-12 4:36am    
3.5
Sandeep Mewara 5-Jul-12 2:27am    
You 'think'? It's your code, please debug and share what happens and when. Use F10/F11 to see exact workflow.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900