Question : Interface to connect ascx events to parent via business layer code library - VB / ASP.NET

We have several pages which will have a lot of dynamically-loaded ascx's on them. To test the approach, we have set it up by "wiring up" some of the ascx's directly (ie using their individual IDs)  on the parent page. However, we then learned how to refer to controls on these ascx's in our business layer code library using interfaces. We then tried to use interfaces to "wire up" the events too, but cannot make it work. The idea would be to add an event handler for each ascx button as that ascx is loaded (so we know its ID at that stage) and then to have this fire a general event on the parent, sending its own ID and a datatype property. The parent page event would then call a business layer sub / function that would use the sender ID and datatype to decide what to do. Can anyone give us an example (in VB please) of:
1) The event handlerfor the parent page (set by the code library sub which loads each ascx) - ours so far is:
     Dim btnSearch As Button = CurrentUserControl.FindControl("btnSearch")
     AddHandler btnSearch.Click, AddressOf CurrentPage.Search
2) The interface which would define the event that has to be implemented on the ascx
3) The way to implement this on the ascx (ie if the search button click event uses
     RaiseEvent Search(Me, e)
     how do we make that implement the interface, so we can refer to is from the code library?
4) The Search sub on the parent which this fires, and which then passes the sender and eventargs back to the business layer code

I hope this is enough information to get some help? Many thanks

Answer : Interface to connect ascx events to parent via business layer code library - VB / ASP.NET

There are two different hosts files that you may need to work with

First:
c:\Windows\System32\Drivers\Etc\Hosts

Second
c:\Windows\System32\Drivers\Etc\Lmhosts

If you have a LM hosts file try and rename it to lmhosts.bak or something similar

When you have added the information to your hosts file try and clear out a few networking components by running the following commands

ipconfig /flushdns
netsh int ip reset resetlog.txt

Those two command should cause any issues to be flushed from your DNS cache.
Random Solutions  
 
programming4us programming4us