473,779 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inherits from Control, Yay, Inherits from WebControl, Nay....

Hi, I have the following in project "RaducuCustomCo ntrols":

Imports System.Componen tModel
Imports System.Web.UI

<DefaultPropert y("Text"), ToolboxData("<{ 0}:Rotator1
runat=server></{0}:Rotator1>") > Public Class Rotator1
Inherits System.Web.UI.W ebControls.WebC ontrol

Public Items As New ArrayList()

Protected Overrides Sub Render(ByVal output As
System.Web.UI.H tmlTextWriter)

Dim objRandom As New Random()
Dim intRanIndex As Integer
Dim objSelectedItem As RotatorItem1

If Items.Count > 0 Then
intRanIndex = objRandom.Next( Items.Count)
objSelectedItem = CType(Items(int RanIndex), RotatorItem1)
output.Write(ob jSelectedItem.T ext)
End If
End Sub

Protected Overrides Sub AddParsedSubObj ect(ByVal obj As Object)

If TypeOf obj Is RotatorItem1 Then
Items.Add(obj)
End If
End Sub
End Class

<DefaultPropert y("Text"), ToolboxData("<{ 0}:RotatorItem1
runat=server></{0}:RotatorItem 1>")> Public Class RotatorItem1
Inherits System.Web.UI.W ebControls.WebC ontrol

Dim _text As String
Dim _color As String

<Description("T he text of this item"), Bindable(True),
Category("Appea rance"), DefaultValue("" )> Property [Text]() As String
Get
Return _text
End Get

Set(ByVal Value As String)
_text = Value
End Set
End Property

<Description("T he color in which the text will be rendered"),
Bindable(True), Category("Appea rance"), DefaultValue("B lack")> Property
[Color]() As String
Get
Return _color
End Get

Set(ByVal Value As String)
_color = Value
End Set
End Property

Protected Overrides Sub Render(ByVal writer As
System.Web.UI.H tmlTextWriter)

writer.AddAttri bute("color", [Color])
writer.RenderBe ginTag("font")
writer.Write([Text])
writer.RenderEn dTag()
End Sub
End Class

I also have <Assembly: TagPrefix("Radu cuCustomControl s", "raducu")> in
AssemblyInfo.vb in "RaducuCustomCo ntrols". Therefore, I expect the following
code to run just fine:

<raducu:Rotator 1 id="Rotator11" runat="server">
<raducu:Rotator Item1 id="RotatorItem 11" text="One" color="red"
runat="server"> </raducu:RotatorI tem1>
<raducu:Rotator Item1 id="Rotatoritem 12" text="Two" color="green"
runat="server"> </raducu:RotatorI tem1>
<raducu:Rotator Item1 id="Rotatoritem 13" text="Three" color="blue"
runat="server"> </raducu:RotatorI tem1>
<raducu:Rotator Item1 id="Rotatoritem 14" text="Four"
runat="server"> </raducu:RotatorI tem1>
</raducu:Rotator1 >

However, I get

Type 'RaducuCustomCo ntrols.Rotator1 ' does not have a property named
'raducu:Rotator Item1'.

on <raducu:Rotator Item1 id="RotatorItem 11" text="One" color="red"
runat="server"> </raducu:RotatorI tem1>.

If I change the Inherits in my custom control from Webcontrol to control, it
works, although I don't see the properties I'm interested in.

Please tell me, what am I missing here ?

Thank you, Alex.
Nov 19 '05 #1
0 1149

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2051
by: Greg Christie | last post by:
I think I have a somewhat unique situation here, so I thought I should post it for the few poor souls who run across it and try to google it like I did. First of all, I was getting the following error when trying to hit one of my pages... --------------------------------------------------------------------- Invalid URI: There is an invalid sequence in the string. ---------------------------------------------------------------------
1
2822
by: Josema | last post by:
Hi, I would like to know whats the difference of inherit from webcontrol or webcontrols In wich cases its better the use of one or another Thanks in advance Regards Josema.
5
1373
by: Eric | last post by:
Given System.Web.UI.Control Control Can I determine the height of Control without knowing specifically what it is?
1
1022
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a variable (targetId) in to the usercontrol (IntergySite.aspx) by calling its setter method. Currently, I am using if-then-else and hardcoded the User Control Object to do casting and call the setter method. Question: Is there any way I could load,...
5
3596
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact that for server control component , code is running on the server side. But if I take as example a Label. I place on a webform an HTM label control and a WebForm label control, I could see that properties are different for
2
4925
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is being updated by some other process through remoting. When the page loads, I init the tree, and in my browser I can see the initialized tree. The problem is that every time that I receive update to tree from the remote process,
1
6102
by: Jeremy Chapman | last post by:
I have a property will an array of webcontrols. The control features a custom property editor which can add and remove web controls to the array, but how do I persist the informtion by serializing it to the aspx page? For example, right now, here is what the html looks like when I drag my control on to the page and add some web controls to the ControlList property:
2
2257
by: sravan_reddy001 | last post by:
I created a tabcontrol toolin my application.(actually i am creating a tabbed browser) when the user clicks on the newtab button(provided by me) the new tab is added and the webbrowser control is added to that by the following code. TabPage t = new TabPage(); t.Text = "tabpage" + i.ToString();
5
2715
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I'm trying to make my code as streamlined as possible, and add CSS file references dynamically when they are required, for example, if a page contains a webcontrol, then the related CSS file is added by the webcontrol. This prevents me having to remember to add the CSS file to the page if I use a certain webcontrol. I have a MasterPage with an array of StyleSheets, and a public function for
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.