Home All Groups Group Topic Archive Search About
Author
19 Dec 2005 2:12 PM
ilovreko
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???

Author
19 Dec 2005 3:56 PM
Phillip Williams
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);

Show quoteHide quote
"ilovr***@gmail.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???
>
>
Author
19 Dec 2005 4:46 PM
ilovreko
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:
Show quoteHide quote
> 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
>
Author
19 Dec 2005 5:29 PM
addup
> 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
Author
19 Dec 2005 7:01 PM
ilovreko
yes it is.
Author
20 Dec 2005 7:37 AM
ilovreko
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 ... ???