>dwg1011 wrote:
>>I have a global class GClass with 2 contants. Both are declared
public in the form:
PUBLIC Const Const1 = "xxx". When I try to use the constant as a
default value (see code excerpt below) the program bombs, but when I
use a hardcoded value it works fine. Any ideas?
Failing Version:
<SelectParameters>
<asp:Parameter Name="Catalog"
Type="String"
DefaultValue="<%
GClass.Const1 %>" />
"Andrew Morton" wrote:
>Shouldn't that be:-
<asp:Parameter Name="Catalog"
Type="String"
DefaultValue="<%=GClass.Const1 %>" />
?
i.e. no new line splitting the name/value pair to potentially
confuse it, and an equals sign.
dwg1011 wrote:
The spacing was just the way it posted. If I am not mistaken the
=varname is "classic" ASP formatting while .net does not require it.
Did you try it? I only use code-behind rather than in-line code.
What actually goes wrong? "Bombs" is vague.
*However* I now think it can't work that way. You would have to do it like:-
<%@ Page Language="VB" %>
<script runat="server">
Const const1 as string="xxx"
Sub Page_Load(obj as object, e as eventargs)
Catalog.DefaultValue=const1
End Sub
</script>
[other stuff]
<SelectParameters>
<asp:Parameter Id="Catalog" Name="Catalog" Type="String" />
Any use?
Andrew