Repeater.Itemcommand not firing

I

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???
 
P

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);
 
I

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...
 
A

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
 
I

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 ... ???
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top