Telerik Forums
UI for ASP.NET MVC Forum
3 answers
167 views
Hi guys, 
I don't know if I'm in the right section because my question is actually on datapager...but anyway..

I'd like to know if there any way to customize the appearance of the pager using mvc...
I remeber that in "normal" use I was able to set if to show pages number or just control or something like that..
I have the pager you see in the attached print, and I'd like to fix it so that it is rendered in just one line. (maybe removing page numbers, or showing just 5 instead of 10).

note that page size is set to 10 and has to remain like this.
Thanks
Fabio
Dimiter Madjarov
Telerik team
 answered on 06 May 2014
1 answer
201 views
Hi,

My search page showing list of employee in a grid and I want inline operation of grid.

My issue is :

Recently added data is not showing after "Save Changes" button clicked (It shows a copy of 1st record).
but  new data is appears after refresh button is clicked.

"Save change"  action is adding data perfectly.

Screenshot is attached 

Please see my code

cshtml
--------------------
@model TelerikMvc5App.ViewModel.EmployeeViewModel

@(Html.Kendo().Grid<TelerikMvc5App.ViewModel.EmployeeViewModel>()
    .Name("gridEmployee")
    .Columns(columns =>
    {
        columns.Bound(p => p.EmployeeId);
        columns.Bound(p => p.EmployeeName).Width(140);
        columns.Command(command => command.Destroy()).Width(110);
    })
    .ToolBar(toolbar =>
    {
        toolbar.Create();
        toolbar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable(pageable => pageable
                .Refresh(true)
                .PageSizes(true)
                .ButtonCount(5))
    .Navigatable()
    .Filterable()
    .Sortable()
    .Scrollable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Events(events => events.Error("error_handler"))
            .Model(model => model.Id(p => p.EmployeeId))
            .Create("CreateEmp", "Employee", new { Area = "Employee" })
            .Read("SearchEmp", "Employee", new { Area = "Employee" })
            .Update("SaveEmp", "Employee", new { Area = "Employee" })
            .Destroy("DeleteEmp", "Employee", new { Area = "Employee" })
    )
)

<script type="text/javascript">
    function error_handler(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }
</script>


Controller
---------------------------------

 public static List<EmployeeViewModel> empList = new List<EmployeeViewModel>();


private List<EmployeeViewModel> GetAllEmployees()
        {           
            empList.Add(new EmployeeViewModel() { EmployeeId = 1, EmployeeName = "Kumar" });
            empList.Add(new EmployeeViewModel() { EmployeeId = 2, EmployeeName = "Jaysankar" });
            empList.Add(new EmployeeViewModel() { EmployeeId = 3, EmployeeName = "Sathish" });
            empList.Add(new EmployeeViewModel() { EmployeeId = 4, EmployeeName = "Koushik" });
            empList.Add(new EmployeeViewModel() { EmployeeId = 5, EmployeeName = "Ramesh" });            
            return empList;
        }

public ActionResult Search()
        {
            if (empList.Count == 0)
            {
                GetAllEmployees();
            }
            return View();
        }

 public ActionResult SearchEmp([DataSourceRequest]DataSourceRequest request)
        {
            return Json(empList.ToDataSourceResult(request));
        }

 [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult CreateEmp([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<EmployeeViewModel> emps)
        {
            foreach (EmployeeViewModel emp in emps)
            {               
                empList.Add(emp);
            }
        return Json(empList.ToDataSourceResult(request));
        }

 [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult SaveEmp([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<EmployeeViewModel> emps)
        {  
                foreach EmployeeViewModel emp in emps)
                {
                    // some code
                }            }
            return Json(empList.ToDataSourceResult(request));
        }

 [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult DeleteEmp([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<EmployeeViewModel> emps)
        {
            if (emps.Any())
            {
                foreach (EmployeeViewModel emp in emps)
                {
                    var item = empList.First(x => x.EmployeeId == emp.EmployeeId);
                    empList.Remove(item);
                }
            }            
            return Json(empList.ToDataSourceResult(request));
        }

--------------------------------------------------


Thanks
Kumar
Alexander Popov
Telerik team
 answered on 06 May 2014
6 answers
297 views
Here is our ImageBrowser startup code:

$("#Html").kendoEditor({
    imageBrowser: {
        schema: {
            model: {
                id: "EntFileId",
                fields: {
                    name: "name",
                    type: "type",
                    size: "size",
                    EntFileId: "EntFileId"
                }
            }
        },
        transport: {
            read: "@Url.Action("Index", "EditorImageBrowser", new { area = "" })",
            destroy: {
                url: "@Url.Action("Delete", "EditorImageBrowser", new { area = "" })",
                type: "POST"
            },
            create: {
                url: "@Url.Action("Create", "EditorImageBrowser", new { area = "" })",
                type: "POST"
            },
            uploadUrl: "@Url.Action("Upload", "EditorImageBrowser", new { area = "" })"
        }
    }
});


From our MVC Controller, we are returning this model of object to the Read action of our ImageBrowser:

return Json(new { name = "Test1.jpg", type = "f", size = 10000, EntFileId = "23ebf087-c946-4cb8-9f9c-f2584dd9aadc" });

When the Read action receives that result, it puts all of those properties, including the EntFileId, on the image item created in the ImageBrowser. So when I loop through the items in the ImageBrowser by doing something like this:

var data = $(".k-imagebrowser").data("kendoImageBrowser").dataSource.data();
$.each(data, function (key, obj) {
    console.log(obj);
    //displays: i {_events: Object, name: "Test1.jpg", size: 10000, type: "f", EntFileId: "23ebf087-c946-4cb8-9f9c-f2584dd9aadc"…}
});

You can see that the EntFileId gets attached to the items.

Now, when we Upload a file, we are supposed to return the uploaded file object back to Kendo, so we return it like this:

return Json(new { size = uploadedFileSize, name = file.Name, type = "f", EntFileId = file.FileId.ToString() }, "text/plain");

I see in Developer Tools that the Upload action is definitely returning an object with the EntFileId, but for some reason, when that item is put into the ImageBrowser, it does not attach the EntFileId property to that item. So after the Upload action completes, and I do the same loop through the items in the ImageBrowser, the uploaded image looks like this in the Console:

i {_events: Object, type: "f", name: "402082_546613141879_2009325815_n.jpg", size: 30834, uid: "0bd12e68-8245-48fe-81e1-d123fc813415"…}

There is no EntFileId property for the item (even if you expand the object).

Why does the extra EntFileId property get attached from the Read action, but not when the object is returned from the Upload action? Can you help me understand what's going on and why there is a difference? Thank you.
JohnVS
Top achievements
Rank 1
 answered on 05 May 2014
4 answers
182 views
Hello,

I have an ajax bound grid and I have it set to be sortable.  But when I click a column heading all of the data in the grid disappears.  If I switch it to server binding the sorting works.  I need ajax binding because I am using a client detail template.  What am I missing??

Here is the view:

@model IEnumerable<PASS.ViewModels.Proposals.IndexViewModel>
 
@{
    ViewBag.Title = "My Proposals";
}
 
<h2>My Proposals</h2>
 
<br />
<p>@Html.ActionLink("Create New Proposal", "Create", null, new { @class="link-button" })</p>
 
@(Html.Kendo().Grid(Model)
    .Name("Proposals")
    .Columns(columns =>
    {
        columns.Bound(m => m.ID).Title("Proposal ID");
        columns.Bound(m => m.Title).ClientTemplate("<a href='" + Url.Action("Update", "Proposals") + "/#= ID #'>" + "#= Title #" + "</a>");
        columns.Bound(m => m.ProposalType).Title("Proposal Type");
        columns.Bound(m => m.PI);
        columns.Bound(m => m.User_Facility_ID).Title("User Facility");       
    })
    .Sortable()
    .ClientDetailTemplateId("template")
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(m => m.ID))
        .Read(read => read.Action("Index", "Proposals"))
    ))
 
<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().Grid<PASS.ViewModels.Proposals.TimeRequestsViewModel>()
        .Name("TimeRequests_#=ID#")
        .Columns(columns =>
        {
            columns.Bound(m => m.Cycle);
            columns.Bound(m => m.Status_Description).Title("Status");
        })
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("GetTimeRequests", "Proposals", new { proposalID = "#=ID#" }))
        )
        .Sortable()
        .ToClientTemplate()
)
</script>


