Click here to Skip to main content
15,910,358 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
ASP.NET
<asp:Repeater ID="rptUserlist" runat="server" OnItemDataBound="rptUserlist_ItemDataBound">
                           <ItemTemplate>
                               <tr>
                                   <td class=" order-numb ready-dispatch-status">
                                       <div class="SrNo">
                                         <asp:LinkButton ID="lnkOrderDetail" OnClientClick="TEST()" runat="server" ClientIDMode="Static" Text='<%# Eval("ORDERNO_PORTAL") %>' OnClick="lnkOrderDetail_Click" CommandArgument='<%# Eval("ORDERNO_PORTAL") %>'></asp:LinkButton>
                                       </div>
                                       <asp:HiddenField ID="hdfOrderNo" Value='<%# Eval("ORDERNO_PORTAL") %>' runat="server" />
                                   </td>
                                   <td class="sku-link">
                                       <div class="CREATEDDATE"><%# Eval("ORDERDATE") %></div>
                                   </td>
                                   <td colspan="5">
                                       <asp:Repeater ID="rptOrderDetail"  runat="server">
                                           <ItemTemplate>


What I have tried:

C#
protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ScriptManager.RegisterStartupScript(Page, GetType(), "Selection", "<script>ShowSearchPOPUP();</script>", false);
                
            }
            ScriptManager.GetCurrent(this).RegisterPostBackControl(rptUserlist);
            
        }





protected void lnkOrderDetail_Click(object sender, EventArgs e)
{

}

protected void lnkExcelOD_Click(object sender, EventArgs e)
{

}






lnkOrderDetail_Click,lnkExcelOD_Click is not getting fired . Pls help.


Any control event inside repeater is not getting called.
Posted
Updated 26-May-16 18:51pm
v5
Comments
Karthik_Mahalingam 26-May-16 5:07am    
post your click event code
Patrice T 26-May-16 21:49pm    
Use Improve question to update your question.
So that everyone can pay attention to this information.

You never ever can "fire" and event like that, because you are using some class declaring the even instance which you cannot modify. This is the fundamental .NET fool-proof feature for events. Even when you derive your class from a class declaring an event member, you cannot invoke it, unless there is a backdoor in that class for doing it indirectly.

Even more importantly, you never really need it. A link button even is invoked when the user clicks on the link.

Another thing you fail to understand is this: lnkOrderDetail_Click is not an event. At best it can be used as an even handler, but only if you really added this method (this is just a method, that's it) to an invocation list of appropriate event instance, which could be the event Click, most likely. No, this is not about using different words. This is about understanding. And a method cannot be "fired". It only can be called, directly or indirectly. Or not.

And indeed, I don't see where this method is used in your ASP.NET code. Maybe it's there but not shown, maybe it is never used as an event handler. There can be different reasons to miss adding an event handler. One scenario is using the designer. Some developers add the event handler and later remove it from the ASP.NET code (or XAML, or auto-generated Forms code), and then the handler remains in the code behind, unused. Or something else like that; I just don't know what happened in your case. It's not a problem to find ends; just review all your code properly.

Sorry that I did not pin-point your bug and did not suggest a fix. You can do it yourself as soon as you fix your understanding of this matter just a bit and do some extra effort.

—SA
 
Share this answer
 
Comments
Abrar Kazi 27-May-16 0:54am    
A link button even is invoked when the user clicks on the link.

Another thing you fail to understand is this: lnkOrderDetail_Click is not an event. At best it can be used as an even handler, but only if you really added this method (this is just a method, that's it)



As u said a link button is invoked when a user click on it, heres the problem im stuck to when a user clicks on any lnkbutton inside repeater the event is not handled . Pls help
Ok my wrong.

e.PreventDefault restricted all the events from firing.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900