473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

C# call event in DLL

Hi everyone,

I have a problem calling an event in a DLL from a C# code. The dll is
written in VB.NET and I don't have the source code for it so I can't
modify it. The DLL came with an aspx file and they work fine together,
but the problem arose when I tried to convert aspx ("Page") into ascx
("UserControl"). After changing the file name to ascx and declaration
at the top of the page common web controls that have calles to events
in the DLL cannot sees them even though I've imported the dll at the
top of the control in declaration.

----------------------- This works --------------------------
<%@ Page Language="C#" Codebehind="TestCode.aspx.vb"
Inherits="TestDll.TestCode" %>
.....
<!-- code below can see the event -->
<asp:button id="cmdTest" onClick="event_in_dll"></asp:button>
-------------------------------------------------------------------

----------------------- This DOESN'T work --------------------------
<%@ Control Language="C#" %>
<%@ Imports Namespace="TestDll" %>
.....
<!-- code below can NOT see the event -->
<asp:button id="cmdTest" onClick="event_in_dll"></asp:button>
-------------------------------------------------------------------

I've tried everything that came across but had no luck. I have to
convert it to a User Control.
Could anyone help me with this please?

Thanks in advance,
Chan

Aug 21 '06 #1
2 5255
Hi,
<!-- code below can see the event -->
<asp:button id="cmdTest" onClick="event_in_dll"></asp:button>
What this means is that to call a method declared in the parent class of the
current page. If you go to the aspx file you will see in the top a @Page
directire it will especify the parent class. All the methods implemented in
the parent class are part of the new class that will be generated by
compiling the aspx.

Now if you convert it to a user control the page including the control will
have to derive from the same class.

Or a possible solution could be to have the parent class of the new page
(the one that will include the control) to derive from the class defined in
the dll instead of Page as it usually the case.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


-------------------------------------------------------------------

----------------------- This DOESN'T work --------------------------
<%@ Control Language="C#" %>
<%@ Imports Namespace="TestDll" %>
....
<!-- code below can NOT see the event -->
<asp:button id="cmdTest" onClick="event_in_dll"></asp:button>
-------------------------------------------------------------------

I've tried everything that came across but had no luck. I have to
convert it to a User Control.
Could anyone help me with this please?

Thanks in advance,
Chan

Aug 21 '06 #2
Hi Ignacio,
Or a possible solution could be to have the parent class of the new page
(the one that will include the control) to derive from the class defined in
the dll instead of Page as it usually the case.
I've created a new page which inherits the dll and embeded the user
control in that page, and it looks like working. I am sure because I am
getting an "object reference not set" error. I guess what I'm trying is
sort of working but having another trouble inside the DLL.

Thank you for your reply,
Chan

Aug 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: ...
3
by: David N | last post by:
Hi All, I just wonder if in C#, I can develop a user defined control that can call its parent function which is not yet developed. For example, how do I make my user control call a...
2
by: rawCoder | last post by:
Hi I am having this InvalidOperationException with message Cannot call Invoke or InvokeAsync on a control until the window handle has been created This is raised when i try to invoke a method...
13
by: jac | last post by:
Hae, I have a windows form with a ComboBox an other things. On that combobox I have an eventhandler on de selectedindexchanged. But somewhere in my code want to do excecute the same code that...
4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
22
by: Ricky W. Hunt | last post by:
First, the subject probably doesn't use the correct terms but I'm not sure what it's called in VB. I'm writing a media player app. The subroutine that handles the "open file" button contains an...
7
by: Bonzo | last post by:
>From within a function, I want to pass a/some parameters to another function, AND all arguments, passed into this function. e.g. function firstFunction(){ //this function may have been...
4
by: Paul | last post by:
Hi, I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so...
3
by: Ignacio Machin | last post by:
How can I call an event from another event: I want to call : DropDownList_SelectedIndexChanged in: Page_Load
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.