Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fire javascript from asp.net code

Status
Not open for further replies.

dpdoug

Programmer
Joined
Nov 27, 2002
Messages
455
Location
US
I know you use the button1.Attributes.Add("onclick", "myfunc();") to add client side script from asp.net code.

But my button happens to be a delete button and it seems that if it returns a boolean value it won't fire any more functions after that.

I want to clear the screen and load a grid (which are both fired from javascript), after I delete a record.

It won't fire any other functions after returning a delete confirmation.

Thanks
 
It may be that the framework is alreayd attaching javascript to the onclick event to make the delete button work so your button tag may end up having 2 onclick eventsand only the one is firing which is why it seems the rest don't. You can add your Javascript to that created by the framework like this
Code:
button1.Attributes["onclick"] += "myfunc();";

Disclaimer: Although I know the above code works and have used it for similar situations the diagnosis of your problem is speculative so this may not be the solution. Hoepfully it is though ;-)

Rob

Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Eisenhower 1953
 
Thanks. I'll try that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top