MVC :: Sorting In Mvccontrib Html.grid In Application

Feb 2, 2011

I have done listing by using html.grid in my mvc application, need to do sorting How can i do that

View 4 Replies


Similar Messages:

Auto Generate Grid Using Mvccontrib By Passing Datatable In MVC 2 Application

Jul 6, 2010

In My project i want to use the mvccontrib [URL] to auto generate grid by passing the DataTable to the Grid. Currently Grid does not support this. Grid takes IEnumerable(Of T) and auto generate columns. Is their any way i can achieve this by passing DataTable. Or How do i convert the DataTable to IEnumerable(Of T). My DataTable is completely Dynamic i don't know number of columns or names of the columns at design time. DataTable completely dynamic number of columns are not fixed it just any DataTable. In Short i want to convert Dynamic DataTable to IEnumerable(Of T). Or Is their any better way.

1) One way i tried is using .net 4.0 Dynamic, DynamicObject and ExpandoObject I created a dynamic class as shown here [URL]. I trid passing IEnumerable(Of SampleDynamicObject) but BuildColumns() method is not able to find out the proprieties dynamically added on to it.

2) I think Second way to modify the AutoGenerateColumns() method to work with DataTable, But it looks impossible as Grid Get initialize using IEnumerable(Of T) and all the call on grid for method is using IEnumerable(Of T). So it's come down to converting DataTable to IEnumerable(Of T) and my DataTable are dynamic i don't know their structure at design time So i can't write any specific class to create a object and convert DataTable to IEnumerable(Of T).

View 1 Replies

MVC :: Html Helper Data Grid - Sorting Columns Using Post?

Jul 22, 2010

I've been asked to take over a project that's filled with a bunch of bugs. It's currently using MVC 1.0 and there's a view with Html Helper Data Grid that uses a DataGridHelper class. I'm not that familiar with all of MVC yet, and I was wondering if it is possible to have the sorting of the columns be a POST event rather than a GET.

Currently when a user clicks a column to sort, the controller for the view calls the GET action method. This I guess is all fine and good, but the problem is that this view has a search form (which is a model in it's own right) with some text boxes and some drop down lists. When the GET action method is called, I lose all of the information in the search criteria. So when ever someone searches for something, but then wants to sort the results, it requries the db for all records (because all of the search criteria is cleared).

I guess there could be two solutions:

1) Is there a way to access the items in the search form / model in the GET portion of the action method? I've tried using ViewData or adding a parameter for the search form model, but (and maybe I'm doing it wrong) both return null.

2) Is there a way to make the sorting event of a column call the POST portion of the action method? That way I'll have the search form / model information and be able to sort the search result content instead of query for all records.

Also, there is a stored procedure that currently can handel all of possible search parameters. So, no matter what sort column is selected, or search parameters are entered, it can properly setup the sql query.

View 6 Replies

MVC :: Security Exception When Using MVCcontrib Grid On Server

Jun 21, 2010

I am using MVCcontrib grid in my application. Everything works fine on my dev machine. When I publish it to the server and navigate to the page that renders the grid I am getting this error Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. and the source of the error is shown as <%= Html.Grid(Model).Columns(column => {i have added

[Code]....

to the web.config but still&nbsp;get the error&nbsp;

&nbsp;
</textarea></p>
<input type='hidden' name='ID[9]' value='93970' />
<input type='hidden' name='URL[9]' value=[URL]/>
<input type='hidden' name='CAT[9]' value='DataSource Controls' />
<input type='hidden' name='BOARD[9]' value='microsoft' />
<input type='hidden' name='P_DATE[9]' value='Jan 12, 2010 09:43 PM' />
<input type='hidden' name='RANDOM[9]' value='BcIlUOXzN' />
<input type='hidden' name='REPLIES[9]' value='3' />
<input type='hidden' name='USER[9]' value='aziz' />
<p><input class=subject type='text' size='90' name='SUBJECT[9]' value='DataSource Controls :: LINQ using stored procedures and MvcContrib Grid with pagination' /><select name='INDEXED[9]'><option value='1' selected>UPDATE</option><option value='2'>DELETE</option></select>Jan 12, 2010 09:43 PM - Replies: 3 CAT: DataSource Controls<a target=_blank href=[URL]>View</a></p>
<p> <textarea rows=10 cols=100 name='POST[9]' onfocus='setSelRange(this, 0, 0)'/>All,

I have been chasing this erorr all day and coming up blank.&nbsp; I created a stored proceudre(fairly complicated logic), added it to the context, and set the return type to a specific entity type.

It generated this:

&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;
[Function(Name="dbo.usp_ServiceTemplateSelectByFkID")]
public ISingleResult<ServiceTemplate> usp_ServiceTemplateSelectByFkID([Parameter(Name="FkId", DbType="Int")] System.Nullable<int> FkId)
{
&nbsp;&nbsp;&nbsp; IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), FkId);
&nbsp;&nbsp;&nbsp; return ((ISingleResult<ServiceTemplate>)(result.ReturnValue));
}

