gpt4 book ai didi

c# - MVC 无法将 lambda 表达式转换为类型,因为它不是委托(delegate)

转载 作者:行者123 更新时间:2023-11-30 17:04:54 26 4
gpt4 key购买 nike

我想知道我是否可以这样做,或者有其他方法可以做到吗?我构建它没有问题,但是当我运行它时它说:

CS1660: Cannot convert lambda expression to type 'DevExpress.Web.Mvc.RoundPanelSettings' because it is not a delegate type

代码:

@Html.DevExpress().RoundPanel(RPsettings =>
{
RPsettings.Name = "rpnlNewUpdateConfigs";
RPsettings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
RPsettings.ShowHeader = false;
RPsettings.SetContent(() =>
{
Html.DevExpress().CallbackPanel(CBsettings =>
{
CBsettings.Name = "cbpnlNewUpdateConfigs";
CBsettings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
CBsettings.CallbackRouteValues = new { Controller = "Storage", Action = "Storage" };
CBsettings.SetContent(() =>
{
@<table>
<tr>
<td>
<table>
<tr>
<td>&nbsp;
</td>
<td>Type:
</td>
<td>
@Html.DevExpress().ComboBox(cboxsettings =>
{
cboxsettings.Name = "cbType";
cboxsettings.Width = 180;
cboxsettings.SelectedIndex = -1;
cboxsettings.Properties.ValueType = typeof(string);
cboxsettings.Properties.Items.Add("Path");
}).GetHtml();
</td>
<td>&nbsp;
</td>
</tr>
</table>
</td>
</tr>
</table>;
Html.DevExpress().Label(L1settings =>
{
L1settings.Name = "ErrorLabel1";
L1settings.Text = "Label1";
}).Render();
Html.DevExpress().Label(L2settings =>
{
L2settings.Name = "ErrorLabel2";
L2settings.Text = "Label2";
}).Render();
});
}).GetHtml();
});
}).GetHtml()

有什么猜测吗?

最佳答案

发现发生了什么。以这种方式在 SetContent() 中不允许使用 asp.net 标记。正确的做法是:

CBsettings.SetContent(() => {
ViewContext.Writer.Write("<h1>Hello World</h1>");

...

});

很遗憾智能感知没有给出错误的线索。

关于c# - MVC 无法将 lambda 表达式转换为类型,因为它不是委托(delegate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16941178/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com