[Last Call] Learn how to a build a cloud-first strategyRegister Now


asp linkbutton commandargument value results in "The server tag is not well formed"

Posted on 2007-03-26
Medium Priority
Last Modified: 2010-05-19
I have a repeater control which populates a table with asp:linkbuttons.

The asp:linkbuttons each have a different commandName, obviously, but their commandarguments will all be the same. I want their commandarguments to be populated by a data item from the repeater control called "SERVICE_ID".

The following code causes an error when compiled: "The server tag is not well formed"
<td class="intraContent" align="center" style="border-bottom: 2px solid #D3D3D3"><asp:LinkButton runat="Server" id="linkButton1" CssClass="lnkbutton" CommandName="Collection_All" CommandArgument="<%# eval("Service_ID") %>"><%#databinder.eval(container.dataitem,"Collection_Count") %></asp:LinkButton></td>

However, when I replace the commandargument with just a plain old string hard-coded in like "1234", it compiles without a problem.

So what is wrong with the syntax CommandArgument="<%# Eval("Service_ID") %>" ???

Thank you,
Question by:rss2
LVL 15

Expert Comment

ID: 18791989

<%# databinder.eval(container.dataitem, "Service_ID") %>

fix it?
LVL 16

Accepted Solution

Swapnil Piparia earned 2000 total points
ID: 18792000
Hi rss2,
  try changing

CommandArgument="<%# Eval("Service_ID") %>"


CommandArgument= '<%# Databinder.Eval(container.dataitem,"Service_ID") %>'

because service_id is databound item.


Author Comment

ID: 18792133
I tried both syntax methods but neither worked.

HOWEVER, it was surrounding it with double quotes which made it fail!

THANK YOU!!! I have used your commandargument above with single quotes as you have and it's working. :)

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question