M
Mark Rae
Hi,
Just a general quickie on setting properties of user controls from the
parent form.
Let's say I have a user control called note.ascx which displays a datagrid.
That datagrid is populated according to an integer variable in the ViewState
of the parent form.
The code behind (still in v1.1) of the user control contains the following:
public class note : System.Web.UI.UserControl
{
protected int pParentID;
public int ParentID
{
set{pParentID = value;}
}
Let's say the parent form has the following:
<%@ Register TagPrefix="ucNote" TagName="ucNotes" Src="~/note.ascx" %>
..
..
..
<ucNote:ucNotes ID=ucNotes runat=server ParentID=<%=ViewState["ParentID"]%>
/>
While that certainly works, would it be more efficient to move the ParentID
tag out of the form page and set it in the code behind instead? This would
also prevent the ParentID value from being visible in View Source, though
that's not reallly much of a consideration in this case.
Any assistance gratefully received.
Mark
Just a general quickie on setting properties of user controls from the
parent form.
Let's say I have a user control called note.ascx which displays a datagrid.
That datagrid is populated according to an integer variable in the ViewState
of the parent form.
The code behind (still in v1.1) of the user control contains the following:
public class note : System.Web.UI.UserControl
{
protected int pParentID;
public int ParentID
{
set{pParentID = value;}
}
Let's say the parent form has the following:
<%@ Register TagPrefix="ucNote" TagName="ucNotes" Src="~/note.ascx" %>
..
..
..
<ucNote:ucNotes ID=ucNotes runat=server ParentID=<%=ViewState["ParentID"]%>
/>
While that certainly works, would it be more efficient to move the ParentID
tag out of the form page and set it in the code behind instead? This would
also prevent the ParentID value from being visible in View Source, though
that's not reallly much of a consideration in this case.
Any assistance gratefully received.
Mark