Here are the relevant controller methods:

public ActionResult Index()
{
    int user_id = Convert.ToInt32(((Claim)((ClaimsIdentity)Thread.CurrentPrincipal.Identity).FindFirst(a => a.Type.Equals("UserID"))).Value);
 
    using (var context = new PASSEntities())
    {
        var vm = (from a in context.Proposals
                  join b in context.Proposal_Minions on a.ID equals b.Proposal_ID into j
                  from c in j.DefaultIfEmpty()
                  where (a.PI_User_ID == user_id || a.Creator_User_ID == user_id || (c.User_ID == user_id && c.Can_Read))
                  select new IndexViewModel()
                  {
                      ID = a.ID,
                      Title = a.Title,
                      ProposalType = a.Proposal_Types.Description,
                      PI_User_ID = a.PI_User_ID,
                      PI = (from d in context.Pools
                            join e in context.Users on d.ID equals e.Pool_ID
                            where e.ID == a.PI_User_ID
                            select d.First_Name + " " + d.Last_Name).FirstOrDefault(),
                      User_Facility_ID = a.User_Facility_ID
                  }).Distinct().OrderByDescending(a => a.ID).ToList();
 
        return View(vm);
    }
}
 
public ActionResult GetTimeRequests(int proposalID, [DataSourceRequest]DataSourceRequest request)
{
    using (var context = new PASSEntities())
    {
        var vm = (from a in context.Beamtime_Requests.ToList()
                  where a.Proposal_ID == proposalID
                  select new TimeRequestsViewModel()
                  {
                      ID = a.ID,
                      Proposal_ID = a.Proposal_ID,
                      Cycle = a.Cycle.Description + " " + a.Cycle.Year.ToString(),
                      Cycle_Requested_ID = a.Cycle_Requested_ID,
                      Status = a.Status,
                      Status_Description = a.Beamtime_Request_Statuses.Description
                  }).ToList();
 
        DataSourceResult result = vm.ToDataSourceResult(request);
        return Json(result, JsonRequestBehavior.AllowGet);
    }
}

