Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attribute must be enclosed in quotation marks

Tags:

asp.net

When trying to build the solution, I am getting a warning, Attribute must be enclosed in quotation marks. How do I enclose the CommandArgument attribute in quotes ?

<asp:LinkButton Runat="server" ID="lkAcknowledge" Visible="false" CommandName="Acknowledge" CommandArgument=<%# DataBinder.Eval(Container.DataItem, "AssignmentID")%> >Acknowledge</asp:LinkButton>

like image 896
stackuser Avatar asked Jun 03 '13 16:06

stackuser


2 Answers

Use single quotes:

<asp:LinkButton Runat="server" ID="lkAcknowledge" Visible="false" CommandName="Acknowledge" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "AssignmentID")%>'>Acknowledge</asp:LinkButton>

like image 161
qJake Avatar answered Sep 28 '22 16:09

qJake


Use single quotes:

CommandArgument='<%# DataBinder.Eval(Container.DataItem, "AssignmentID")%>'

Note you can also use the shorthand Eval since ASP.NET 2.0 to get rid of some of the noise:

CommandArgument='<%#Eval("AssignmentID")%>'
like image 29
Mark Brackett Avatar answered Sep 28 '22 15:09

Mark Brackett