whats the best way to pass data to user components in asp.net?

Hurkulez

New Member
its .net 2.0 here, not MVC, and im crap at asp forms :(.So yeah, ive got a page with user controls on it. When i click on something in the page, i want to load the usercontrol based on a parameter from the page.Problem is i cant do it.In my page's FaultTree_Clicked, i get the value, then ive tried a variety of things:
  • I tried exposing a property on thechild user control to set the value, which i set in FaultTree_Clicked,it gets forgotten.
  • I tried saving it toSession["mykey"], and loadingSession["mykey"] in the control'sPage_init... the value is blank.
  • I tried saving it toViewState["mykey"], and loadingViewState["mykey"] in the control'sPage_init... the value is blank.
EDIT: ok more specific info:Heres a cut down version of what the page(MyFault) looks like:\[code\]<form id="form" runat="server"> <div id="faulttree"> <asp:TreeView ID="FaultTree" ......> </div> <uc1:_DefectDetail ID="DefectDetail" runat="server" Visible="true" EnableViewState="true" /></form>\[/code\]And theres a method on the pages codebehind "FaultTree_SelectedNodeChanged()".When that method is hit, I want to load/show the DefectDetail control. The DefectControl requires a faultid, which comes off the Tree, which i successfully get in the SelectedNodeChanged method. I cant get the faultid into the defect control.
 
Back
Top