Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Losing viewstate after inheriting CheckBoxList

Reply
Thread Tools

Losing viewstate after inheriting CheckBoxList

 
 
Earl Teigrob
Guest
Posts: n/a
 
      10-03-2006
I am trying to add a property to my CheckBoxList control that renders the
output as text if my own 'ViewOnly' property is set. This works for my
inherited of TextBox and RadioButtonList but I am losing the viewstate
selected items after the first time I render the text only. Is there a way to
save the view state inforation in the control or do I need to write my own
code to maintain view starte. Below is an example of my code. The ViewOnly
property is my own viewstate properties. Thanks for your help.


Protected Overrides Sub Render(ByVal writer As
System.Web.UI.HtmlTextWriter)
If ViewOnly Then
Dim Delimiter As String
If Me.RepeatDirection = WebControls.RepeatDirection.Horizontal
Then
Delimiter = ", "
Else
Delimiter = "<br>"
End If
Dim FirstPass As Boolean = True
For Each Item As ListItem In Me.Items
If Item.Selected Then
If Not FirstPass Then
writer.Write(Delimiter)
End If
writer.Write(Item.Text)
FirstPass = False
End If
Next
Else
MyBase.Render(writer)
End If
End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex losing <br> (different from the earlier topic about losing $1) Jason C Perl Misc 4 06-26-2012 10:29 PM
Losing Drives - Finding Drives - Losing Drives mel@no.spam.com Computer Support 2 09-21-2007 10:16 PM
Checkboxlist inside Repeater - doesn't fire click event for Checkboxlist JD ASP .Net 5 08-08-2007 11:28 AM
How to get Selected item in a Databinded CheckBoxList when CheckBoxlist is in a DataList? Patrick.O.Ige ASP .Net 5 06-19-2005 06:11 AM
CheckBoxList losing viewstate dm_dal ASP .Net Web Controls 4 02-18-2004 09:36 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57