J
Jim Ross [MVP]
I have a User Control with a property defined (in the ASCX, not in
CodeBehine. The property is defined like this:
<script runat=server language=vb>
Private m_deptName As String
<Bindable(True)>Public Property DepartmentName As String
Get
Return m_deptName
End Get
Set
m_deptName = value
End Set
End Property
</script>
When I put the control on a page and set the propery like this, it
works:
<uc1:Header id="headerCtl" runat=server DepartmentName="Some
Department"></uc1:Header>
However, if I use a variable that has been defined on the page and
then set the user control property to the value, it does not work, the
value is never set. There are no errors thrown, but, as I said, the
value is not set.
<script runat=server language=vb>
Dim pageDeptName As String = "Page Department Name"
</script>
....
<uc1:Header DepartmentName="<%= pageDeptName %>"
runat=server></uc1:Header>
Jim Ross
MS MVP [ASP.NET][VC/MFC emeritus]
To send email, change 'lotsofspamthroughhere' to 'msn' but please ask all questions in the newsgroups, not via private mail
CodeBehine. The property is defined like this:
<script runat=server language=vb>
Private m_deptName As String
<Bindable(True)>Public Property DepartmentName As String
Get
Return m_deptName
End Get
Set
m_deptName = value
End Set
End Property
</script>
When I put the control on a page and set the propery like this, it
works:
<uc1:Header id="headerCtl" runat=server DepartmentName="Some
Department"></uc1:Header>
However, if I use a variable that has been defined on the page and
then set the user control property to the value, it does not work, the
value is never set. There are no errors thrown, but, as I said, the
value is not set.
<script runat=server language=vb>
Dim pageDeptName As String = "Page Department Name"
</script>
....
<uc1:Header DepartmentName="<%= pageDeptName %>"
runat=server></uc1:Header>
Jim Ross
MS MVP [ASP.NET][VC/MFC emeritus]
To send email, change 'lotsofspamthroughhere' to 'msn' but please ask all questions in the newsgroups, not via private mail