CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 12/11/2003 5:31:35 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 23 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
1 Items, 1 Pages 1 |< << Go >> >|
keith5000
Asp.Net User
Databound custom ctrl loses child ctrl state on postback12/11/2003 5:31:35 PM

0/0

I built a databound custom control but its child controls lose their state on postback.

I built it following the QuickStart Repeater2 example:
http://samples.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/ctrlauth/templates/Repeater2.src&file=VB\Repeater2.vb&font=3

The only differences with mine is (1) I don't use templates, and (2) my RepeaterItems have properties that store their values in ViewState:
public property Name as String

get
return ViewState("Name")
end get
set
ViewState("Name") = Value
end set
end property



On postback the child controls are recreated in sub CreateChildControls(). I've even tried giving them explicit unique ids but to no avail:
protected overrides sub  CreateChildControls()

if (not ViewState("NumItems") is nothing)
Me.Controls.Clear()

Items = new RepeaterItemCollectionVB()

for i as Integer = 0 to ViewState("NumItems") - 1
dim NewItem as new RepeaterItemVB()
NewItem.ID = "Item_" & i

Me.Controls.Add (NewItem)
Items.Add(NewItem)
next i
end if
end sub


What am I missing? Am I supposed to explicitly load and save the viewstate for these controls?
1 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Custom Databound Control Losing Data on Postback - ASP.NET Forums I have a custom Data Bound control that I am building. But on postback I lose the all state and I can't figure out why state isn't coming ...
ASP.NET Resources - Building a Composite Databound Control the 2.0 Way Aug 16, 2006 ... It is true when you call DataBind() and false when the control is being rebuilt from view state on postback. Therefore the while (e. ...
CodeProject: A Templated databound Repeater control with per-row ... How to make the Repeater save its state in ViewState so postbacks work as .... on postback (how does the control recreate itself without a DataBind()? ...
A Crash Course on ASP.NET Control Development: Building Composite ... As a result, child controls can handle view state themselves and bubble events ... The second control using Render loses the new text across postbacks. ...
Inside Microsoft: Code Reuse with ASP.NET Part 3: Custom Controls NET to automatically maintain the state of the child controls, including any user entered or selected values, that will be contained in our custom control, ...
ViewState Management So unfortunately what I was doing on postback was calling DataBind() without having ... By aggregate, I mean this: My custom control had some buttons on it. ...
Scott on Writing But wait a minute, if you add a child control via the Controls. .... the DataSource property and calling the DataBind() method) on each and EVERY postback? ...
Custom Server Controls Retreiving posted data in a custom control. Triggering a Postback ..... SimpleRepeater control, you need to call the DataBind() method of the header, ...
Never doubt thy debugger : Application, Page and Control lifecycle Dec 19, 2007 ... If the request is a postback, the values of the controls have not yet been restored from view state. If you set a control property at this ...
ASP.NET QuickStart Tutorial Custom controls need to register for control-state (ideally OnInit but before ... and other methods such as child control creation and post-back handling. ...




Search This Site:










error with the print preview

re-authenticating a user even with the authentication cookie set

setup is looking for file winsdk_vwdtools.exe

do i need findcontrol if control declared at top of class??

why the command executenonquery cannot be initialised??

can someone sugg me-using the help label?

form authentication

object orientated dropdownlist

accessing files from a folder and diplaying them onto a page

any webcasts planned

memory consumption for each user in dnn 3.1.1

about bandwith problem

companyname - ?? why

menu display problems using masterpage

how to use a 3rd party dot-net dll in a web project?

daab - c# datetime parameter intto a smalldatetime field in the database conversion error

2.0 error reporting

global.asa... what am i missing.

very newbie question from someone that jst started with asp.net

add a new row to a datagrid.

web site administration tool not working on win xp x64

please help me!

web.config warnings in vs2005

how to change custom module version ?

problem create upload form

issues w/images not showing up on a mac w/3.0.13...

how do i restrict users logging into the site once they have registered?

web server

make online catalog?

flex fields

 
All Times Are GMT