I call it from my service with the following method:

public ISingleResult<ServiceTemplate> GetByFkId(int FkId)
{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Db.usp_ServiceTemplateSelectByFkId(FkId);
}

I have tested the stored procedure and it returns the results I want.&nbsp; When I make the service call from the controller, it doesn't error out, however, it should return 4 records in this instance and instead, it returns the same 4 records (repeating the first record 4 times).&nbsp;.........

View 4 Replies

MVC :: How To Add Maxlength Attribute To MVCContrib Grid Column

Nov 16, 2010

i am working in mvc & using MVCContrib grid to show result in grid format.

I want to add restriction to 1 of the grid columns as not to accept more than 3 characters.

how can i add "maxlength" attribute to MVC Contrib grid column.

Or if any other way

View 1 Replies

Overriding The Default 'No Data' Message In MVCContrib Grid?

Oct 21, 2010

Is it possible to override the default 'There is no Data available' message in MVCContrib Grid with a custom message?

View 1 Replies

DataSource Controls :: LINQ Using Stored Procedures And MvcContrib Grid With Pagination?

Jan 12, 2010

I have been chasing this erorr all day and coming up blank. I created a stored proceudre(fairly complicated logic), added it to the context, and set the return type to a specific entity type.

It generated this:

[Function(Name="dbo.usp_ServiceTemplateSelectByFkID")]
public ISingleResult<ServiceTemplate> usp_ServiceTemplateSelectByFkID([Parameter(Name="FkId", DbType="Int")] System.Nullable<int> FkId)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), FkId);
return ((ISingleResult<ServiceTemplate>)(result.ReturnValue));
}

I call it from my service with the following method:

public ISingleResult<ServiceTemplate> GetByFkId(int FkId)
{
return Db.usp_ServiceTemplateSelectByFkId(FkId);
}

I have tested the stored procedure and it returns the results I want. When I make the service call from the controller, it doesn't error out, however, it should return 4 records in this instance and instead, it returns the same 4 records (repeating the first record 4 times).

In addition, in my controller code, I am using the MVCContrib ToPagedList() method which doesn't appear to work with the ISingleResult interface (forward only cursor, I'm guessing). I have attempted converting the service results to IQuery, List, and Array, however, I still have the problem with the first record being repeated 4 times.

View 3 Replies

Style The MvcContrib Grid Pager To Just Show "1 2 3 4 ..." For Paging?

Aug 24, 2010

Is it possible to style the MvcContrib Grid pager to just show "1 2 3 4 ..." for paging?

View 1 Replies

C# - Paging And Sorting Grid In MVC

Jul 27, 2010

I'm trying to implement a paging and sorting list in ASP.NET MVC without using MVContrib grid or javascript (needs to be seo friendly). I have constructed my action with the following signature: ActionResult List(int? page, string sort, string direction); The problem I have though is getting both the paging and the sorting to work. Say for example I have the following code: <%= Html.ActionLink("Title", "List", new { sort = "Title", direction = "ASC" }) %> I hoped this would generate a url containing all of the existing route values (including the current page) but it doesn't. Therefore when you click on the link the page is set back to null.

I have looked at all the overloads for the ActionLink helper but nothing looks like it will help. What I effectively need to do is generate a url/link with the existing page value (or potentially any other route values) and the new sort parameters.

View 3 Replies

Grid View Page Wise Sorting?

