This is a migrated thread and some comments may be shown as answers.

Grid edit command alters buttons client-side event

1 Answer 46 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 19 Dec 2012, 06:06 PM
I have a RadGrid with single row edit capability, and a button that acts as a "Submit" button.  I'm handling the grid's UpdateCommand event on the server, doing some processing, and trying to change the submit button's OnClientClick event.  Basically, depending on what happens when the server processes the update, I want the submit button to hit one of a few different js functions.  I'm having trouble reliably updating the button's event.  It seems as though it needs a full page postback to take effect.  What is the recommended approach for this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 24 Dec 2012, 09:14 AM
Hi Adam,

Thank you for contacting us.

You can use the following approach ( for RadButton and regular asp Button ):
protected void Page_Load(object sender, EventArgs e)
{
    RadButton1.OnClientClicked = "clientSideFunction";
    RadButton1.AutoPostBack = false;
 
    AspButton1.OnClientClick = "clientSideFunction(this,event);return false;";
}
JavaScript:
function clientSideFunction(sender, args) {
    // execute custom logic
}

I hope this will prove helpful. Please give it a try and let me know about the result.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Ajax
Asked by
Adam
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or