Click here to Skip to main content
15,891,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I created a class library project in VS2005.
i created windows form user control with a button on it.
when built a DLL is being created for that user control.
i load DLL using object tag from a web server on IE.

what i need is to call javascript when i click on button.
is there any way to do this ???


Will appreciate for ur efforts :)
Posted
Comments
Sandeep Mewara 30-Jun-10 10:30am    
Call javascript where and what? You loaded DLL using object tag, now what is the link of javascript on click button to this DLL object?
Abbasikov 30-Jun-10 11:20am    
function doSomething() {alert("doSomething called"); }

above is the javascript funtion which i want to call through a button which resides on the UserControl (DLL) embedded on IE

There is no need for a custom control, just use [button].OnClientClick.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick.aspx[^]
 
Share this answer
 
the link which is provided uses web controls which am not using.
in my case there is HTML page which has HTML object TAG used to
embed controls as DLL on browser.
 
Share this answer
 
Comments
Adam R Harris 30-Jun-10 14:43pm    
Why would you use a windows forms control on a web page?
This doesn't make sense, It seems like you are trying to recreate the wheel if the only reason you have created this 'ActiveX' control (which for the record isn't really an ActiveX control is to call JavaScript when the button is clicked, so to reinterate; use Windows controls in Windows apps and use Web controls for Web apps unless there is a very very good reason to not.
Abbasikov 1-Jul-10 1:46am    
I can achieve my task through ActiveX controls which can call Javascript function but they are built on VB6. I wanted to achive my task using C# (.NET 2.0). If i use web controls as u said then i must have aspx page to render that controls. I have an HTML page which renders a DLL using an OBJECT tag.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900