[英]How do I add checkbox in 2sxc application razor view?
Multiple attempts to use few methods with different combinations of parameters don't work for me so far.到目前为止,多次尝试使用具有不同参数组合的几种方法对我不起作用。
@Html.CheckBox()
causes strange behaviour: I give it 2 parameters ( @Html.CheckBox(Html, "asdf")
) - it says that best extension method overload 'DotNetNuke.Web.Mvc.Helpers.HtmlInputExtensions.CheckBox
has 3 parameters ( 'DotNetNuke.Web.Mvc.Helpers.HtmlInputExtensions.CheckBox(DotNetNuke.Web.Mvc.Helpers.DnnHtmlHelper, string, bool)'
). @Html.CheckBox()
导致奇怪的行为:我给它 2 个参数( @Html.CheckBox(Html, "asdf")
) - 它说best extension method overload 'DotNetNuke.Web.Mvc.Helpers.HtmlInputExtensions.CheckBox
has 3参数( 'DotNetNuke.Web.Mvc.Helpers.HtmlInputExtensions.CheckBox(DotNetNuke.Web.Mvc.Helpers.DnnHtmlHelper, string, bool)'
)。 I give it 3 parameters ( @Html.CheckBox(Html, "asdf", true)
), it says then that best overload has 4 parameters.我给它 3 个参数( @Html.CheckBox(Html, "asdf", true)
),然后它说最好的重载有 4 个参数。 What is going on???到底是怎么回事???@Html.CheckBoxFor()
=> CS1501: No overload for method 'CheckBoxFor' takes 0 arguments
@Html.CheckBoxFor()
=> CS1501: No overload for method 'CheckBoxFor' takes 0 arguments
@Html.CheckBoxFor("asdf")
=> CS1061: 'ToSic.Sxc.Dnn.Web.IHtmlHelper' does not contain a definition for 'CheckBoxFor' and no extension method 'CheckBoxFor' accepting a first argument of type 'ToSic.Sxc.Dnn.Web.IHtmlHelper' could be found (are you missing a using directive or an assembly reference?)
. @Html.CheckBoxFor("asdf")
=> CS1061: 'ToSic.Sxc.Dnn.Web.IHtmlHelper' does not contain a definition for 'CheckBoxFor' and no extension method 'CheckBoxFor' accepting a first argument of type 'ToSic.Sxc.Dnn.Web.IHtmlHelper' could be found (are you missing a using directive or an assembly reference?)
。 What???什么??? Actually I've just given you a string parameter, not IHtmlHelper
.实际上我刚刚给了你一个字符串参数,而不是IHtmlHelper
。@System.Web.WebPages.Html.CheckBox("test")
causes error CS0234: The type or namespace name 'CheckBox' does not exist in the namespace 'System.Web.WebPages.Html' (are you missing an assembly reference?)
@System.Web.WebPages.Html.CheckBox("test")
导致错误CS0234: The type or namespace name 'CheckBox' does not exist in the namespace 'System.Web.WebPages.Html' (are you missing an assembly reference?)
How do I add checkbox here and paste its value in button url?如何在此处添加复选框并将其值粘贴到按钮 url 中?
I must say I never used this @Html.Checkbox but it's probably not supported on the built-in @Html object.我必须说我从未使用过这个 @Html.Checkbox 但它可能不受内置 @Html 对象的支持。 So anything with @System.Web.Webpages... etc. is probably the right way, but you must know that Razor in DNN uses an older version of MVC, probably v3 or something.因此,@System.Web.Webpages... 等的任何内容都可能是正确的方法,但您必须知道 DNN 中的 Razor 使用旧版本的 MVC,可能是 v3 或其他版本。
That could be part of the issue.这可能是问题的一部分。
Either way I simply suggest to quickly write the HTML to get this working :).无论哪种方式,我只是建议快速编写 HTML 以使其正常工作:)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.