CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Jan 2009
    Location
    Cochin, India
    Posts
    40

    User Controls as Dll's.

    Hi,

    The other day I came across a very interesting question in one of the other forums where a person had inquired about converting all his user controls to dll's. I was wondering if it is possible to completely capture all functionality of a user control in a dll. That is you should not provide even the html code. Of course the obvious solution is to create a web custom control. But I was wondering if there was an easier solution. I did find a solution which I have posted at

    http://forums.aspfree.com/net-develo...on-270380.html

    I am attaching the application here also. I have attached a file called Application.zip here. If you unzip it you will find 2 applications one is a class library project called ClassLibrary1 and another a web site called WebSite79.

    The ClassLibrary project creates a dll called ClassLibrary1.dll which is a user control that is used by WebSite79. This is just a sample user control that has panel containing a text box and a button.

    You can open up WebSite79 in VS 2005 and run it. If you do, you will get the a table with three rows and the user control placed in each row of the table. The user control has a panel containing an empty text box and the button which is simply titled "Inside the user control" which means that the button is a part of the user control.

    And there will be another button titled "Outside the user control" meaning it is in the page containing the user control and is not a part of the user control. It is also placed outside the tables containing the user controls. On clicking the button inside the user control in any of the rows, on post back the corresponding text box will have the text "You clicked on me".

    If you click on the button outside the user control on post back the text box in each row of the table will have the text "You clicked on a button outside the user controls". Now here the dll encapsulates all functionality and even the size and width of all constituent controls can be set from outside. So much so as you will find with a certain amount of manipulation you can even place the user controls wherever you want in the containing page by using a table or a place holder.

    The only thing I am not able to set is the style. That is I am unable to position the text box and buttons etc wherever I want inside the panel in the user control externally. The problem is the Style property is read only. I wonder if anyone can think up of a solution to this.

    Warm Regards,
    Attached Files Attached Files
    Jay
    Support Resort
    http://www.supportresort.com
    Bringing offshore expertise to the world

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured