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.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.
I think im catching what your saying but what about reusablility among creted server controls how is that handled
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
<%@. Control ClassName="Header" %>
<%@. Register TagPrefix="mintLab" Namespace="mintLab.webServerControls" Assembly="mlcMenu" %>
<img src="http://pics.10026.com/?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
<%@. Register TagPrefix="Vegaware" TagName="Header" src="http://pics.10026.com/?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
<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..
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
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.
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.
<%@. Register TagPrefix="Whatever" Namespace="The namespace name" Assembly="the assemblies name..without .dll" %>
<Whatever:Classname runat="server" property1="pissoff"/>
does that help?
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment