Groups | Blog | Home
all groups > dotnet general > november 2004 >

dotnet general : Bound Property problem


Tommy
11/5/2004 7:59:20 PM
I added a property to the asp.net textbox. It is set as bindable and i am
able to do so. When i go to read the property the value is not there.

Somehow it isn't persisted on the server. I tried using ViewState() to set
and read the property and it did nothing. Here is the code I am using.

Any help is really appreciated.

Thanks..
Tommy

Imports System.ComponentModel
Imports System.Web.UI
<ListBindable(True)> Public Class clsTextBox
Inherits System.Web.UI.WebControls.TextBox
Private _iPricePk As Integer
<Bindable(True), _
NotifyParentProperty(True), _
PersistenceMode(PersistenceMode.InnerProperty)> _
Public Property iPricePK() As Integer
Get
Return Me._iPricePk
End Get
Set(ByVal Value As Integer)
Me._iPricePk = Value
End Set
End Property
End Class

Tommy
11/6/2004 9:13:51 AM
I should have given more details...

I have to create a page with close to 100 textboxes on it to display a bunch
of pricing information. They will be grouped so I am using nested repeaters
(or trying to). I have the textboxes in the repeaters bound to the
datasource but it seems i have to manage my own updates. I cannot seem to
get the pre-canned stuff to work. (ds.update). The page will look similar to
a spreadsheet and all textboxes have to be enabled all the time so using the
grid is out.

I thought if I added a property to the textbox and bind it to the primary
key field it came from i can easily iterate through the controls collection
of each repeater and do the update like that.

I'd be very interested in hearing if anyone else has another idea on how to
accomplish this. It seems asp.net isn't really geared to handle this without
a bit of creativity.

Thanks for your answer.

Tommy


[quoted text, click to view]

Cor Ligthert
11/6/2004 11:57:35 AM
Tommy,

With the change to answer your question wrong.

I do not know how you are using this code, however to make it more clear.

In a webform is nothing persistent on the server. Everything should be
stored in the viewstate or a session when it is about page information and
to be retrieved back from the page (viewstate) or server (session).

The term for that is "a webform is stateless"

I hope this gives some idea's

Cor

AddThis Social Bookmark Button