A
Arpan
The following code works fine:
<script runat="server">
Dim strName As String = "Arpan"
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Page.DataBind()
End Sub
</script>
<form runat="server">
<asp:Label id="lblMessage" Text=<%# strName %> runat="server"/>
</form>
But if the line
Dim strName As String = "Arpan"
is placed inside the Page_Load sub so that the script code looks like
this:
<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim strName As String = "Arpan"
Page.DataBind()
End Sub
</script>
then the following error gets generated:
Name 'strName' is not declared.
pointing to the line
<asp:Label id="lblMessage" Text=<%# strName %> runat="server"/>
Why so?
Thanks,
Arpan
<script runat="server">
Dim strName As String = "Arpan"
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Page.DataBind()
End Sub
</script>
<form runat="server">
<asp:Label id="lblMessage" Text=<%# strName %> runat="server"/>
</form>
But if the line
Dim strName As String = "Arpan"
is placed inside the Page_Load sub so that the script code looks like
this:
<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim strName As String = "Arpan"
Page.DataBind()
End Sub
</script>
then the following error gets generated:
Name 'strName' is not declared.
pointing to the line
<asp:Label id="lblMessage" Text=<%# strName %> runat="server"/>
Why so?
Thanks,
Arpan