471,089 Members | 1,628 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

XmlDataSource, datafile to a variable

hi, i am trying to put a session variable in the DataFile of the
XmlDataSource, but for some reason i am getting: Server tags cannot
contain <% ... %constructs.

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="<%
Session("UserPath") %"></asp:XmlDataSource>

I have even tried this:

<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="<%=Session("UserPath") %"></asp:XmlDataSource>

any idea ?

Aug 23 '06 #1
2 2566
server tags can only contain binding expressions, which is interpreted at
runtime. try:

<asp:XmlDataSource ID="XmlDataSource1"
runat="server"
DataFile="<%#Session("UserPath") %>" />

be sure to call the bind method.

-- bruce (sqlwork.com)
"Zulander" <zu******@gmail.comwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
hi, i am trying to put a session variable in the DataFile of the
XmlDataSource, but for some reason i am getting: Server tags cannot
contain <% ... %constructs.

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="<%
Session("UserPath") %"></asp:XmlDataSource>

I have even tried this:

<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="<%=Session("UserPath") %"></asp:XmlDataSource>

any idea ?

Aug 24 '06 #2
One obvious things is the quoting

<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="<%=Session("UserPath") %">
</asp:XmlDataSource>

should be

<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile='<%=Session("UserPath") %'>
</asp:XmlDataSource>

(notice the single quotes for the datafile), although this gives you
"The server tag is not well formed" errors,

Kevin Jones

Zulander wrote:
hi, i am trying to put a session variable in the DataFile of the
XmlDataSource, but for some reason i am getting: Server tags cannot
contain <% ... %constructs.

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="<%
Session("UserPath") %"></asp:XmlDataSource>

I have even tried this:

<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="<%=Session("UserPath") %"></asp:XmlDataSource>

any idea ?
Aug 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by mike | last post: by
reply views Thread by Jon Davis | last post: by
1 post views Thread by Disccooker | last post: by
2 posts views Thread by rote | last post: by
1 post views Thread by Sean | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.