CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 2/19/2004 10:08:26 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 26 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
ojm37
Asp.Net User
Composite Control Error?2/19/2004 10:08:26 PM

0/0

I'm trying to code a composite Login control in VB.NET for an asp page. I've got the control compiled, but when I try to add it to the toolbox (cutsomize toolbox dialog), I get the following error: "Insufficient state to deserialize the object. More information is needed."

Anyone know what kind of things can cause this?

Specifically, I'm trying to translate the custom control from chapter 12 of "Developing Microsoft ASP.NET Server Controls and Components" from C# into VB.

TIA,
Owen
sedgewick
Asp.Net User
Re: Composite Control Error?2/20/2004 12:56:45 AM

0/0

ojm37
Asp.Net User
Re: Composite Control Error?2/20/2004 2:57:27 PM

0/0

OK. Here's the code. I've never used a serialization attribute on any of my custom controls before....

Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls

<DefaultEvent("Logon"), DefaultProperty("UserID"), ToolboxData("<{0}:ctrlLogin runat=server></{0}:ctrlLogin>")> Public Class ctrlLogin
Inherits System.Web.UI.WebControls.WebControl
Implements INamingContainer

Private _UserID As String
Private _Password As String
Private _button As Button
Private _txtUserID As TextBox
Private _txtPassword As TextBox
Private _lblUserID As Label
Private _lblPassword As Label
Private _valUserID As RequiredFieldValidator
Private _valPassword As RequiredFieldValidator

#Region "Overridden Properties"

Public Overrides ReadOnly Property Controls() As ControlCollection
Get
EnsureChildControls()
Return MyBase.Controls()
End Get
End Property
#End Region 'Overriden Properties

#Region "Properties delegated to child controls"
<Bindable(True), Category("Appearance"), DefaultValue(""), Description("The text to display on the button")> _
Public Property ButtonText() As String
Get
EnsureChildControls()
Return _button.Text
End Get
Set(ByVal Value As String)
EnsureChildControls()
_button.Text = Value
End Set
End Property

<Bindable(True), Category("Default"), DefaultValue(""), Description("The User ID")> _
Public Property strUserID() As String
Get
EnsureChildControls()
Return _txtUserID.Text
End Get
Set(ByVal Value As String)
EnsureChildControls()
_txtUserID.Text = Value
End Set
End Property

<Bindable(True), Category("Appearance"), DefaultValue(""), Description("Error message of the validator used for the userID")> _
Public Property strUserID_ErrorMessage() As String
Get
EnsureChildControls()
Return _valUserID.ErrorMessage
End Get
Set(ByVal Value As String)
EnsureChildControls()
_valUserID.ErrorMessage = Value
_valUserID.ToolTip = Value
End Set
End Property

<Bindable(True), Category("Appearance"), DefaultValue(""), Description("The text for the userID label")> _
Public Property strUserID_Label() As String
Get
EnsureChildControls()
Return _lblUserID.Text
End Get
Set(ByVal Value As String)
EnsureChildControls()
_lblUserID.Text = Value
End Set
End Property

<Browsable(False), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public ReadOnly Property strPassword() As String
Get
EnsureChildControls()
Return _txtPassword.Text
End Get
End Property

<Bindable(True), Category("Appearance"), DefaultValue(""), Description("Error message of the validator for the password")> _
Public Property strPasswordErrorMessage() As String
Get
EnsureChildControls()
Return _valPassword.ErrorMessage
End Get
Set(ByVal Value As String)
EnsureChildControls()
_valPassword.ErrorMessage = Value
_valPassword.ToolTip = Value
End Set
End Property

<Bindable(True), Category("Appearance"), DefaultValue(""), Description("The text for the password label")> _
Public Property strPasswordLabel() As String
Get
EnsureChildControls()
Return _lblPassword.Text
End Get
Set(ByVal Value As String)
EnsureChildControls()
_lblPassword.Text = Value
End Set
End Property

#End Region 'Properties delegated to child controls

#Region "Events"
<Category("Action"), Description("Raised when the user clicks the login button")> _
Event Logon(ByVal sender As Object, ByVal e As EventArgs)

Sub btnLogin_Clicked(ByVal source As Object, ByVal e As EventArgs)
RaiseEvent Logon(Me, e)
End Sub

#End Region 'Events

#Region "Overridden Controls"
Protected Overrides Sub CreateChildControls()
Controls.Clear()

_lblUserID = New Label
_txtUserID = New TextBox
_txtUserID.ID = "txtUserID"

_valUserID = New RequiredFieldValidator
_valUserID.ID = "valUserID"
_valUserID.ControlToValidate = _txtUserID.ID
_valUserID.Text = "*"
_valUserID.Display = ValidatorDisplay.Static

_lblPassword = New Label

_txtPassword = New TextBox
_txtPassword.TextMode = TextBoxMode.Password
_txtPassword.ID = "txtPassword"

_valPassword = New RequiredFieldValidator
_valPassword.ID = "valPassword"
_valPassword.ControlToValidate = _txtPassword.ID
_valPassword.Text = "*"
_valPassword.Display = ValidatorDisplay.Static

_button = New Button
_button.ID = "button1"
_button.CommandName = "Logon"

Me.Controls.Add(_lblUserID)
Me.Controls.Add(_txtUserID)
Me.Controls.Add(_valUserID)
Me.Controls.Add(_lblPassword)
Me.Controls.Add(_txtPassword)
Me.Controls.Add(_valPassword)
Me.Controls.Add(_button)

AddHandler _button.Click, AddressOf Me.btnLogin_Clicked

End Sub

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

output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1", False)
output.RenderBeginTag(HtmlTextWriterTag.Table)

'UserID line
output.RenderBeginTag(HtmlTextWriterTag.Tr)
output.RenderBeginTag(HtmlTextWriterTag.Td)
_lblUserID.RenderControl(output)
output.RenderEndTag()
output.RenderBeginTag(HtmlTextWriterTag.Td)
_txtUserID.RenderControl(output)
output.RenderEndTag()
output.RenderBeginTag(HtmlTextWriterTag.Td)
_valUserID.RenderControl(output)
output.RenderEndTag()
output.RenderEndTag()

output.RenderBeginTag(HtmlTextWriterTag.Tr)
output.RenderBeginTag(HtmlTextWriterTag.Td)
_lblPassword.RenderControl(output)
output.RenderEndTag()
output.RenderBeginTag(HtmlTextWriterTag.Td)
_txtPassword.RenderControl(output)
output.RenderEndTag()
output.RenderBeginTag(HtmlTextWriterTag.Td)
_valPassword.RenderControl(output)
output.RenderEndTag()
output.RenderEndTag()

output.RenderBeginTag(HtmlTextWriterTag.Tr)
output.AddAttribute(HtmlTextWriterAttribute.Colspan, "2")
output.AddAttribute(HtmlTextWriterAttribute.Align, "right")
output.RenderBeginTag(HtmlTextWriterTag.Td)
_button.RenderControl(output)
output.RenderEndTag()
output.RenderBeginTag(HtmlTextWriterTag.Td)
output.Write("&nbsp;")
output.RenderEndTag() 'TD
output.RenderEndTag() 'TR
output.RenderEndTag() 'Table

End Sub

#End Region 'Overridden Controls


End Class

What am I missing?

Thanks,
Owen
sedgewick
Asp.Net User
Re: Composite Control Error?2/20/2004 3:24:34 PM

0/0

ojm37
Asp.Net User
Re: Composite Control Error?2/20/2004 6:28:46 PM

0/0

When I try to add it to the toolbox.

HMMM.....

I just moved the source code local to my machine (instead of on the server) and now it works. Wierd.

Why?

TIA,
Owen
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Fundamentals of Geometric Dimensioning and Tolerancing Authors: Alex Krulikowski, Pages: 391, Published: 1997
Developing Microsoft ASP.NET Server Controls and Components Authors: Nikhil Kothari, Vandana Datye, Pages: 689, Published: 2002
ASP.NET AJAX Programmer's Reference: With ASP.NET 2.0 Or ASP.NET 3.5 Authors: Shahram Khosravi, Pages: 1522, Published: 2007
The Second IEEE Conference on Control Applications Authors: IEEE Control Systems Society, Pages: 982, Published: 1993
The Control Handbook Authors: William S. Levine, Pages: 1548, Published: 1996

Web:
TextBox in composite control - ng.asp-net-forum.windows ... TextBox in composite control, > ROOT > NEWSGROUP > Asp.Net Forum ... exam module any interest · profile not in current context error. All Times Are GMT.
UpdateProgress in Composite Control Throws Error - ASP.NET Forums I have added a Composite Control to my page's code behind which contains an AJAX UpdateProgress Control. I keep getting an error that states ...
Problem with composite control a more specific error message, please post that message to help the guessing game. Also note that children controls of a composite control ...
An ASP.Net Composite Control for US and UK dates - ASP.NET ... Net Composite Control for US and UK dates - ASP.NET website · Rate this Resource 0 · read reviews · write a review · report an error · printer friendly ...
CodeProject: An ASP.NET Composite Control for US and UK dates ... A composite custom control and validator for handling US/UK dates; Author: David ... Required DateControls that start out blank immediately report an error ...
Sasha Sydoruk » HowTo - CompositeControl with a TextBox and a ... Jan 19, 2007 ... The composite control will automatically add the required validators and will create appropriate error messages! Here is the source code: ...
Problem with composite control - ng.asp-net-forum.windows ... Problem with composite control, > ROOT > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum, Date: 9/21/2004 3:31:06 PM, Replies: 1, Views: 5, ...
Designing DataGridView in composite control - column editor error ... Designing DataGridView in composite control - column editor error Thread Starter : Aleksey Y. Nelipa Started: 09 Dec 2005 10:07 PM UTC Replies: 1 ...
Error - Invalid skinid value within the named theme or ... thanks for your suggestion - yes i tryed to register the control -> i get no more error but the skin is not applied. My composite control ...
Databinding on Composite Control - .NET ASP I'm trying to implement databinding on a composite control and I'm getting an error with the data when I change the DataSource. The first time I set the ...

Videos:
Objects: they just work Google London Test Automation Conference (LTAC) Google Tech Talks September 8th, 2006 Presenter: Bob Binder
Lec 25 | MIT 3.091 Introduction to Solid State Chemistry Solutions: Solute, Solvent, Solution, Solubility Rules, Solubility Product View the complete course at: http://ocw.mit.edu/3-091F04 License: Creati...




Search This Site:










getting url menu option to open in new window using solpart menu

minmax persistance type of cookie requires a moduleid

bpm error manager (ported to dnn)

help with dynamic sitemap

do any of these modules exist for dotnetnuke?

super productcatalog 3.1 released!

weather module (v1.5.4) for dnn 3.1.0

dnn treeview control

building a custom module following seabury video

best way to share settings across different modules

new dnn tool to integrate microsoft project with dnn

itemtemplate in repeater

enhanced feedback module v1

new forum module for dnn

problem with .dnn manifest file - friendly name

best paypal module for online service

anyone seen this kind of module

ibuyspy store commerce starter kit dotnetnuke module with account maintenance & admin ui

access data grid

wiki module install problems

custom module - easy question

core forum avatars?

golf modules

to create a module w/o a view capability, do i just not add a 'view' module definition?

question re: ssl & parent tabs

error loading module (third party color picker)

new version of efficion's articles module released

install / uninstall scripts

problem with datagrid

xhtml validation of nokiko's schwingcssmenu

  Privacy | Contact Us
All Times Are GMT