Wednesday, January 5, 2011

How to manipulate .NET controls with JavaScript

Happy New Years! Recently I had to manipulate C# ASP.NET controls with embedded javascript. I was able to display image links with javascript functionality to different control functions. See below as I embed javascript into a Label Control with HTML tags as well:

Label1.Text += "<br /><a href='#' onclick='javascript:form1.txtCommand.value=\"enable user " +
                cu + "\";'><img src='images/enableuser.png'></a> <a href='#' onclick='javascript:form1.txtCommand.value=\"disable user " +
                cu + "\";'><img src='images/disableuser.png'></a> <a href='#' onclick='javascript:form1.txtCommand.value=\"unlock user " +
                cu + "\";'><img src='images/unlockuser.png'></a><br />";
                Label1.Text += "---------------------------------------"
                + "------------------------------------- <br />";

No comments:

Post a Comment