Stephen
Top achievements
Rank 1
 answered on 05 May 2014
0 answers
215 views
Hi,

dropdown is not populating data while inline edit of grid
Search.cshtml
-------------
@model TelerikMvc5App.ViewModel.EmployeeViewModel
@(Html.Kendo().Grid<TelerikMvc5App.ViewModel.EmployeeViewModel>()
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.EmployeeId).Width(50);
        columns.Bound(p => p.EmployeeName).Width(140);
        columns.Bound(p => p.DateOfBirth).Width(100);
        columns.Bound(p => p.GenderId).Width(100);
        columns.Bound(p => p.MariatalStatusId).Width(110).EditorTemplateName("_MariatalStatusPartial").ClientTemplate("#:MariatalStatus#");
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
    })
         .ToolBar(toolbar => toolbar.Create())
        .Editable(editable => editable.Mode(GridEditMode.InLine))
                  .Selectable(s => s.Enabled(true)
                                    .Type(GridSelectionType.Row)
                                    .Mode(GridSelectionMode.Single))
    .Pageable(pageable => pageable
                .Refresh(true)
                .PageSizes(true)
                .ButtonCount(5))
    .Navigatable()
    .Filterable()
    .Sortable()
    .Scrollable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
            .Events(events => events.Error("error_handler"))        
                   .Model(model =>
                    {
                        model.Id(p => p.EmployeeId);
                        model.Field(p => p.EmployeeId).Editable(false);
                        model.Field(p => p.MariatalStatusId);
                    })

            .Create("CreateEmp", "Employee", new { Area = "Employee" })
            .Read("SearchEmp", "Employee", new { Area = "Employee" })
            .Update("SaveEmp", "Employee", new { Area = "Employee" })
            .Destroy("DeleteEmp", "Employee", new { Area = "Employee" })
    )
)
<script type="text/javascript">  

    function error_handler(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }
