Calling Java function on page load [modified]
-
Hi Frends I wanna call a java function on page load event on my .aspx.cs page and want to pass some values from there....but its not working.....:confused: I am doing like this.... this.Attributes.Add("onload", "setObj('Dinesh','Sharma',550,30)"); not working actually i need to call this java function on page load so i can use it like but i cant pass the values from my .cs page is there any way to pass the value from .cs page :confused: Dinesh Sharma -- modified at 3:59 Saturday 19th August, 2006
Dinesh Sharma
-
Hi Frends I wanna call a java function on page load event on my .aspx.cs page and want to pass some values from there....but its not working.....:confused: I am doing like this.... this.Attributes.Add("onload", "setObj('Dinesh','Sharma',550,30)"); not working actually i need to call this java function on page load so i can use it like but i cant pass the values from my .cs page is there any way to pass the value from .cs page :confused: Dinesh Sharma -- modified at 3:59 Saturday 19th August, 2006
Dinesh Sharma
Don't write whole sentences in bold. It serves no purpose other than making it harder to read. What you are using is not Java at all, it's Javascript.
DineshSharma wrote:
this.Attributes.Add("onload", "setObj('Dinesh','Sharma',550,30)"); not working
Standard question #1: What do you mean by "not working"? The Page object (that "this" references to) is the page itself, not a control on the page, so you can't add attributes to it. So I assume that the error message is that the object doesn't have any "Attributes" property. Put an id on the body tag and make it a server tag, so that you can access it from code behind:
<body id="Body" runat="server">
Now you can declare the reference and put the call to the Javascript in the onload event:protected HtmlGenericControl Body; Body.Attributes.Add("onload", "setObj('Dinesh','Sharma',550,30)");
--- b { font-weight: normal; }
-
Don't write whole sentences in bold. It serves no purpose other than making it harder to read. What you are using is not Java at all, it's Javascript.
DineshSharma wrote:
this.Attributes.Add("onload", "setObj('Dinesh','Sharma',550,30)"); not working
Standard question #1: What do you mean by "not working"? The Page object (that "this" references to) is the page itself, not a control on the page, so you can't add attributes to it. So I assume that the error message is that the object doesn't have any "Attributes" property. Put an id on the body tag and make it a server tag, so that you can access it from code behind:
<body id="Body" runat="server">
Now you can declare the reference and put the call to the Javascript in the onload event:protected HtmlGenericControl Body; Body.Attributes.Add("onload", "setObj('Dinesh','Sharma',550,30)");
--- b { font-weight: normal; }
Hi guffa thanks for your great help.....Now I am able to do this :cool:. Thanks :)
Dinesh Sharma