Click here to Skip to main content
16,014,591 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello sir.
I am giving query string in postback URL property. Like this
<asp:Button ID="BtnAdd" runat="server" Text="Add To Cart"  CommandName="add" CommandArgument ='<%#Eval("eid") %>' PostBackUrl="~/AddToCart.aspx?eid='<%#Eval("eid") %>'&ename='<%#Eval("ename") %>'"/>

It is giving error "SERVER TAG IS NOT WELL FORMED"
where is the error i don't know. Any body please tell me.

Thanking you,
Posted
Updated 1-Jan-11 22:45pm
v2

You've got some superflous quotes mucking up your tag and some quotes are the wrong kind:
PostBackUrl="~/AddToCart.aspx?eid='<%#Eval("eid") %>'&ename='<%#Eval("ename") %>'"
----------------------------------^-----------------^-------^-------------------^
-------------------------------------------|---|---------------------|-----|


The positions where the caret (^) is mark the quotes that are not needed.
The positions where the pipe (|) is mark the quotes that should be single (') instead of double quotes (").

My advice to you is not to use these code tags at all but do the setting of the attributes of your tag from code behind. Code tags tend to mess up your pages tags.
Second thing I noticed is that unless "eid" and "ename" are already URL encoded strings, you'll run into trouble if they contain funny characters or event just strings. IE might swallow some that but other browswers probably wont.

Best Regards,

Manfred
 
Share this answer
 
v5
Comments
sathish.jampala 2-Jan-11 5:26am    
Thank you sir.
i dont understand ur language. but ur reply was make me to get an idea. that i remoe the "" marks. inside the open and close peranthasis. problem is solved.

thankyou very much.
Manfred Rudolf Bihy 2-Jan-11 5:57am    
Which part didn't you understand?
Besides if my answer was helpful you may want to consider voting on it.
fjdiewornncalwe 2-Jan-11 11:01am    
It is a very good answer, Manfred... I'll 5 since the OP can't seem to be bothered to.
Manfred Rudolf Bihy 2-Jan-11 11:13am    
@Marcus: They might be too busy considering the weekend is almost over and there is so much (homuworku) left to do. Forgive by bad japanese :)
Problem is the way you have formed the URL. You need to put an append string between evals.

General Eval in ASP.NET 2.0
<%# Eval("expression") %>

Now, try:
XML
PostBackUrl='<%# "~/AddToCart.aspx?eid=" & Eval("eid") & "ename=" & Eval("ename") %>'
 
Share this answer
 
Comments
sathish.jampala 2-Jan-11 5:48am    
thank you sir. for ur quick reply.
Sandeep Mewara 2-Jan-11 5:49am    
Did this work?
While using eval with string create like this:

]]>

Place this inside single quotes (')
 
Share this answer
 
Comments
fjdiewornncalwe 2-Jan-11 11:02am    
The answer you are giving has already been given twice above. Please read the other answers before posting your own. If you agree with an answer that was give, add a comment of agreement and a vote so that the OP sees that it is a good answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900