C# 扩展名HTMLHelper的文本框

C# 扩展名HTMLHelper的文本框,c#,.net,asp.net-mvc,html-helper,C#,.net,Asp.net Mvc,Html Helper,我在页面上有一个文本框: <%= Html.TextBox("EffectiveDate", Model.EffectiveDate.HasValue ? Model.EffectiveDate.Value.ToString("dd-MMM-yyyy") : "", new { @class = "economicTextBox", propertyName = "EffectiveDate", onchange = "parseAndSetDt(this); ", dataType =

我在页面上有一个文本框:

<%= Html.TextBox("EffectiveDate", Model.EffectiveDate.HasValue ? Model.EffectiveDate.Value.ToString("dd-MMM-yyyy") : "", new { @class = "economicTextBox", propertyName = "EffectiveDate", onchange = "parseAndSetDt(this); ", dataType = "Date" })%>

但是,如果当前日期被禁用,我该如何填充它呢?

如果我读对了,您只想在无权限的情况下将当前日期作为值传递,而不是传递到TextBoxWithPermission中的值

// the user has no permission => render a readonly checkbox
var mergedHtmlAttributes = new RouteValueDictionary(htmlAttributes);
mergedHtmlAttributes["disabled"] = "disabled";
return htmlHelper.TextBox(name, DateTime.Now, mergedHtmlAttributes);
// the user has no permission => render a readonly checkbox
var mergedHtmlAttributes = new RouteValueDictionary(htmlAttributes);
mergedHtmlAttributes["disabled"] = "disabled";
return htmlHelper.TextBox(name, DateTime.Now, mergedHtmlAttributes);