How to access server-side controls of a user control(ascx) from its parent page (aspx) by using javascript
-
Hi all, I have already found the approaches to access server-side controls of a user control (e.g asp:label asp:textbox ...) on IE, var obj = document.getElementById('uctAUserConrolID_AServerSideControlID'); //or var obj = document.getElementById('uctAUserConrolID:AServerSideControlID'); //or BUT, these approaches don't work on Firefox!!! :( please let me know if anyone know the answer. Thanks Ming
-
Hi all, I have already found the approaches to access server-side controls of a user control (e.g asp:label asp:textbox ...) on IE, var obj = document.getElementById('uctAUserConrolID_AServerSideControlID'); //or var obj = document.getElementById('uctAUserConrolID:AServerSideControlID'); //or BUT, these approaches don't work on Firefox!!! :( please let me know if anyone know the answer. Thanks Ming
Correct me if i'm wrong, but firefox doesn't use getElementbyId, does it?
-
Correct me if i'm wrong, but firefox doesn't use getElementbyId, does it?
Hi, The firefox do use getElementbyId, because I tried this piece of code below to get the client-side controls within a user control , it works. var obj = document.getElementById('AClientSideControl');
-
Correct me if i'm wrong, but firefox doesn't use getElementbyId, does it?
By the way,I use the latest version of firefox.
-
Correct me if i'm wrong, but firefox doesn't use getElementbyId, does it?
Firefox uses
getElementById
.Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
Firefox uses
getElementById
.Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
It would appear that indeed i am wrong... :)
-
Hi all, I have already found the approaches to access server-side controls of a user control (e.g asp:label asp:textbox ...) on IE, var obj = document.getElementById('uctAUserConrolID_AServerSideControlID'); //or var obj = document.getElementById('uctAUserConrolID:AServerSideControlID'); //or BUT, these approaches don't work on Firefox!!! :( please let me know if anyone know the answer. Thanks Ming
You can view the HTML ViewSource in both IE and Firefox. And find out what the name of your element. then, I think you will get some idea how to get the object of your element in Javascript. If not, can you please the name of your name which is shown in the viewsource of IE and Firefox.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
You can view the HTML ViewSource in both IE and Firefox. And find out what the name of your element. then, I think you will get some idea how to get the object of your element in Javascript. If not, can you please the name of your name which is shown in the viewsource of IE and Firefox.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
Hi Michael, Thanks for your help, I did use the way you suggested. The HTML ViewSource for the asp:net control in both IE and Firefox are actually same: :doh: For Firefox: For IE: Regards, Ming
-
Hi Michael, Thanks for your help, I did use the way you suggested. The HTML ViewSource for the asp:net control in both IE and Firefox are actually same: :doh: For Firefox: For IE: Regards, Ming
var obj = document.getElementById("UctLogin1_txtEmail");
doesn't work? You got the error or got nothing? Have you tried to debug your javascript by using Firebug?Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
You can view the HTML ViewSource in both IE and Firefox. And find out what the name of your element. then, I think you will get some idea how to get the object of your element in Javascript. If not, can you please the name of your name which is shown in the viewsource of IE and Firefox.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
Hi Michael, Problems solved, I use getElementsByName with its name in HTML ViewSource instead of ID, it works! ;) It seems like the getElimentById function still does not work compatiblely with firefox very well. Regards, Ming
-
var obj = document.getElementById("UctLogin1_txtEmail");
doesn't work? You got the error or got nothing? Have you tried to debug your javascript by using Firebug?Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
No, it doesn't work with getElementById, no error shown in Firefox error console. the result show null. but anyway, getElementsByName works .. :laugh:
-
Hi Michael, Problems solved, I use getElementsByName with its name in HTML ViewSource instead of ID, it works! ;) It seems like the getElimentById function still does not work compatiblely with firefox very well. Regards, Ming
:) okay.. great!
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
Hi Michael, Problems solved, I use getElementsByName with its name in HTML ViewSource instead of ID, it works! ;) It seems like the getElimentById function still does not work compatiblely with firefox very well. Regards, Ming
Oh dear! I just found out what I said was wrong. getElementById function works as well!! :omg: