Results 1 to 6 of 6

Thread: web controls

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2000
    Posts
    53

    web controls

    Does anybody know any visual studio.net creating web control tutorials. Im having a heck of a time how these are suppose to be made I see the web control library and user control and all this stuff but nothing looks like how you could make active x controls in vb 6 any help would be nice

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    .NET throws out that ActiveX idealogy. You need to think server side controls..building your interface using asp .net controls that create html interfaces is the correct way to go.. I mean if you want VB6 client side type stuff, you just write a desktop app.

    At least until some point when there is IE .NET that allows client side use of windows forms controls, but this does not exist yet.. maybe one day.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2000
    Posts
    53
    I think im catching what your saying but what about reusablility among creted server controls how is that handled

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Well you have things like pagelets (.ascx) that let you create a control that could group other controls and code that you may use multiple times..Like on my site

    http://www.vegware.com


    see the banner and menu...since that piece is always a the top of all my pages, I stick the html/code to create that into an .ascx file
    Code:
    <%@ Control ClassName="Header" %>
    <%@ Register TagPrefix="mintLab" Namespace="mintLab.webServerControls" Assembly="mlcMenu" %>
    
    <img src="vware.jpg"/>
    
    	
    			<mintLab:cMenu id="CMenu1" runat="server" 
    			XmlDataFileName="MenuData.xml" 
    			FontFamily="verdana" 
    			FontSize="8" 
    			FontBold="0" 
    			FontItalic="0" 
    			TopMenuBGColor="6699FF" 
    			BGColor="6699FF" 
    			BGColorOver="66CCff" 
    			TopMenuBorderColor="0000FF" 
    			BorderColor="0000FF" 
    			TopMenuFontColor="Black" 
    			FontColor="Black" 
    			TopMenuFontColorOver="Black" 
    			FontColorOver="Black" 
    			MenuWidth="" 
    			Left="10" Top="100" 
    			SeparatorColor="FFFBF7" 
    			TopMenuIsHorizontal="true"
    			IsHorizontal="false" 
    			RightToLeft="false" 
    			DisplayOnClick="false" 
    			TopMenuIsVariableWidth="false" 
    			IsVariableWidth="false">
    			</mintLab:cMenu>
    that cMenu control is another web form control I found btw..it creates the dhtml menu.

    then you can easily call the ascx pagelet like this

    Code:
    <%@ Register TagPrefix="Vegaware" TagName="Header" Src="header.ascx" %>
    
    <Vegaware:Header runat="server"/>
    youcan even put properties into your ascx file and use them like attributes when you call the ascx file..for example

    Code:
    <Vegaware:Header property1="blah" runat="server"/>
    you can also create a compiled one by inheritng the web.ui control , overriding the Render routine, and use output.Write to output your html..this is what one looks like..

    Code:
    Imports System
    Imports System.Web
    Imports System.Web.UI
    
    Namespace SimpleControlSamples
    
        Public Class SimpleVB : Inherits Control
    
           Protected Overrides Sub Render(Output As HtmlTextWriter)
               Output.Write("<H2>Welcome to Control Development!</H2>")
           End Sub
        End Class
    End Namespace
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2000
    Posts
    53
    hmmmmm I understand some of what you are saying. But some of it is a bit hazy I understand creating the pagelet control where u create the ascx. But as far as making it an object that can be called Im using visual studio.net and it seems alot of examples im seeing people just use notepad Ideally I want to make a login control. That could be repeatly used I would like to add properties to it so like I could specfize the connection to a database and add properties as the like. I think that being able to do this I would conceptually understand making custom control in .net.

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    you just put the code i gave into the .vb/.cs file of a dll project. You add properties the same way you would with any other project...compile it...then put the dll into your web project's bin folder..you can then access it from the page as so.

    Code:
    <%@ Register TagPrefix="Whatever" Namespace="The namespace name" Assembly="the assemblies name..without .dll" %>
    
    <Whatever:Classname runat="server" property1="pissoff"/>
    does that help?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

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