how to solve use this :
public static IHtmlContent CpaKendoComboBoxFor<TModel, TProperty>(this IHtmlHelper<TModel> htmlHelper,
Expression<Func<TModel,TProperty>> expression, string inputId, object htmlAttributes = null)
{
var propertyId = string.Join("_", expression.Body.ToString().Split('.').Skip(1));
StringBuilder result = new StringBuilder();
result.Append( htmlHelper.Kendo().TextBoxFor(expression).HtmlAttributes(htmlAttributes).ToHtmlString());//error null reference
var spanEditBtn = new TagBuilder("span");
spanEditBtn .MergeAttribute("name", TagBuilder.CreateSanitizedId("btnEdit" + propertyId, ""));
spanEditBtn .GenerateId("btnEdit" + propertyId , "");
spanEditBtn .AddCssClass("k-icon k-edit-value k-i-edit");
spanEditBtn .MergeAttribute("style", "padding-left: 40px;display: flex;");
spanEditBtn .MergeAttribute("role", "button");
spanEditBtn .MergeAttribute("unselectable", "on");
// spanEditBtn .MergeAttribute("onclick", "editTextBoxKendo('" + propertyId + 2 + "')");
//spanEditBtn .InnerHtml.AppendHtml(spanClearIcon);
//spanWidget.InnerHtml.AppendHtml(spanEditBtn );
result.Append(spanEditBtn .ToHtmlString());
// var str = String.Format(combobox.ToString()+ spanEditBtn .ToString());
return htmlHelper.Raw(result.ToString());
}
when use @Html.CpaKendoComboBoxFor(model => model.id, nameof(Model.id) + ViewData["FG"])
show error null reference.
add new answer for "add icon to input kendo combobox with custom html helper"