how to pass the "this" object from C# to a Java Script function.

In my asp.net markup, If I pass the "this" pointer to my java script function, I am able to access the controls in my GridView control. See below code (Existing Code). What I really need to do though is to not pass the "this" object through asp.net but through C#. So how is the "this" pointer accessed through C#? considering I will pass it to a Java script function from C#? I know how to pass variables from C# to java script, but I just don't know how to access the "this" object.

Existing code :
<asp:button ID = "btnConfirmAll" Text="Confirm" runat="server" OnClientClick="processFunc(this); return false;" />


function processFunc(objRef)
{
  var row = objRef.parentNode.parentNode;
  var GridView = row.parentNode;
  var inputList = GridView.getElementsByTagName("input");

  for( var i = 0; i < inputList.length; i++)
  {


  }




}
LVL 2
brgdotnetcontractorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
What I really need to do though is to not pass the "this" object through asp.net but through C#.
Not quite understand what you trying to mention here. can you elaborate further by giving some scenarios?
0
Julian HansenCommented:
You can't (in the strict sense) pass anything from C# to JavaScript - they run in two different time separated environments.

C# runs - generates HTML - then JavaScript runs.

The way you have it at the moment is you are generating JavaScript code that passes the JavaScript 'this' of the control to a JavaScript function - no C# there.

What is it you want to do differently and why - what are you trying to achieve?
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.