mvccontrib-grid

MVCContrib Grid - Sort(GridSortOptions, prefix) not generating links for sorting

萝らか妹 提交于 2019-12-25 01:55:41
问题 I'm trying to use two grids in the same page and following what I found here: http://mvccontrib.codeplex.com/workitem/7032 Has anyone else had a problem with the Sort() method not generating links? The sorting was working before but it was sorting both grids the same way. The only thing I have changed is added the Bind attributes as the page above instructs and added the prefix to the call to Sort. 回答1: So the mvccontrib grid code checks if the SortOptions has been populated and if the column

How to style rows in the MVCContrib Grid based on their data?

守給你的承諾、 提交于 2019-12-20 10:41:16
问题 I am tinkering with the MVCContrib Grid and am stuck on how to format a row of data in the grid based on the data. For example, say we have a grid of products, where each product has data fields like name, price, and discontinued. I'd like to highlight all product rows that are discontinued. One workaround would be to use jQuery on the client-side to apply a CSS class to those rows where the discontinued cell is TRUE, but that seems like a brittle solution. I'm hoping there's a way to do it

mvccontrib grid - How to add <tr> id

故事扮演 提交于 2019-12-14 04:20:01
问题 I want to add an id to the "tr" elements of the mvccontrib grid I build: <tr id="0"/> <tr id="1"/> so if the table contains 10 rows, the ids are 0 through to 9. One way is to add an additional item to my entity to store this value and then create this as a hidden column with the id as the value of this item - not very elegant. Is there a more elegant way to do this? Thanks I've got this far but now it complains at the RenderUsing line, any ideas? @model IEnumerable<Tens.Models

Error in MVC contribgrid regarding identifier excepted

梦想的初衷 提交于 2019-12-13 20:08:51
问题 i am using mvc 2 and mvc contribgrid I am Getting error as "Newline is constant","identifier expected",";excepeted" here is my coding <table cellpadding="0" cellspacing="0" width="100%"> <% if (ViewData["CustomerInfoList"] !=null && ((List<SaasModel.CustomerInfo>)ViewData["CustomerInfoList"]).Count()>0) { %> <tr> <td> <% Html.Grid((List<SaasModel.CustomerInfo>)ViewData["CustomerInfoList"]).Columns( column=> { column.For(col=>col.CustomerName).Named("Name"); column.For(col=>col.CompanyName)

Bind MvcContrib grid contents to view model on postback

眉间皱痕 提交于 2019-12-13 01:43:07
问题 A form in my MVC4 application shows order information. The model for the view is OrderViewModel. It has a property Orderlines which is a collection of order lines. I'm using MvcContrib Grid to show the order lines. When the form is submitted, the following controller method executes: [HttpPost] public ActionResult PlaceOrder(OrderViewModel model) { ... } My problem is that the Orderlines property is always null in the incoming model parameter. Other fields like customer name are bound from

OnClick event on button in MvcContrib Grid column not working

爱⌒轻易说出口 提交于 2019-12-11 20:46:22
问题 I am new to mvc.I am using MvcContrib Html.Grid in my MVC 2 project.I have an existing Html.Grid where I have to added a new column with a button in it. The button will be enabled/disabled bsed on the "status" column in the grid. I managed to get the button in the column and enable/disable it based on the "status" column. Here's the code: column.For(c => c.Status == "Complete" ? "<input type=\"button\" value=\"PDF\" onClick=\"\" >" : "<input type=\"button\" value=\"PDF\" onClick=\"\" disabled

Asp.net MVC GridView edit columns option

让人想犯罪 __ 提交于 2019-12-11 06:18:52
问题 I have the view : <%= Html.Grid(Model.data).Columns(column => { column.For(x => x.results) .Action(item => Html.ActionLink(item.results,"Edit").ToString(), item => Html.TextBox("result",item.results).ToString(), item => (Model.data == item)) .Named("Results"); column.For(x => x.refId) .Named("Reference ID"); column.For(x => x.fileLocation) .Named("File Location"); }) .Attributes(style => "width:100%", border => 1) And the controller looks like: public ActionResult Index() { // IEnumerable

Problem with razor view and mvccontrib grid pagination

为君一笑 提交于 2019-12-10 19:03:49
问题 I have the following partial view code @model IEnumerable<PDoc.Web.Models.UserDocModel> @using MvcContrib.UI.Grid; @using MvcContrib.UI.Pager; @using MvcContrib.Pagination; <div id="docList"> @Html.Grid(Model).Columns( column => { column.For( u => u.Description ).Named( "Description" ); column.For( u => u.FileName ).Named( "File name" ); column.For( u => u.FileSize ).Named( "Size" ); column.For( u => u.UploadDate.ToShortDateString() ).Named( "Upload Date" ); } ).Attributes( @class => "table

How to make a pager with MVCContrib and Razor?

℡╲_俬逩灬. 提交于 2019-12-10 19:03:28
问题 I have a pager as follows: @using MvcContrib.UI.Pager @model MvcContrib.Pagination.IPagination <p/> @Html.Pager(Model).First("First").Last("Last").Next("Next").Previous("Previous") <p/> Instead of displaying this: Showing 1 - 10 of 10841 First | Previous | Next | Last It displays this: <div class='pagination'><span class='paginationLeft'>Showing 1 - 10 of 10841 </span><span class='paginationRight'>First | Previous | <a href="/Home/Events?page=2">Next</a> | <a href="/Home/Events?page=1085"

Overriding the default 'No Data' Message in MVCContrib Grid

岁酱吖の 提交于 2019-12-10 10:19:42
问题 Is it possible to override the default 'There is no Data available' message in MVCContrib Grid with a custom message? 回答1: <%= Html.Grid<SomeModelType>(Model) .Empty("Some custom message") ... %> 来源: https://stackoverflow.com/questions/3986528/overriding-the-default-no-data-message-in-mvccontrib-grid