Click here to Skip to main content
14,166,833 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a form with a GridView on it. In the GridView's RowDataBound event I add the onClick event as follow:

e.Row.Attributes.Add("onclick", "divexpandcollapse('" + WorkItemID.Value + "','" + txnID.Value + "')");

I call the the Javascript method "divexpandcollapse" which takes some parameters.

How can I access the onClick event in my code behind file, for example, if the row click happens for a certain row, I need the javascript function to be executed and some method in my code behind file.

Any help would be greatly appreciated.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

SoumenBanerjee 7-Nov-12 1:29am
To execute some method from code behind with javascript method
Hope these can help...
Andrew797 7-Nov-12 2:52am
Thanks, the 3rd article seems to have done the trick.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

javascript :
function divexpandcollapse()
        var bntEvent = document.getElementById("<%= Button2.ClientID %>");;
Andrew797 7-Nov-12 2:12am
I tried this, but it does not seem to reach the click event of the button

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190518.1 | Last Updated 7 Nov 2012
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100