ASP 网页中的堆栈跟踪错误不在我的代码中?
我是 ASP 中的 Web 开发新手,我遇到了一个问题,我尝试通过链接访问某个页面,但出现错误,第一部分说这是一个异常,然后是调试提示,然后是堆栈跟踪。
发生的情况是,这段代码不在我的应用程序中,我以前也遇到过这样的错误,而出现的代码的平静通常对我有很大帮助。
--[编辑1]--
戴夫·安德森 (Dave Anderson):(
Format(Eval("Data"),"dd/MM/yyyy")
在标签内)
I'm new to web-development in ASP, and I'm experiencing a problem where I try to access a certain page through a link and I get an error, the first part says it's an exception, then tips on debugging and then the stacktrace.
What happens is that this code isn't on my application, I've had errors like this before, and the peace of code that appeared usually helped me a lot.
--[EDIT 1]--
for Dave Anderson:
Format(Eval("Data"),"dd/MM/yyyy")
(inside a label)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
堆栈跟踪的前两行应该会给您一些提示。第二行显示 ASP.PMUsControl 的实例正在尝试绑定到某些数据集,其格式应用于第一行的字符串值。该表达式无效,我想是因为它无法格式化,我想说这是因为字符串为空或对象无法转换为字符串。您能找到它试图绑定的数据吗?
编辑:该格式字符串
“dd/MM/yyyy”
用于日期对象,所以我不认为Eval(“Data”)
code> 可以返回有效的日期格式。尝试删除 Format 函数并只保留Eval("Data")
,如果页面加载,您将看到它尝试用作日期的内容。有关背景信息,请参阅日期和时间时间格式字符串The first two lines of the stack trace should give you some hint. The 2nd line shows that an instance of the ASP.PMUsControl is attempting to bind to some set of data with a format being applied to a string value on the 1st line. That Expression is not valid which I suppose is because it can't be formatted and I would say that's because the string is null or the object can't be converted to a string. Can you find the data it is trying to bind to?
EDIT: That format string
"dd/MM/yyyy"
is for use with a Date object so I don't thinkEval("Data")
can be returning a valid Date to format. Try removing the Format function and just leaveEval("Data")
and if the page loads you'll get to see what it tried to use as a date. For background see Date & Time Format Strings