Nov 18, 2010

I got here a answer to sort the gridview. sorting and paging with gridview asp.net But using the above solution all the grid data sorted while clicking on the any column. I request a solution which sorts data on the particular page only. Suppose I have 10 pages with 50 records each page, now if I visit page 7 and sort then the only 50 records of the page 7 should be sorted.

View 1 Replies

Ajax Enabled Sorting And Paging On Grid?

May 13, 2010

Is there any good solution for ajax enabled Grid with pageing and sorting which only brings the required data from database? I mean it should only bring the data from the database which is to be displayed on the particular page number of the grid.

I looked at this. It looks good. But I just thought if anyone has created something better using Google's or Yahoo's javascript library or using any good features of asp.net 3.5.

View 3 Replies

Implement Javascript Sorting In A Grid View?

Feb 17, 2010

How can I accomplish gridview sorting in client browser using javascript ? without using inbuilt gridview sorting method. I really dont want the gridview to go to the DB each time while sorting.

View 1 Replies

Forms Data Controls :: Grid Sorting In The Database

Jun 21, 2010

When i try sorting in the database, it sorts the numbers:

1
102
2
304
305
4
4 Rev 01
etc....

but i want to have it sorted like:

1
2
4
4 Rev 01
102
304
305

What must i do to make it so? I just use a normal datagrid with sorting capabilities enabeld. Data type is varchar.

View 13 Replies

Web Forms :: Grid View Without Any Data Source Date Sorting?

Dec 13, 2010

i grid view contain the following coloum

id name DateofBirth DateofJoining

1 a 22-Aug-1980 10-jan-2000

1 a 22-may-1980 20-feb-2000

1 a 12-Feb-1980 15-mar-2000

1 a 3-Aug-1980 7-jan-2000

how to sort if we click DateofBirth or Dateofjoining and not sort any where if we click(Id,Name)

View 6 Replies

Forms Data Controls :: Implementing Sorting In Grid View?

May 13, 2010

how to implementing sorting in grid view..... iam using allowsorting=true property.... bt it sorting will not perform on boundedfileds..then i implement Onsortingevent.. bt what is the code for that.... and code for changing sort direction..

View 3 Replies

Forms Data Controls :: Grid Sorting When Column Is Determined During RowDataBound?

Mar 3, 2011

I have a Gridview with a templated column which contains just a label.

I set the Label1.text during GridView1.RowDataBound based on doing a DataBinder.Eval(e.Row.DataItem,"myColumn") and a calculation off that.

When the user clicks the header I want it to sort based on what's in the Label but instead if seems to be sorting on the contents it was bound to, "myColumn", even though that's not what appears in the grid.

View 2 Replies

Forms Data Controls :: Gridview Sorting When Header Of Grid Is Not Shown?

Feb 3, 2010

guide how I can sort grid data when header is not shown. Actually In my page I have set visibility of header to false and have placed headings in table above the grid (it was done because requirment was to fix header and make grid with scrollable).how I can give sorting functionality with headings in table above the grid

View 2 Replies

Forms Data Controls :: Manual Sorting Not Working On Grid View?

Jul 20, 2010

I go this code that can so a manual sorting on grid view. The code works fine for "ASC", when I wanted to sort the field to DESC, it never works. Second, it also failed when I switch to another page. Case 1: By default, the column is sorted DESC, then I switch to ASC, works fine, then I switch to DESC, it failed (remain at ASC).Case 2: By default, the column is sorted DESC, then I switch to ASC, works fine, then I switch to other page, it failed (remain at DESC on new page).

[Code]....

View 6 Replies

Forms Data Controls :: Remove Sorting For Particular Autogenerated Column In Grid?

May 10, 2010

I have autogenerated columns some columns come from db and some are virtual columns what i am adding to a dataset that consist of columns from db.i want to disable sorting for the virtual columns which i add to dataset

View 2 Replies

Forms Data Controls :: Gridview Sorting Unbound Column In Bound Grid

May 14, 2010

I have a gridview control bound to a sqldatasource in c#. In the rowdatabound event I look at a value in a cell and use a function to evaluate the value and depending on that value I populate an added unbound column in my bound datagrid to show an excalmation point. I now want to sort by the column with the excalmation point.

