ItemCommand Event fires twice

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default ItemCommand Event fires twice

    Hi!

    I have a DataList with some linkbuttons, and when i click them the
    eventhandler fires twice.

    Is there a way around this?, it's the same problem with the repeater and
    datagrid control also.
    public void dblFolders_CommandHandler(object sender,
    System.Web.UI.WebControls.DataListCommandEventArgs e)
    {
    if (e.CommandName=="MoveToFolder")
    {
    FillControls(e.CommandArgument.ToString()); // THIS WILL BE RUN TWICE
    }
    }

    private void InitializeComponent()
    {
    this.dblFolders.ItemCommand += new
    System.Web.UI.WebControls.DataListCommandEventHand ler(this.dblFolders_Comman
    dHandler);
    this.Load += new System.EventHandler(this.Page_Load);
    }

    /Jonas


    Jonas Nilsson Guest

  2. Similar Questions and Discussions

    1. Event Fires after CreateChildControls
      I have created a C# control that creates its objects within CreateChildControls. One of those objects is a button which I have attached to a...
    2. Dropdownlist onselectedIndexChanged event not fires
      Hi All, I have 22 years of over all experience in programming but just recently started to learn WEB applications, and started to write my...
    3. Need help with ItemCommand event
      I have on the same page this code: <script language="VB" runat="server"> ... ... Private Sub subDatagrid_ItemCommand(ByVal source As Object,...
    4. asp:textbox_TextChanged event no longer fires???
      Hi, I have a textbox control with some typical textchanged event code. It has worked fine, but all of a suddent the event no longer fires when you...
    5. Page Load Event Fires Twice
      This is a classic asp newsgroup. While you may be lucky enough to find a dotnet-savvy person here who can answer your question, you can eliminate...
  3. #2

    Default Re: ItemCommand Event fires twice

    Have you wired up the event manually as well as defined it in your aspx
    element text?

    "Jonas Nilsson" <jonas_nilsson@hotmail.com> wrote in message
    news:OExgeRAWDHA.2228@TK2MSFTNGP12.phx.gbl...
    > Hi!
    >
    > I have a DataList with some linkbuttons, and when i click them the
    > eventhandler fires twice.
    >
    > Is there a way around this?, it's the same problem with the repeater and
    > datagrid control also.
    > public void dblFolders_CommandHandler(object sender,
    > System.Web.UI.WebControls.DataListCommandEventArgs e)
    > {
    > if (e.CommandName=="MoveToFolder")
    > {
    > FillControls(e.CommandArgument.ToString()); // THIS WILL BE RUN TWICE
    > }
    > }
    >
    > private void InitializeComponent()
    > {
    > this.dblFolders.ItemCommand += new
    >
    System.Web.UI.WebControls.DataListCommandEventHand ler(this.dblFolders_Comman
    > dHandler);
    > this.Load += new System.EventHandler(this.Page_Load);
    > }
    >
    > /Jonas
    >
    >

    PJ Guest

  4. #3

    Default Re: ItemCommand Event fires twice

    Yes.

    "PJ" <pjwalNOSPAM@hotmail.com> wrote in message
    news:%23bSImhAWDHA.1620@TK2MSFTNGP12.phx.gbl...
    > Have you wired up the event manually as well as defined it in your aspx
    > element text?
    >
    > "Jonas Nilsson" <jonas_nilsson@hotmail.com> wrote in message
    > news:OExgeRAWDHA.2228@TK2MSFTNGP12.phx.gbl...
    > > Hi!
    > >
    > > I have a DataList with some linkbuttons, and when i click them the
    > > eventhandler fires twice.
    > >
    > > Is there a way around this?, it's the same problem with the repeater and
    > > datagrid control also.
    > > public void dblFolders_CommandHandler(object sender,
    > > System.Web.UI.WebControls.DataListCommandEventArgs e)
    > > {
    > > if (e.CommandName=="MoveToFolder")
    > > {
    > > FillControls(e.CommandArgument.ToString()); // THIS WILL BE RUN TWICE
    > > }
    > > }
    > >
    > > private void InitializeComponent()
    > > {
    > > this.dblFolders.ItemCommand += new
    > >
    >
    System.Web.UI.WebControls.DataListCommandEventHand ler(this.dblFolders_Comman
    > > dHandler);
    > > this.Load += new System.EventHandler(this.Page_Load);
    > > }
    > >
    > > /Jonas
    > >
    > >
    >
    >

    Jonas Nilsson Guest

  5. #4

    Default Re: ItemCommand Event fires twice

    Thanks, now i works!

    /Jonas

    "Jonas Nilsson" <jonas_nilsson@hotmail.com> wrote in message
    news:evPRYoAWDHA.2268@TK2MSFTNGP11.phx.gbl...
    > Yes.
    >
    > "PJ" <pjwalNOSPAM@hotmail.com> wrote in message
    > news:%23bSImhAWDHA.1620@TK2MSFTNGP12.phx.gbl...
    > > Have you wired up the event manually as well as defined it in your aspx
    > > element text?
    > >
    > > "Jonas Nilsson" <jonas_nilsson@hotmail.com> wrote in message
    > > news:OExgeRAWDHA.2228@TK2MSFTNGP12.phx.gbl...
    > > > Hi!
    > > >
    > > > I have a DataList with some linkbuttons, and when i click them the
    > > > eventhandler fires twice.
    > > >
    > > > Is there a way around this?, it's the same problem with the repeater
    and
    > > > datagrid control also.
    > > > public void dblFolders_CommandHandler(object sender,
    > > > System.Web.UI.WebControls.DataListCommandEventArgs e)
    > > > {
    > > > if (e.CommandName=="MoveToFolder")
    > > > {
    > > > FillControls(e.CommandArgument.ToString()); // THIS WILL BE RUN TWICE
    > > > }
    > > > }
    > > >
    > > > private void InitializeComponent()
    > > > {
    > > > this.dblFolders.ItemCommand += new
    > > >
    > >
    >
    System.Web.UI.WebControls.DataListCommandEventHand ler(this.dblFolders_Comman
    > > > dHandler);
    > > > this.Load += new System.EventHandler(this.Page_Load);
    > > > }
    > > >
    > > > /Jonas
    > > >
    > > >
    > >
    > >
    >
    >

    Jonas Nilsson Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139