brgdotnet
asked on
How to save a java script "this" object in an asp.net hidden variable.
I have an asp.net button, and when it is pressed, it calls a Java Script function that will check all of the check boxes in GridView.
When the button is pressed it pass the "this" object/pointer to the function which checks all of the check boxes.
I am wondering, is their a way to save the "this" pointer/object in a hidden variable so that I can access it at a later time?
On this same web form I also have java script/DIV popup dialog box. I want to call. When the popup dialog box is opened,
I also need to pass the this pointer, but I need to somehow save that object for use later. Can it be stored in a hidden variable?
<asp:Button ID="btnCheckAll" Text = "Check All" runat="server" OnClientClick=CheckAllChec kBoxes(obj Ref); return false;" />
function CheckAllCheckBoxes(objRef)
{
var row = objRef.parentNode.parentNo de;
var GridView = row.parentNode;
var inputList = GridView.getElementsByTagN ame("input ");
for(var i = 0; i < inputList.length; i++)
{
}
}
When the button is pressed it pass the "this" object/pointer to the function which checks all of the check boxes.
I am wondering, is their a way to save the "this" pointer/object in a hidden variable so that I can access it at a later time?
On this same web form I also have java script/DIV popup dialog box. I want to call. When the popup dialog box is opened,
I also need to pass the this pointer, but I need to somehow save that object for use later. Can it be stored in a hidden variable?
<asp:Button ID="btnCheckAll" Text = "Check All" runat="server" OnClientClick=CheckAllChec
function CheckAllCheckBoxes(objRef)
{
var row = objRef.parentNode.parentNo
var GridView = row.parentNode;
var inputList = GridView.getElementsByTagN
for(var i = 0; i < inputList.length; i++)
{
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
no, it is a dom object
but you can store id to a hidden var
<asp:hiddenvalue id=myObj />
but you can store id to a hidden var
<asp:hiddenvalue id=myObj />
var button;
function CheckAllCheckBoxes(objRef){
button = objRef; // on client use
document.getElementById("<%=myObj.ClientID%>") = objRef.id; // on server use, store the id
...
}
ASKER