zms6445
zms6445

Reputation: 317

Accessing static class method from aspx page

I get a "System.ArgumentException: Keyword not supported: '<%'." error when I try to access a static class method that will determine what connectionstring I will be using. It is probably a syntax error but I'm not very familiar with accessing class methods from an aspx page.

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%=GetConnectionString.createConnectionString()%>" SelectCommand="SELECT * FROM [Activity]" OnSelecting="SqlDataSource1_Selecting1"></asp:SqlDataSource>

Upvotes: 1

Views: 1432

Answers (1)

qJake
qJake

Reputation: 17139

Single quotes for inline expressions:

ConnectionString='<%=GetConnectionString.createConnectionString()%>'

Also have a look at this, which explains in which context(s) you can use the syntaxes <%#, <%=, and <%$.

ASP.net Inline Expression Issue

Upvotes: 1

Related Questions