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 + "\"; form1.cmdExecute2.click()'><img src='images/enableuser.png'></a> <a href='#' onclick='javascript:form1.txtCommand.value=\"disable user " +
                cu + "\"; form1.cmdExecute2.click()'><img src='images/disableuser.png'></a> <a href='#' onclick='javascript:form1.txtCommand.value=\"unlock user " +
                cu + "\"; form1.cmdExecute2.click()'><img src='images/unlockuser.png'></a><br />";
                Label1.Text += "---------------------------------------"
                + "------------------------------------- <br />";

No comments:

Post a Comment

Generating "Always On Top" NSWindow in macOS across all detected displays

Also: Using UIKit & Cocoa Frameworks using Objective-C In m acOS or OS X , written in either Objective-C or Swift  Langues, you m...