modularbeing Posted June 10, 2004 Posted June 10, 2004 I want to create a composite server control for a new project im working on and it looks simple enough to do. However I want the control to show up in the Design environment like a regular asp control. I know I have to add extra tags to the code for this to work. Does anyone know of any code samples that does this in vb.net? all samples I have found are c# or do not have this functionality. thanks, Josh Quote
bob01900 Posted June 10, 2004 Posted June 10, 2004 However I want the control to show up in the Design environment like a regular asp control. Not quite sure what you meant by that: 1. If you mean that the control will be displayed in design time as what it should look like and not a grey box, then Custom Controls should do that. Unless you created an User Control (*.ascx). If you want to add a Cusom Control, you can add a new "Web Control Library" project to your solution or create a class that inheret from System.Web.UI.Control or System.Web.UI.WebControls.WebControl. 2. Or if you mean that the control will be displayed in the Toolbox (on the left), then: i. Right click on one of the tabs (or create a new one) ii. Choose "Customize Toolbox" iii. Choose ".Net Framework Component" tab iv. Click on Browse button and locate your *.dll or *.exe control file. If you need help building a Custom Control, try here. Hope this helps. Quote
modularbeing Posted June 10, 2004 Author Posted June 10, 2004 I am refering to custom control. the one test control I made worked but in the IDE I got a grey box that said error on it. All the control was was a composite of a text box and a required field validator. Another problem I was having was when I put the control in the toolbox and tried to drag n drop it onto the form it did nothing except add a reference to my project.... thanks, Josh Quote
bob01900 Posted June 10, 2004 Posted June 10, 2004 I got a grey box that said error on it. How about fix the error first? :) Quote
modularbeing Posted June 10, 2004 Author Posted June 10, 2004 How about fix the error first? :) I don't know what the error is....the page works fine when I debug it. Quote
modularbeing Posted June 14, 2004 Author Posted June 14, 2004 I made another simple control and this one gets a parser error. But I cannot see what is wrong with this... Control code: Imports System Imports System.web Imports System.Web.UI Imports System.ComponentModel Namespace MyControl Public Class testControl Inherits System.Web.UI.WebControls.WebControl Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) writer.Write("<h1>Hello World<h1>") End Sub End Class End Namespace Page Code: <%@ Register TagPrefix="JB" Namespace="MyControl" Assembly="testControl"%> <JB:testControl runat="server"/> Quote
Administrators PlausiblyDamp Posted June 14, 2004 Administrators Posted June 14, 2004 writer.Write("Hello World") should be writer.Write("Hello World") Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.