Solved

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

Posted on 2007-03-26
3
1,723 Views
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,
rss2
0
Comment
Question by:rss2
3 Comments
 
LVL 15

Expert Comment

by:crisco96
Comment Utility
Does

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

fix it?
0
 
LVL 16

Accepted Solution

by:
Swapnil Piparia earned 500 total points
Comment Utility
Hi rss2,
  try changing

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

to

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

because service_id is databound item.

Regards,
NetSwap.
0
 

Author Comment

by:rss2
Comment Utility
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. :)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now