Problem with OnItemButton event and Loadtemplate

G

Guest

Hi all,
in a aspx page I have a repeater like this:
<asp:repeater id=repeaterResults runat="server"
OnItemCommand="RepeaterResult_Event">
<HeaderTemplate>
<table width="515" border="0" cellpadding="3" cellspacing="0">
</HeaderTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
<SeparatorTemplate>
<tr><td colspan="4"><hr></td></tr>
</SeparatorTemplate>
</asp:repeater>

in the code behind file I dinamically load the Itemtemplate with this code:

repeaterResults.DataSource = objPds;
string templateName = "templates/BSResultTextTemplate.ascx";
repeaterResults.ItemTemplate = Page.LoadTemplate(templateName);
repeaterResults.DataBind();

Always in the same code behind file, I've defined the Method specified in
the OnItemButton property of repeater:

public void RepeaterResult_Event(object sender, RepeaterCommandEventArgs e)
{
string s = " SSS ";
}

below you can see the content of BSResultTextTemplate.ascx :
<tr>
<td class="nerotesti" width="155"><asp:LinkButton id="CmdVisualizzaReperto"
runat="server" CommandName="ItemCommand" CommandArgument=<%#
DataBinder.Eval(Container,"DataItem.ID") %> ><%#
DataBinder.Eval(Container,"DataItem.ID") %></asp:LinkButton></td>
<td class="nerotesti" width="160"><%#
DataBinder.Eval(Container,"DataItem.Culture") %></td>
<td class="nerotesti" width="160"><%#
DataBinder.Eval(Container,"DataItem.Subject") %></td>
<td class="nerotesti" width="60"> </td>
</tr>

Now the problem.... the template is loaded successfully but when I click on
one of the linkbutton generated, the method RepeaterResult_Event is not
fired...
on the other side if I insert the code of template directly in the repeater
definitition and don't load an external template when I click on one of the
linkbutton generated all work fine and the method RepeaterResult_Event is
invoked.

Please have anyone a solution for this?

Thank you.
Antonio.
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top