Click here to Skip to main content
15,849,163 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
my code:

<asp:SqlDataSource ID="dsCollections" runat="server" ConnectionString="<%$ ConnectionStrings:csConnectionString %>"
         SelectCommand="SELECT [CategName], [Id] FROM [Category]"></asp:SqlDataSource>
  <asp:Repeater ID="Repeater1" runat="server">
        <asp:LinkButton ID="LinkButton1" runat="server" OnCommand="LinkButton1_Command" CommandName="MyUpdate" CommandArgument='<%# Eval("CategName") %>'>LinkButton</asp:LinkButton>
</asp:Repeater> code:

protected void LinkButton1_Command(object sender, CommandEventArgs e)
       if (e.CommandName == "MyUpdate")
Updated 31-Dec-14 20:59pm
kedar001 1-Jan-15 2:19am    
add CausesValidation="false" in link button and then try.
Sergey Alexandrovich Kryukov 1-Jan-15 2:20am    
"Not working" is not informative. If you want anyone to even look at your code, you have to explain everything property: what do you want to achieve and how, what did you expect and what did you get instead, why do you feel it's wrong, and so on...
Member 11319592 1-Jan-15 23:46pm    
I try, but not working..,
Sergey Alexandrovich Kryukov 1-Jan-15 23:49pm    
Note that you repeated "not working" in response to my comment that "not working" in not informative. If you want to ridicule common sense, this site is not the best one for such things.
Member 11319592 2-Jan-15 0:02am    
Break point was not come to the item command code.,

i think you should bind the data from code behind...
because its working..
DataTable dt = new DataTable();
           for (int i = 0; i < 10; i++)
               dt.Rows.Add("CategName" + i);
           Repeater1.DataSource = dt;
Share this answer
If that is a Repeater Control, then you can try defining the Repeater.ItemCommand Event[^].
Share this answer
You forgot the OnItemCommand event in Repeater
Remove OnCommand="LinkButton1_Command"

<asp:repeater onitemcommand="RepeaterCommandEventHandler" xmlns:asp="#unknown" />

in your example

<asp:repeater id="Repeater1" runat="server" onitemcommand="Repeater1_ItemCommand">
        <asp:linkbutton id="LinkButton1" runat="server" commandname="MyUpdate" commandargument="<%# Eval("CategName") %>">LinkButton</asp:linkbutton>

in .cs

protected void Repeater1_ItemCommand(object sender, RepeaterCommandEventArgs e)
      if (e.CommandName == "MyUpdate")
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