Description: I want to call a user control that calls another user control for encapsulation as shown below. I have a very hard time making the child control see the grandparent variable passed to it In the example shown below, Default.aspx calls the uc:Control, which in turn calls the uc:SubControl. I can get uc:Control to see Variable1="Value1", but I cannot get the uc:SubControl to see that value. What am I doing wrong. I use VB for the code behind and I have a public variable called Variable1 in both user controls.
Default.aspx:
<uc:Control id="Parent" Variable1="Value1" runat="server"></uc:ParentControl
ParentControl.ascx:
<uc:SubControl id="Child" Variable1="<%=Value1%>" runat="server"></uc:ChildControlYou can't use the <%= %> syntax to set an attribute of a server control.
Use <%# %> instead, and DataBind().
0 comments:
Post a Comment