0

I have this LinkButton here

<asp:LinkButton runat="server" ID="EditBtn" CssClass="LinkButton" Text="Edit" Width="45px" OnClientClick="Profiles_Edit" CommandName="edit" />

and I am trying to call this function in my code behind

protected void Profiles_Edit(Object sender, ListViewCommandEventArgs e)
    {
        //do something
    }

but when I click on the button....nothing happens. My LinkButton is inside an ItemTemplate, which is inside a ListView, which is inside a ContentTemplate, which is inside a UpdatePanel....

What is wrong with the way I am calling it?

Thanks, J

user1269625
  • 3,121
  • 26
  • 79
  • 111

1 Answers1

2

OnClientClick is for specifying the name of the JavaScript function on the client browser.

To call the server-side event, use OnClick.

Also, you may not need the CommandName attribute in this situation. It isn't clear where this LinkButton resides. If it's in a container like a ListView, you would handle it differently.

DOK
  • 32,337
  • 7
  • 60
  • 92