I need to add a look up button next to the text field and have create an editor template in order for this to work in edit mode.
But i'm not able to bind the editor template against the grid model. Once I have changed the value in editortemplate and exit edit mode
the value shows object object in the textfield. How can the editor template be bound the the grid Model? Do i have to popuplate the editortemplate ongridedit and repopulate the main textbox in grid on gridsave?
Below is the code snippet from my grid and editor template:
if (Model.IsEditMode)
{
columns.Bound(dto => dto.PipingSpoolId)
.ClientTemplate("<input id='chkRow' class='grid-checkbox gridrow-checkbox' type='checkbox' value='<#= PipingSpoolId #>' onchange='' />")
.HeaderTemplate("<input id='chkAllRows' class='grid-checkbox' type='checkbox' onchange='ProCoSys.grideditable.toggleAllRows()' />")
.HtmlAttributes(new {align = "center"})
.HeaderHtmlAttributes(new {style = "text-align:center"})
.Width(30).ReadOnly();
columns.Bound(dto => dto.IsoDrawing).Width(75).Title(CompletionStrings.PipingSpoolGrid_IsoDrawing).
EditorTemplateName("EditTextFieldWithLookup");
}
EditTextFieldWithLookup
@using Statoil.ProCoSysNextGen.Web.ViewHelpers.Lookup
@model Statoil.ProCoSysNextGen.Web.Controllers.Completion.ViewModels.McPkgPipingSpoolsViewModel
@{
var guidId = Guid.NewGuid().ToString();
@Html.TextBox(guidId, @Model).Lookup(LookupType.TAG);
}
Regards
Son