Repeater.Itemcommand not firing

Discussion in 'ASP .Net Web Controls' started by ilovreko@gmail.com, Dec 19, 2005.

  1. Guest

    I have a problem with ItemCommand event - it just wont fire. I've been
    looking for a solution but couldn't find any that works for me.

    Here's the code I'm using:

    -- .aspx

    ....
    <asp:Repeater id="rptPostaPrim" runat="server">
    </asp:Repeater>
    </form>
    -- </body>

    codebehind file

    Page_Load
    {
    if (!IsPostBack)
    {
    //DataBind Repeater
    }
    }

    InitilizeComponent
    this.rptPostaPrim += new
    System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rptPostaPrim_ItemCommand);


    protected void rptPostaPrim_ItemCommand(object source,
    System.Web.UI.WebControls.RepeaterCommandEventArgs e)
    {
    //Do something
    }

    So, rptPostaPrim_ItemCommand method does not execute... Page and
    Repeater have viewstate enabled. Any ideas anyone???
    , Dec 19, 2005
    #1
    1. Advertising

  2. The correct syntax for adding an event handler to the repeater ItemCommand
    event is:
    this.rptPostaPrim.ItemCommand += new
    System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rptPostaPrim_ItemCommand);

    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "" wrote:

    > I have a problem with ItemCommand event - it just wont fire. I've been
    > looking for a solution but couldn't find any that works for me.
    >
    > Here's the code I'm using:
    >
    > -- .aspx
    >
    > ....
    > <asp:Repeater id="rptPostaPrim" runat="server">
    > </asp:Repeater>
    > </form>
    > -- </body>
    >
    > codebehind file
    >
    > Page_Load
    > {
    > if (!IsPostBack)
    > {
    > //DataBind Repeater
    > }
    > }
    >
    > InitilizeComponent
    > this.rptPostaPrim += new
    > System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rptPostaPrim_ItemCommand);
    >
    >
    > protected void rptPostaPrim_ItemCommand(object source,
    > System.Web.UI.WebControls.RepeaterCommandEventArgs e)
    > {
    > //Do something
    > }
    >
    > So, rptPostaPrim_ItemCommand method does not execute... Page and
    > Repeater have viewstate enabled. Any ideas anyone???
    >
    >
    Phillip Williams, Dec 19, 2005
    #2
    1. Advertising

  3. Guest

    Sorry, but that was just my typing error while writing this post. If
    that syntax was in code it would trigger compiler error...

    I managed to trigger that event only when I put DataBinding out of 'if
    (!IsPostBack)'. But I don't want to bind twice...

    Phillip Williams wrote:
    > The correct syntax for adding an event handler to the repeater ItemCommand
    > event is:
    > this.rptPostaPrim.ItemCommand += new
    > System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rptPostaPrim_ItemCommand);
    >
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    , Dec 19, 2005
    #3
  4. addup Guest

    > I managed to trigger that event only when I put DataBinding out of 'if
    > (!IsPostBack)'. But I don't want to bind twice...


    is viewstate enabled? Sounds like it is not
    addup, Dec 19, 2005
    #4
  5. Guest

    yes it is.
    , Dec 19, 2005
    #5
  6. Guest

    weird. I managed to get it working by puting Item, Header and Footer
    templates definition in .aspx file. Until now I've loaded templates in
    code-behind file. So, anyone knows is this a bug or ... ???
    , Dec 20, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael

    Repeater ItemCommand not firing

    Michael, Nov 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,148
    Michael
    Nov 15, 2004
  2. =?Utf-8?B?RGVlcGVzaA==?=

    Datagrid ItemCommand Event Not Firing

    =?Utf-8?B?RGVlcGVzaA==?=, Oct 5, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,808
    =?Utf-8?B?RGVlcGVzaA==?=
    Oct 6, 2005
  3. =?Utf-8?B?Q3VydF9DIFtNVlBd?=

    repeater ItemCommand not firing on first click

    =?Utf-8?B?Q3VydF9DIFtNVlBd?=, Oct 12, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    4,770
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Oct 12, 2005
  4. EvelynAnd Ethan
    Replies:
    4
    Views:
    973
    =?Utf-8?B?Sko=?=
    Jan 9, 2006
  5. =?Utf-8?B?ZGFuYw==?=

    DataGrid ItemCommand event not firing if not first page

    =?Utf-8?B?ZGFuYw==?=, Oct 26, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    4,148
    =?Utf-8?B?ZGFuYw==?=
    Oct 26, 2005
Loading...

Share This Page