Catch events in javascript from .NET usercontrol works in VB.Net

I've created a vb.net Windows Forms control that I've got working hosted in IE using the implementation found here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;305624

and here

http://msdn.microsoft.com/library/default.asp?url=/msdnmag/issues/02/01/UserCtrl/TOC.asp

I can access my properties and methods from javascript with no problem.  I tried to raise events in my UserControl and catch them in the HTML with javascript but I couldn't get it to work. The second article above on msdn explains how to source events from C#, but I need to get it working in VB.Net. Anyone been able to do this? How do I set it up?

TIA,


Owen
0
ojm37
12/7/2006 5:02:21 PM
asp.net.client-side 24353 articles. 1 followers. Follow

7 Replies
1321 Views

Similar Articles

[PageSpeed] 47

Here is a translator that converts C# code to VB:

http://authors.aspalliance.com/aldotnet/examples/translate.aspx

NC...

 

0
NC01
12/8/2006 12:39:54 AM

Thanks. Didn't produce working vb.net code. My hand translation works except for the events being bubbled out to the javascript....

The translator gave me a couple of avenues to check (like declaring a delegate), but it didn't make the events work either.


Owen
0
ojm37
12/8/2006 3:21:27 PM

I think that you're mixing server-side events with client-side events. Most custom server-side events will not fire client-side (except _doPostBack) because they just do not exist client-side.

Here's a simple example of handling a client-side event:

Add this in the UC's CodeBehind, Page_Load event handler:

Dim javaScript As String = _
 "<script type=JavaScript>" + _
 "function clickEvent(elementRef)" + _
 "{" + _
 " alert('Test: ' + elementRef.id);" + _
 "}" + _
 "</script>"

Page.RegisterClientScriptBlock("TestScript", javaScript)

Add the event handler to a Button in the UC:
Button1.Attributes.Add("onclick", "JavaScript:clickEvent(this);")

NC...

0
NC01
12/9/2006 11:38:10 AM

Yes, I want my Windows Forms Control to run on the client, using the client's CPU and interact with client-side JavaScript -- not running on the server.

Note that this is for an in-house project where the Windows Forms Control can be installed on the client machine and given the privileges it needs to run.

 I can get the Windows Forms Control to run on the client and even call into it using JavaScript. What I have not yet been able to do is sink our source events from my Windows Forms Control.

 For example, I have the following code in the html for the page: 

<object id="myControl1" height=96 width=330 classid="http:TestControl.dll$TestControl.MyControl"></object>
<script language="javascript">
   alert("Call Control);
   myControl1.TestProperty="ABCD";
   alert("The property is: " + myControl1.TestProperty);
</script>

 This works fine. What I need is for the control to be able to call a function in the client javaScript -OR- raise events that the JavaScript will respond to.

Thanks,


Owen
0
ojm37
12/11/2006 3:50:54 PM

Sorry, I can't help you there as I know of no way to do that and have really never messed with using WinForms or ActiveX objects on web pages.

Good luck with it
NC...

0
NC01
12/11/2006 5:20:24 PM

Thanks for trying.

 Maybe the way to go on this project is to create a Windows Forms project that connects back to the server (using ASMX [SOAP?]) for the data it needs...


Owen
0
ojm37
12/11/2006 5:28:22 PM

Maybe you need to lookup web user controls and web custom controls. Try Google

NC...

0
NC01
12/11/2006 5:33:47 PM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Type.GetType does not work in VB.NET but works in C#. VB.NET gurus Please help
Friends,   I am an experienced C# programmer who is working on a VB.NET project now. I am writing different methods covering the following functionalities 1) Take a datareader as input and return an arraylist of class object2) Take an xmlnode (received from a webservice) as input and return an arraylist of class object. The methods are generic methods which take datareader/xmlnode as first parameter and classname (string) as the second parameter. This way it will work trivially. The schema of class object matches with the input (datareader or xmlnode)In C# I used to do th...

converting to vb.net from c#.net authorize.net
authorize.net offered me some sample code when I signed up with them the only problem is the sample code is in c#.net but my page that they type all of their credit card into is vb.net <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage("https://certification.authorize.net/gateway/transact.dll"); } private String readHtmlPage(string url) { ...

Net:Net:Net::LDAP::FAQ
------_=_NextPart_001_01C6429F.D89AA417 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, Net::LDAP Net::LDAPS Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, ....) password? I don't like to write the secret password to the perl file. Best regards Barbara Wilbert ------_=_NextPart_001_01C6429F.D89AA417-- Wilbert Barbara (CI/OSI) * wrote: > Hello, > > Net::LDAP > Net::LDAPS > > Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, > ......

vb.net vs c#.net vs j#.net
just out of curiousity which looks, acts most like java? i'm still learning trying to used to vb.net but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

how can i write this line using vb.net : container.dataitem ?.... in vb.net its not working
Dim container As GridView = CType(newLinkButton.NamingContainer, GridView) Dim dataValue As Object = DataBinder.Eval(container.dataitem, _ColName)   _ColName its just a string a name of the field in my database   This is Vb.Net code man what you want? You can convert any format from this link http://www.developerfusion.com/tools/convert/vb-to-csharp/  If this post is answer of your question then don't forgot to Click Mark As Answer...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

