Cutom TableCell Control : Custom Property Not Saving after Button Click

Discussion in 'ASP .Net Building Controls' started by ryan.d.rembaum@kp.org, Feb 7, 2006.

  1. Guest

    I am trying to make a very simple control that adds a "required"
    property to a table cell. Setting the property to true automatically
    should add a red asterick '*' to the end of any text it contains if the

    value was previously false and is set to true. Conversly, if the value

    is set to false and was true, the asterick should be removed.


    To test I created a but that sets the value to the opposite of whatever

    it is currently. The problem is that, though I am changing the value,
    the value never gets stored.I thought it might be becuase of view
    state, so I tried implementing IPOSTBACKDATAHANDLER, but unless I did
    something wrong it did not seem to make a difference.


    Does anyone know why the value is not being retained? Thanks!


    My code is as follows:


    Public Class RequirementCell : Inherits TableCell
    Private _Required As Boolean


    Public Property Required() As Boolean
    Get
    Return _Required
    End Get
    Set(ByVal Value As Boolean)
    Dim strStart As Integer
    If ((Value = True) And (_Required = False)) Then
    Me.Text = Me.Text & "<B><font
    color=""red"">*</B></FONT>"
    ElseIf ((Value = False) And (_Required = True))
    Then
    strStart = InStr(Me.Text, "<B><font
    color=""red"">*</B></FONT>")
    If strStart > 0 Then
    Me.Text = Mid(Me.Text, 1, strStart - 1)
    End If
    End If
    _Required = Value
    End Set
    End Property


    End Class
    , Feb 7, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian K. Williams

    TableCell oTableCell = new TableCell(); noWrap?

    Brian K. Williams, Apr 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,501
    Brian K. Williams
    Apr 30, 2004
  2. Svein Terje Gaup
    Replies:
    0
    Views:
    8,039
    Svein Terje Gaup
    Sep 15, 2004
  3. Nathan Sokalski
    Replies:
    1
    Views:
    1,097
    =?Utf-8?B?SmVk?=
    Apr 29, 2006
  4. Nathan Sokalski

    TableCell: BackColor Property But No BackGround Property?

    Nathan Sokalski, Apr 28, 2006, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    117
  5. Nathan Sokalski

    TableCell: BackColor Property But No BackGround Property?

    Nathan Sokalski, Apr 28, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    127
Loading...

Share This Page