</script>
--------------------
_MariatalStatusPartial.cshtml
----------------------------
@model TelerikMvc5App.ViewModel.EmployeeViewModel
@Html.Kendo().DropDownListFor(m => m.MariatalStatusId).DataTextField("Text").DataValueField("Value").DataSource(ds => ds.Read(r => { r.Action("GetMariatalStatus", "Employee", new { Area = "Employee" }); })).OptionLabel("Select Marital Status")


------------------
controller
-----------------------
 public ActionResult Search()
        {
            if (empList.Count == 0)
            {
                GetAllEmployees();
            }

            return View();
        }
 public JsonResult GetMariatalStatus()
        {
            List<SelectListItem> mariatalStatusList = new List<SelectListItem>();
            mariatalStatusList.Add(new SelectListItem { Text = "Single", Value = "1" });
            mariatalStatusList.Add(new SelectListItem { Text = "Married", Value = "2" });
            mariatalStatusList.Add(new SelectListItem { Text = "Others", Value = "3" });
            return Json(mariatalStatusList, JsonRequestBehavior.AllowGet);
        }

 private List<EmployeeViewModel> GetAllEmployees()
        {           
            empList.Add(new EmployeeViewModel() { EmployeeId = 1, EmployeeName = "Kumar", GenderId=1, MariatalStatusId=1 , MariatalStatus="Single" });
            empList.Add(new EmployeeViewModel() { EmployeeId = 2, EmployeeName = "Jaysankar", GenderId = 2, MariatalStatusId = 2, MariatalStatus = "Married" });
            empList.Add(new EmployeeViewModel() { EmployeeId = 3, EmployeeName = "Sathish" });
            empList.Add(new EmployeeViewModel() { EmployeeId = 4, EmployeeName = "Koushik" });
            empList.Add(new EmployeeViewModel() { EmployeeId = 5, EmployeeName = "Ramesh" });            
            return empList;
        }
------------

----------------
 public class EmployeeViewModel
    {
        public string EmployeeName { get; set; }
        public int? EmployeeId { get; set; }        
        
        public string LastName { get; set; }
        [Display(Name = "Gender")]
        [Required(ErrorMessage = "Gender is Required.")]
        public int GenderId { get; set; }
        [Display(Name = "Gender")]
        public string Gender { get; set; }

        [Display(Name = "Marital Status")]
        [Required(ErrorMessage = "Mariatal Status is Required.")]
        public int? MariatalStatusId { get; set; }

        [Display(Name = "Marital Status")]
        public string MariatalStatus { get; set; }

        [Display(Name = "Date Of Birth")]
        [Required(ErrorMessage = "Date Of Birth is Required.")]
        [DataType(DataType.Date)]      
        public DateTime? DateOfBirth { get; set; }
        
        [Display(Name = "Cell")]
        [Required(ErrorMessage = "Cell is Required.")]
        public string Cell { get; set; }


    }

Thanks
Kumar
Kumar Bharat
Top achievements
Rank 1
 asked on 05 May 2014
1 answer
192 views
Hello,

I'm a bit new to the MVC pattern and the Telerik ASP.NET MVC controls.  I've been working with ASP.NET Ajax for years now, but not the MVC stuff.  I finally had the opportunity to work on something MVC based, and find myself stuck already.  

I have a hierarchical menu driven by a stored procedure.  The procedure basically removes / disables items that a user doesn't have rights to based on a role and other information that's passed into the proc.  I'd like to implement its use in a partial view, but cant' for the life of me figure this out.  This may be more of a MVC question than a Menu specific question, but anyone can point me at an example that would be awesome.  

I've tried the sample applications generated by the Telerik template, but that uses a static menu in the _Layout file.  Not exactly what I want.

Thank you for your help!

Alex T.
Alex Gyoshev
Telerik team
 answered on 05 May 2014
6 answers
1.4K+ views
I am using asp.net mvc grid with server wrappers and have 4 cascading dropdowns by utilizing custom editors.  I am using inline editing with the grid.  The grid is ajax and the dropdowns also get their data via ajax/json.

