473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Problem with Controls...

Hello, everybody,

I'm having a problem creating a control...All I want to do is a simple poll
system, so I need to input (trough a ListitemCollection) the values from the
user.

The problem is I'm getting an error each time I try to modify the elements,
I don't know why....

If anyone can help, I would appreciate...

Raphaël...



Imports System.ComponentModel

Imports System.Web.UI

Imports System.Web.UI.WebControls

<DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")> Public Class WebCustomControl1

Inherits System.Web.UI.WebControls.WebControl

Dim _text As String

<Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]()
As String

Get

Return _text

End Get

Set(ByVal Value As String)

_text = Value

End Set

End Property

Public Property Itens() As ListItemCollection

Get

If Not IsNothing(viewstate("FirstTime")) Then

Return viewstate("Itens")

Else

Dim lstCol As New ListItemCollection

Dim lst As ListItem

lst = New ListItem("ASP.NET", 0)

lstCol.Add(lst)

lst = New ListItem("ASP", 0)

lstCol.Add(lst)

viewstate("FirstTime") = ""

Return lstCol

End If

End Get

Set(ByVal Value As ListItemCollection)

viewstate("Itens") = Value

End Set

End Property

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

MyBase.Render(output)

End Sub

End Class

Nov 18 '05 #1
4 1163
Hi,

Could you post the code that create the contorl?

--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET

"Raphaël Désalbres" <ra*****@desalbres.com> wrote in message
news:eF*************@TK2MSFTNGP09.phx.gbl...
Hello, everybody,

I'm having a problem creating a control...All I want to do is a simple poll system, so I need to input (trough a ListitemCollection) the values from the user.

The problem is I'm getting an error each time I try to modify the elements, I don't know why....

If anyone can help, I would appreciate...

Raphaël...



Imports System.ComponentModel

Imports System.Web.UI

Imports System.Web.UI.WebControls

<DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")> Public Class WebCustomControl1

Inherits System.Web.UI.WebControls.WebControl

Dim _text As String

<Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As String

Get

Return _text

End Get

Set(ByVal Value As String)

_text = Value

End Set

End Property

Public Property Itens() As ListItemCollection

Get

If Not IsNothing(viewstate("FirstTime")) Then

Return viewstate("Itens")

Else

Dim lstCol As New ListItemCollection

Dim lst As ListItem

lst = New ListItem("ASP.NET", 0)

lstCol.Add(lst)

lst = New ListItem("ASP", 0)

lstCol.Add(lst)

viewstate("FirstTime") = ""

Return lstCol

End If

End Get

Set(ByVal Value As ListItemCollection)

viewstate("Itens") = Value

End Set

End Property

Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
MyBase.Render(output)

End Sub

End Class

Nov 18 '05 #2
Hello, I already put the code below my first question...

I'm trying to build a composite control...

The problem is I don't know how to do to make a ListItemControl attached to
the control...Which default value I am supposed to use?

Thanks,

Raphaël...
"Juno" <su*****@easydotnet.com> escreveu na mensagem
news:#L**************@tk2msftngp13.phx.gbl...
Hi,

Could you post the code that create the contorl?

--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET

"Raphaël Désalbres" <ra*****@desalbres.com> wrote in message
news:eF*************@TK2MSFTNGP09.phx.gbl...
Hello, everybody,

I'm having a problem creating a control...All I want to do is a simple

poll
system, so I need to input (trough a ListitemCollection) the values from

the
user.

The problem is I'm getting an error each time I try to modify the

elements,
I don't know why....

If anyone can help, I would appreciate...

Raphaël...



Imports System.ComponentModel

Imports System.Web.UI

Imports System.Web.UI.WebControls

<DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")> Public Class WebCustomControl1

Inherits System.Web.UI.WebControls.WebControl

Dim _text As String

<Bindable(True), Category("Appearance"), DefaultValue("")> Property

[Text]()
As String

Get

Return _text

End Get

Set(ByVal Value As String)

_text = Value

End Set

End Property

Public Property Itens() As ListItemCollection

Get

If Not IsNothing(viewstate("FirstTime")) Then

Return viewstate("Itens")

Else

Dim lstCol As New ListItemCollection

Dim lst As ListItem

lst = New ListItem("ASP.NET", 0)

lstCol.Add(lst)

lst = New ListItem("ASP", 0)

lstCol.Add(lst)

viewstate("FirstTime") = ""

Return lstCol

End If

End Get

Set(ByVal Value As ListItemCollection)

viewstate("Itens") = Value

End Set

End Property

Protected Overrides Sub Render(ByVal output As

System.Web.UI.HtmlTextWriter)

MyBase.Render(output)

End Sub

End Class


Nov 18 '05 #3
Hi,

:)I didn't see your code.

I think you may add ListItem to controls and a ListItemCollection instance
in CreateChildControls method .
like:

private lstCol As New ListItemCollection
sub CreateChildControls
Dim lst As ListItem

lst = New ListItem("ASP.NET", 0)
controls.add(1st)
lstCol.Add(lst)

lst = New ListItem("ASP", 0)
controls.add(1st)
lstCol.Add(lst)

end sub
If you'd like to create a listcontrol ,you can inherit
System.Web.UI.WebControls.ListControl.

--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET

"Raphaël Désalbres" <ra*****@desalbres.com> wrote in message
news:uw**************@TK2MSFTNGP10.phx.gbl...
Hello, I already put the code below my first question...

I'm trying to build a composite control...

The problem is I don't know how to do to make a ListItemControl attached to the control...Which default value I am supposed to use?

Thanks,

Raphaël...
"Juno" <su*****@easydotnet.com> escreveu na mensagem
news:#L**************@tk2msftngp13.phx.gbl...
Hi,

