vb.net - ASP.NET Maintaining ViewState for controls inside a custom control template -
i have template property in control declared follows:
<templatecontainer(gettype(generictemplatecontainer)), persistencemode(persistencemode.innerproperty), templateinstance(templateinstance.single)> property customtemplate itemplate in control's init event have following:
if me.customtemplate isnot nothing dim templatecontainer new generictemplatecontainer me.customtemplate.instantiatein(templatecontainer) placeholder.controls.add(templatecontainer) end if this allows me place controls in markup inside template, on post controls inside template not holding viewstate.
i have tried adding persistchildren(true) attribute customtemplate property cannot because it's not valid.
are putting values viewstate? understand, need that. either that, or re-bind data on every postback.
here's inside user controls. apologize being c# , not vb, don't know vb:
public string text { { return (string)viewstate["text"]; } set { viewstate["text"] = value; } } reference: https://weblogs.asp.net/infinitiesloop/truly-understanding-viewstate
Comments
Post a Comment