I am experiencing 2 symptoms which may or may not be related to the same problem:

1) When a change is made to the first dropdown, it's value is updated correctly in the database but the grid does not refresh.  I found this article but it didn't correct my issue. Simply hitting refresh on the page shows the new/correct value.  

2) The dropdowns are cascading correctly (ie when one is changed, the others get the correct choices).  However, only the first dropdown (not the cascaded ones) are updated correctly in the database.  The other's values are not updated.

Here's the Controller code that does the update:
01.public ActionResult UpdateUnitListItemViewModel([DataSourceRequest] DataSourceRequest request, UnitListItemViewModel unitListItemViewModel)
02.        {
03.            if (ModelState.IsValid)
04.            {
05.                // Map a unit and save it
06.                Unit unit = UnitRepository.GetUnit(unitListItemViewModel.UnitID);
07.                
08.                unit.Property.StatusID = unitListItemViewModel.PropertyStatusID;
09.                unit.Property.SubStatusID = unitListItemViewModel.PropertySubStatusID;
10. 
11.                unit.StatusID = unitListItemViewModel.UnitStatusID;
12.                unit.SubStatusID = unitListItemViewModel.UnitSubStatusID;
13. 
14.          
15.                    PropertyRepository.Update(unit.Property, LoggedInUser.UserID);
16.                    UnitRepository.Update(unit, LoggedInUser.UserID);
17.               
18.            }
19.            return Json(new[] { unitListItemViewModel }.ToDataSourceResult(request, ModelState));
20.  
21.        }
Here's the grid cshtml:
01.@(Html.Kendo().Grid<ARPS.OpsPortal.Models.UnitListItemViewModel>()
02.      .Name("Grid")
03.      .DataSource(datasource => datasource
04.            .Ajax()
05.            .Group( group => group.Add(c => c.MarketName))
06.            .Sort( sort => sort.Add("FormattedAddress").Ascending())
07.            .Read(read => read.Action("GetUnitListItemViewModels", "Property"))
08.            .Update(update => update.Action("UpdateUnitListItemViewModel","Property"))
09.            .Model(model => model.Field(p => p.FormattedAddress).Editable(false))
10.            .Model(model => model.Field(p => p.Name).Editable(false))
11.            .Model(model => model.Id(u => u.UnitID))
12.      )
13.      .Columns(columns =>
14.      {
15.          columns.Bound(u => u.FormattedAddress).Title("Address");
16.          columns.Bound(u => u.Name).Title("Unit");
17.          columns.Bound(u => u.PropertyStatusName).Title("Property Status");
18.          columns.Bound(u => u.PropertySubStatusName).Title("Property Sub Status");
19.          columns.Bound(u => u.UnitStatusName).Title("Unit Status");
20.          columns.Bound(u => u.UnitSubStatusName).Title("Unit Sub Status");
21.          columns.Bound(u => u.AssignedUserInitials).Title("User");
22.          columns.Command(command => command.Edit());
23.      })
24.     .Editable(editable => editable.Mode(GridEditMode.InLine))
25.     .Pageable()
26.     .Sortable()
27.)
Here's custom editor along with javascript:

01.@(Html.Kendo().DropDownList()
02.        .Name("PropertySubStatusID")
03.        .HtmlAttributes(new { style = "width:150px" })
04.                   
05.        .DataTextField("Name")
06.        .DataValueField("StatusID")
07.        .DataSource(source => {
08.            source.Read(read =>
09.            {
10.                read.Action("GetActiveSubStatuses", "Status")
11.                    .Data("filterPropertySubStatuses");
12.            })
13.            .ServerFiltering(true);
14.        })
15.        .Enable(true)
16.        .SelectedIndex(0)
17.        .AutoBind(false)
18.        .CascadeFrom("PropertyStatusID")
19.         
20.)
21. 
22.<script type="text/javascript">
23. 
24.    function filterPropertySubStatuses() {
25.        return {
26.            StatusID: $("#PropertyStatusID").val()
27.        };
28.    }
29. 
30.</script>
Petur Subev
Telerik team
 answered on 02 May 2014
1 answer
511 views