Could you post the code that create the contorl?

--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET
"Raphaël Désalbres" <ra*****@desalbres.com> wrote in message
news:eF*************@TK2MSFTNGP09.phx.gbl...
Hello, everybody,

I'm having a problem creating a control...All I want to do is a simple

poll
system, so I need to input (trough a ListitemCollection) the values from
the
user.

The problem is I'm getting an error each time I try to modify the

elements,
I don't know why....

If anyone can help, I would appreciate...

Raphaël...



Imports System.ComponentModel

Imports System.Web.UI

Imports System.Web.UI.WebControls

<DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")> Public Class

WebCustomControl1
Inherits System.Web.UI.WebControls.WebControl

Dim _text As String

<Bindable(True), Category("Appearance"), DefaultValue("")> Property

[Text]()
As String

Get

Return _text

End Get

Set(ByVal Value As String)

_text = Value

End Set

End Property

Public Property Itens() As ListItemCollection

Get

If Not IsNothing(viewstate("FirstTime")) Then

Return viewstate("Itens")

Else

Dim lstCol As New ListItemCollection

Dim lst As ListItem

lst = New ListItem("ASP.NET", 0)

lstCol.Add(lst)

lst = New ListItem("ASP", 0)

lstCol.Add(lst)

viewstate("FirstTime") = ""

Return lstCol

End If

End Get

Set(ByVal Value As ListItemCollection)

viewstate("Itens") = Value

End Set

End Property

Protected Overrides Sub Render(ByVal output As

System.Web.UI.HtmlTextWriter)

MyBase.Render(output)

End Sub

End Class



Nov 18 '05 #4
Hello,

Couldn 't you please send me some more sample code?

Thanks,

Raphaël...
"Juno" <su*****@easydotnet.com> escreveu na mensagem
news:Of**************@TK2MSFTNGP10.phx.gbl...
Hi,

:)I didn't see your code.

I think you may add ListItem to controls and a ListItemCollection instance in CreateChildControls method .
like:

private lstCol As New ListItemCollection
sub CreateChildControls
Dim lst As ListItem

lst = New ListItem("ASP.NET", 0)
controls.add(1st)
lstCol.Add(lst)

lst = New ListItem("ASP", 0)
controls.add(1st)
lstCol.Add(lst)

end sub
If you'd like to create a listcontrol ,you can inherit
System.Web.UI.WebControls.ListControl.

--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET

"Raphaël Désalbres" <ra*****@desalbres.com> wrote in message
news:uw**************@TK2MSFTNGP10.phx.gbl...
Hello, I already put the code below my first question...

I'm trying to build a composite control...

The problem is I don't know how to do to make a ListItemControl attached

to
the control...Which default value I am supposed to use?

Thanks,

Raphaël...
"Juno" <su*****@easydotnet.com> escreveu na mensagem
news:#L**************@tk2msftngp13.phx.gbl...
Hi,

Could you post the code that create the contorl?

--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET
"Raphaël Désalbres" <ra*****@desalbres.com> wrote in message
news:eF*************@TK2MSFTNGP09.phx.gbl...
> Hello, everybody,
>
> I'm having a problem creating a control...All I want to do is a simple poll
> system, so I need to input (trough a ListitemCollection) the values from the
> user.
>
> The problem is I'm getting an error each time I try to modify the
elements,
> I don't know why....
>
> If anyone can help, I would appreciate...
>
> Raphaël...
>
>
>
>
>
>
>
> Imports System.ComponentModel
>
> Imports System.Web.UI
>
> Imports System.Web.UI.WebControls
>
> <DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
> runat=server></{0}:WebCustomControl1>")> Public Class WebCustomControl1 >
> Inherits System.Web.UI.WebControls.WebControl
>
> Dim _text As String
>
> <Bindable(True), Category("Appearance"), DefaultValue("")> Property
[Text]()
> As String
>
> Get
>
> Return _text
>
> End Get
>
> Set(ByVal Value As String)
>
> _text = Value
>
> End Set
>
> End Property
>
> Public Property Itens() As ListItemCollection
>
> Get
>
> If Not IsNothing(viewstate("FirstTime")) Then
>
> Return viewstate("Itens")
>
> Else
>
> Dim lstCol As New ListItemCollection
>
> Dim lst As ListItem
>
> lst = New ListItem("ASP.NET", 0)
>
> lstCol.Add(lst)
>
> lst = New ListItem("ASP", 0)
>
> lstCol.Add(lst)
>
> viewstate("FirstTime") = ""
>
> Return lstCol
>
> End If
>
> End Get
>
> Set(ByVal Value As ListItemCollection)
>
> viewstate("Itens") = Value
>
> End Set
>
> End Property
>
>
>
> Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
>
> MyBase.Render(output)
>
> End Sub
>
> End Class
>
>
>



Nov 18 '05 #5

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

Similar topics

4
by: waltborders | last post by:
Hi, Because the blind are unable to use a mouse, keyboard navigation is key. A major difficulty is that not all windows forms controls are keyboard 'tab-able' or 'arrow-able' or have "tab...
0
by: Dan | last post by:
I posted a similar post regarding problems with VS.NET design mode. I fixed that problem (with much thanks to this newsgroup) but now I have a second problem. I have created a class called...
3
by: Eric | last post by:
I have built a composite user web control that I want to create dynamically. The form will contain a variable number of these controls and as well some of the contents of the user web control...
1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am have facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the...
1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
3
by: Tim::.. | last post by:
Can someone please tell my why I get the following problem when I type the following piece of code! How do I get around this??? The idea is that when a user clicks a button on a form it causes...
3
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
1
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.