Access Net work mapped drive VB.NET
Hi I have a docuemnt mangemnt system coded in VB.NET. The system sometimes needs to get documents from Network mapped drive and shared drives. In development machine everything works fine. But when I moved the code to Test serever, it could not access the mapped drives. I tried all security settings. But still could not. I tried unc path, but it throws In valid user exception. Can anybody help m eto solve this issue. Thank you Jikk Hi Jikk, What login is your app running under? Whichever it is, it has to have permission to access the network, which ASPNET doesn'...

About VB.net And VC.net
I am always Programming With VB.net Recently My Teacher ask us to learn Vc or VC.net. I try to learn it and compare it with vb.net, I found it's much too complex than vb. However it is said vc is strongger than vb I want to know Why vc is strongger than vb? and is it hard too learn vc? I am new to asp.net Thanks for man who want to help me! Wuhan, Hubei, China Below links could give some info http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q308470Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti VisualC is not a language in an of itself...

C#.NET or VB.NET
what lang does everyone prefer? Thanks, Peter Iuvara, MCP It's a very famous debatable question in forums! I would say if you are from Java/C/C++, then C# would be easy to use for you. If you are from ASP/VB, then VB.NET would be easy for you! As long as if you follow CLS, then what ever the language you use, it's going to be the same for CLR!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti I would agree with that ... just curious as to what user's on this forum predominantly code in?Thanks, Peter Iuvara, MCP I came from no real programming background, started i...

vb .net or c# .net
I currently develop websites using php but have been requested to develop a site using asp.net. The question I have is for someone who knows php would it be better to transition to vb.net or c#.net? Thanks, Fr. Robert C# -> There is a converter that will transition about 60% or more of your PHP code to C#. Plus C# is closer to PHP than VB.NET.Jason N. GaylordASPInsider and Microsoft MVPhttp://jasongaylord.com...

VB.Net To C#.Net
Hello... Since Last from 1 year i had develope web application in using vb.net now i want to transfer from vb.net to c#.net so what should i do to transform to c# language any link or book related to me through i can easily understand and coding using c# in a short time... Thanks~ Mark As Answer If UseFull ~Kaushal. Hi, you can read the specifications of the language. You're already familiar with .NET and how to program in an OO manner thanks to your experience with vb.net. The only thing you need to learn is the new syntax of C#. You can also convert parts of your v...

Client Side Events In HTML Page with .NET VB Class
Hi Im new to .NET so please excuse me. Ive been scratching my head for a week now trying to convert some code from VB6 to .NET I have currently this code in HTML <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>Default</title> <META content="VBScript" name="vs_defaultClientScript"> <META content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> <META content="Microsoft Visual Studio.NET 7.0" name=...

Perform JavaScript Client Side Confirmation from a VB.NET DataGrid
Hi, I when I delete an item from the database through a Datagrid I want to get a messagebox popingup to give me the choise to Confirm it...in case I clicked the wrong item....the way it works now it just deletes it....can any one help me with an Example I have no Idea how to do this...I found an article in C# but it didnt help me at all. here is my source code <asp:DataGrid ID="dgCustList" Runat="server" AutoGenerateColumns="False" DataKeyField="id" AlternatingItemStyle-BackColor="#F6F6F6" HeaderStyle-BackColor="#C4B58E" CellSpacing="0" CellPadding="2" GridLines="Vertical" Width="100%"...

Web resources about - Catch events in javascript from .NET usercontrol works in VB.Net - asp.net.client-side

'url' Top Users - Stack Overflow
current community chat blog Stack Overflow Meta Stack Overflow Stack Overflow Careers your communities Sign up or log in to customize your list. ...

List of content management frameworks - Wikipedia, the free encyclopedia
.NET Framework , works with SQL Server, VistaDB , with XSLT or .NET UserControls Text is available under the Creative Commons Attribution-ShareAlike ...

OPAC Discovery
Switch Language To switch to a different language, select from the following list: English French Spanish Italian British Bulgarian Galician ...

The royal baby - Australian Women's Weekly
MAKE AWW MY HOMEPAGE SUBSCRIBE AND SAVE TODAY FOOD RECIPES ROYALS CELEBS Home Food Recipe search Recipe collections Meal maker Expert Q & A Cookbooks ...

Envoyer par courriel à un ami - Best Buy Canada
Envoyer par courriel à un ami à Best Buy Canada

Bytes - IT + Developer Community - Connect with IT Pros
Bytes.com is a community for Developers and IT Professionals. Join 414,150 members and discuss topics such as software development, networking, ...

Canonical Splines in WPF and Silverlight
January 22, 2009 New York, N.Y. Windows Forms has two methods named DrawCurve and DrawClosedCurve that draw canonical (aka cardinal) splines. ...

Silverlight Toolkit - Issues
Silverlight Toolkit and Silverlight for Windows Phone Toolkit are a set of Microsoft components for developers.

Delicious
Keep, share, and discover the best of the Web using Delicious, the world's leading social bookmarking service.

DotNetNuke Modules – Anatomy of the View
-*+Now that we’ve laid the foundation of DotNetNuke modules, it is time to start looking at the specific modules. While it would be practically ...

Resources last updated: 12/20/2015 6:04:45 AM