Insert string from database into an aspx and have databinding expressions within that text evaluated
Posted
by Christopher Edwards
on Stack Overflow
See other posts from Stack Overflow
or by Christopher Edwards
Published on 2010-03-23T15:41:50Z
Indexed on
2010/03/24
10:33 UTC
Read the original article
Hit count: 291
.NET
|quick-and-dirty
Well, as you can see I want something quick-and-dirty!
How can I get a string from a db that has aspx databinding syntax in it and have the databinding expressions evaluated?
So I have text such as this stored in the DB:-
Hello <%=User.Name %> I haven't seen you since <%=User.LastVisit %>
And I want it to be inserted here say:-
...
<body>
<form id="form1" runat="server">
<div>
<asp:FormView ID="FormView1" DataSourceID="DataSource1" runat="server">
<ItemTemplate>
<-- insert stuff here! -->
...
But with the databinding expressions evaluated. I'd rather not build a full parsing, templating and evaluation engine...
© Stack Overflow or respective owner