查询字符串回发网址中的错误. [英] error in query string postback url.

查看:60
本文介绍了查询字符串回发网址中的错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,先生.
我在回发URL属性中提供查询字符串.像这样

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,

推荐答案

您有一些多余的引号会破坏您的标签,而有些引号却是错误的类型:
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") %>''"
----------------------------------^-----------------^-------^-------------------^
-------------------------------------------|---|---------------------|-----|



插入号(^)所在的位置标记不需要的引号.
管道(|)所在的位置标记应为单引号('')而不是双引号()的引号.

我的建议是根本不要使用这些代码标签,而应从后面的代码中设置标签的属性.代码标签往往会弄乱您的页面标签.
我注意到的第二件事是,除非"eid"和"ename"已经是URL编码的字符串,否则如果它们包含有趣的字符或仅包含事件的字符串,就会遇到麻烦. IE可能会吞下某些内容,但其他浏览器可能不会.

最好的问候,

Manfred



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


问题是您形成URL的方式.您需要在评估之间放置一个附加字符串.

ASP.NET 2.0中的常规评估
<%#Eval(表达式")%>

现在,尝试:
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:
PostBackUrl='<%# "~/AddToCart.aspx?eid=" & Eval("eid") & "ename=" & Eval("ename") %>'


在将eval与字符串创建一起使用时,如下所示:

]]>

将其放在单引号('')
While using eval with string create like this:

]]>

Place this inside single quotes ('')


这篇关于查询字符串回发网址中的错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