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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.