Solved

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

Posted on 2007-03-26
3
1,763 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Expert Comment

by:crisco96
ID: 18791989
Does

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

fix it?
0
 
LVL 16

Accepted Solution

by:
Swapnil Piparia earned 500 total points
ID: 18792000
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
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. :)
0

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

728 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