I have the following code to bind a DropDownList for the Status property of a User Model. The Status is an enum.

The DropDownList for the first user (row 1 in the table) is rendered correctly - however subsequent rows the DropDownList is not rendered - it is rendered as an empty text box. If I use 'Vanilla Razor' DropDownList then the controls are rendered correctly - what is wrong?

Thanks 

Ian

@model IEnumerable<CLOCS.Models.ApplicationUser>
 
@{
    ViewBag.Title = "Index";
}
 
<h2>Index</h2>
 
<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.UserName)
        </th>
        <th>
 
        </th>
    </tr>
 
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.UserName)
                
                 
            </td>
            @*<td>
                @Html.EnumDropDownListFor(modelItem => item.Status)
            </td>*@
            <td>
                @Html.Kendo().DropDownListFor(modelItem => item.Status).BindTo(EnumHelper.GetSelectList(item.Status.GetType()))
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                @Html.ActionLink("Details", "Details", new { id = item.Id }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.Id })
            </td>
        </tr>
    }
 
</table>
Atanas Korchev
Telerik team
 answered on 02 May 2014
2 answers
330 views
I am using asp.net mvc4 using kendo ui to complete my project i have few textboxes which should is hidden and it should only be enable when there is no record for the studentID . I am using autocomplete when a user enters the studentid then it searches the existing ids but i want to customize it so that if there is a unique id then only textboxes will be enable i am new here in asp.net mvc so please help me out help would be appreciated thanks
Kumar Bharat
Top achievements
Rank 1
 answered on 02 May 2014
2 answers
318 views
I am trying to conditionally disable fields in a grid popup editortemplate based on a value in the passed in Model.  The value is correct in the model if I use an Html helper like a hidden field, but if I try to access it using razor code it is not there.  I assume this has to do with the order of how things are loading but I'mm not sure how to fix it.  Here is the editortemplate code:

@model PASSAdmin.ViewModels.ResourceReviewer.ResourceReviewViewModel
 
@{
    bool disabled = true;  
    if (Model.Status == "BLREV")
    {
        disabled = false;
    }
}
 
@Html.HiddenFor(model => model.Beamline_Request_ID, Model.Beamline_Request_ID)
@Html.HiddenFor(model => model.Status, Model.Status)
 
<div class="editor-container" style="width:700px;">
 
    <p>Please provide your recommendation of the experiment described in this Beam Time Request with regard to feasibility and safety.</p>
 
    <div>
        <div class="editor-label">
            @Html.Label("Approve")
        </div>
        <div class="editor-field">
            @if (disabled)
            {
                @Html.RadioButtonFor(model => model.Refused_By_Beamline, "N", new { disabled = true })
            }
            else
            {
                @Html.RadioButtonFor(model => model.Refused_By_Beamline, "N")
            }
        </div>
 
        <div class="editor-label">
            @Html.Label("Deny")
        </div>
        <div class="editor-field">
            @if (disabled)
            {
                @Html.RadioButtonFor(model => model.Refused_By_Beamline, "Y", new { disabled = true })
            }
            else
            {
                @Html.RadioButtonFor(model => model.Refused_By_Beamline, "Y")
            }
        </div>
    </div>
 
    <br class="clear" />
    <br />
    <br />
 
    <p>By selecting Approve you are signifying the Experiment is feasible and can be performed safely on the indicated Beamline. If you select to Deny any of the above, please provide an explanation in the Comments area below. In addition to any specific comments, it is suggested you make note of any particular beamline equipment to be used during this experiment.  Other staff may not have access to the full proposal information, but will have access to these comments.</p>
 
    @*
    <div class="editor-label">
        @Html.Label("Comments")
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Refused_By_Beamline, "N")
        @Html.ValidationMessageFor(model => model.Refused_By_Beamline)
    </div>
    *@         
    <p>Note: comments entered here are visible to the Principal Investigator</p>
 
</div>

When I view the source I can see that the hidden for Model.Status has the correct value but when I try to set the razor variable so I can use it to display the fields disabled, it does not have the value at all.

What am I missing? 








Stephen
Top achievements
Rank 1
 answered on 01 May 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?