View 2 Replies

Jqgrid - Sorting For JQuery Grid - Error "Incorrect Syntax Near '0'"

Jul 30, 2010

i want to do sorting for jQGrid in ASP.NET. For that i have pass the sidx and sord for column name and sorting order.but it was giving error "Incorrect syntax near '0'. Statement(s) could not be prepared." i wrote query for this select Image,CategoryName,Status,CategoryId from Category Order by {0} {1}

View 2 Replies

How To Use MvcContrib Template Gallery For Mvc

Aug 25, 2010

Has any one ever downloaded and made use of the mvcContrib template gallery for asp.net mvc. I cant find where to download the templates from and there is no documentation for how to use it?

View 1 Replies

Forms Data Controls :: Getting The Custom Sorting And Paging With Images To Indicate The Sorting Direction In Gridview

Jul 18, 2010

Moderators Note: THIS ISSUE IS BIG FOR ME AND EVEN IF POSSIBLE, GET THE REPLY FROM THE DESIGNER OF GRIDVIEW. I have been looking for him for long. I am really fed up with reviewing a good lot of web pages on how we can possibly customize the gridview to enable sorting and paging. So many sites have listed out a lot of information and so many guidances. But the problem is that one works out fine and the other is a burden. I really feel bad about being given the job of customizing this kind of a gridview which has no user friendly approach to it. Also, this control is rendered without the pager links inside the <tfoot> tag. I have tried the Pear Pager in php. It is that good and easy to use and compared to that, the gridview in asp.net is the worst ever control i have ever tried so far.

1. i can use the images to indicate the sorting direction
2. I can have the custom pager like

[code]

<<Previous 1 2 3 .. 7 Next >>.

[/code]

When i click the next when i am viewing the page at 3 , the pager links should change as

[code]

<<Previous 2 3 4 .. 7 Next >>

[/code]

Kindly look into this type of requirement and firstly tell me whether this is possible with the gridview control. I would like this request even to be escalated to the designers of the gridview control also, so that Microsoft comes out with a reply THAT WORKS and not the kind of stuff like surfing through a lot of links and pages and finally wasting a lot of days precious time and still breaking the head with this useless control. I have spent a lot of time in searching for a perfect way. Not writing a code that is non-standard. I am really serious b'cos I have spent weeks in customizing this control. If I dont get a solid reply atleast now, I am going to generate all the output by HTML content by custom coding.

View 7 Replies

MVC :: Latest Version Of T4MVC But Without MVCContrib?

Mar 9, 2010

Isn't possible to get the latest version of T4MVC without MVCContrib?

If yes where can I find it?

View 1 Replies

MvcContrib - Get Area Into MenuBuilder ActionLink?

Jan 12, 2011

I am using MenuBuilder with code like this:

public static MenuItem MainMenu(UrlHelper url)
{
Menu.DefaultIconDirectory = url.Content("~/Public/Images/");
Menu.DefaultDisabledClass = "disabled";
Menu.DefaultSelectedClass = "current";
return Menu.Begin(
Menu.Items("",
Menu.Action<HomeController>(p => p.Index(), "Home")
),
Menu.Items("",
Menu.Secure<HomeController>(p => p.About(), "About")
),
Menu.Items("",
Menu.Action<RegulationController>(p => p.Index(null), "Compliance")
)/* This is in the Compliance area */
).SetListClass("menu");
}

But I am also using MvcContib Areas and in the code above the final menu item is in an 'Area' called 'Compliance'.

(There are two other areas in the Mvc application and the first in the list of registered areas is called 'Legislation')

What happens is the following:

When a page is rendered (I am using the standard WebFormsViewEngine) the Urls are all rendered using the 'Legislation' area!!?

E.g. http://localhost:1337/Legislation/Home or http://localhost:1337/Legislation/Home/About

and finally http://localhost:1337/Legislation/Regulation

The first two links should not pick up the 'Legislation' area. The last menu item should be in the 'Compliance' area.

How do I prevent the erroneous Area (Legislation) being rendered on the first two links?

How do I get the MenuBuilder markup in the Site.Master to accept an 'area' attribute or get it picked up automatically from the Controller for each link?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved