asp.net - Parser Error Message -
my asp.net code <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:tdfconnectionstring2 %>" selectcommand="select * answer,users question_id="<%=session["qid"]%>" , answer.user_id=users.user_id"></asp:sqldatasource> <asp:repeater id="repeater2" runat="server" datasourceid="sqldatasource1"> <headertemplate> <div class="container"> </headertemplate> <itemtemplate> <div class="panel panel-primary"> <div class="panel-heading"> <h2 class="panel-title"><a href="answer.aspx?qid=<%#eval("question_id") %>"><asp:label id="label2" runat="server" text="reply"></asp:label></a></h2> </div><!--panel-heading--> <div class="panel-body"> <asp:image id="image1" runat="server" imageurl='<%#eval("uimg")%>' height="100" width="100" /> <asp:label id="label1" runat="server" text='<%#eval("answer_detail") %>'></asp:label> <br /> <asp:label id="label4" runat="server" text='<%#eval("username") %>'></asp:label> <br /> </div><!--panel-heading--> </itemtemplate> </asp:repeater>
when browse application
server error in '/' application.
parser error
description: error occurred during parsing of resource required service request. please review next specific parse error details , modify source file appropriately.
parser error message: server tag not formed.
source error:
line 28: line 29: line 30: " selectcommand="select * answer,users question_id="<%=session["qid"]%>" , answer.user_id=users.user_id"> line 31: line 32:
source file: /admin/questionview.aspx line: 30
version information: microsoft .net framework version:4.0.30319; asp.net version:4.0.30319.34212
you cannot utilize <%= ... %>
set properties of server-side controls. inline expressions <% %>
can used @ aspx page or user control's top document level, can not embeded in server control's tag attribute (such <asp:sqldatasource... selectcommand =<%= %> ..>
).
you can not utilize <%=session["qid"]%>
within command runat=server
. , not evaluated server contro. can set value in code behind or page_load event.
you need set next in page_load event.
sqldatasource1.selectcommand = select * answer,users question_id=" + session["qid"].tostring() + " , answer.user_id=users.user_id"
sqldatasource1.connectionstring = "<put_your_connectrin_string_here>";
update sqldatasource1
next in aspx.
<asp:sqldatasource id="sqldatasource1" runat="server"></asp:sqldatasource>
already explained here - web forms error message: "this not scriptlet. output plain text"
asp.net sql-server c#-4.0
No comments:
Post a Comment