方法'ToString'的重载没有接受'1'参数 [英] No overload for method 'ToString' takes '1' arguments

查看:115
本文介绍了方法'ToString'的重载没有接受'1'参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好..

我写了给定的代码,但出现错误方法'ToString'的无重载采用'1'参数",该行以粗体显示
anybory可以帮我改正吗..


hello ..

i write given code but i got error"No overload for method ''ToString'' takes ''1'' arguments" which displayed in bold line
can anybory help me to correct it..


<asp:TemplateColumn HeaderText="News Date" HeaderStyle-CssClass="dgHeaderItem">
                                       <HeaderStyle HorizontalAlign="Left" Width="25%"></HeaderStyle>
                                       <ItemStyle HorizontalAlign="Left" Width="25%"></ItemStyle>
                                       <ItemTemplate>
                                           <%#DataBinder.Eval(Container.DataItem,"newsdate").ToString(ConfigurationManager.AppSettings["DATE_FORMAT"].Replace("{0:", "").Replace("}", "")+ "," + ConfigurationManager.AppSettings["TIME+FORMAT"])%>
                                       </ItemTemplate>
                                   </asp:TemplateColumn>




谢谢..




Thank you..

推荐答案

narendrarathod写道:
narendrarathod wrote:

方法没有重载'' ToString''接受``1''自变量''

No overload for method ''ToString'' takes ''1'' arguments"





narendrarathod写道:
narendrarathod wrote:

DataBinder.Eval(Container.DataItem,"newsdate").ToString(ConfigurationManager.AppSettings ["DATE_FORMAT"].Replace("{0:,")

DataBinder.Eval(Container.DataItem,"newsdate").ToString(ConfigurationManager.AppSettings["DATE_FORMAT"].Replace("{0:", "")



错误本身是不言自明的.如果可以看到,则说明您正在执行以下操作:
abc.ToString(xyz.Replace())
这是错误的,不允许的.请更正此部分.



Error itself is self explanatory. If you can see, you are doing something like:
abc.ToString(xyz.Replace())
This is WRONG and not allowed. Please correct this part.


请查看 Eval [ ^ ].它返回一个对象.除了不带参数的对象之外,对象没有ToString的其他任何重载.

您需要先将对象转换为DateTime,然后才能访问正确的方法.
Look at the return type of Eval[^]. It returns an object. Object does not have any other overloads of ToString other than the one that takes no arguments.

You''ll need to cast your object to DateTime before being able to access the correct method.


这篇关于方法'ToString'的重载没有接受'1'参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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