且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

方法'ToString'的重载没有接受'1'参数

更新时间:2023-02-14 19:08:55

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.