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


Similar Messages:

Maxlength Attribute Of A Text Box From The DataAnnotations StringLength In MVC2?

Mar 5, 2010

I am working on an MVC2 application and want to set the maxlength attributes of the text inputs.

I have already defined the stringlength attribute on the Model object using data annotations and it is validating the length of entered strings correctly.

I do not want to repeat the same setting in my views by setting the max length attribute manually when the model already has the information. Is there any way to do this?

Code snippets below:

From the Model:

[Required, StringLength(50)]
public string Address1 { get; set; }

From the View:

<%= Html.LabelFor(model => model.Address1) %>
<%= Html.TextBoxFor(model => model.Address1, new { @class = "text long" })%>
<%= Html.ValidationMessageFor(model => model.Address1) %>

What I want to avoid doing is:

<%= Html.TextBoxFor(model => model.Address1, new { @class = "text long", maxlength="50" })%>

Is there any way to do this?

View 3 Replies

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

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

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

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

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

Forms Data Controls :: Assign MaxLength Property To BoundField Column In DetailsView COntrol Without Converting Into TemplateField?

Mar 19, 2010

How to assign MaxLength Property to BoundField column in DetailsView COntrol without Converting into TemplateField.

View 3 Replies

Forms Data Controls :: Show Grid With All Orders And In Grid One Column With Last State Of Order?

Feb 2, 2011

I have an entity "Order", which contains a set of states. Every state has date and name.

I want show grid with all orders and in grid one column with last state of order. But I dont understand how to do it.

View 1 Replies

DataSource Controls :: How To Select Column Value From Grid And Hide A Column

Oct 19, 2010

I'm trying to retreive a column value from gridview5 to use it in a query to display resuls in gridview, Also how do you hide a column in the grid?

Where (p.Link_ID Like GridView5.?

[code]....

View 3 Replies

Forms Data Controls :: Have A Grid View With Some Coulmns Like Name,Phone No Etc With Edit,Delete Column In Grid View?

May 27, 2010

i have a grid view with some coulmns like Name,Phone no etc with Edit,Delete column in grid view. I click a row in grid view to Edit,it goes another page where i can edit all fields .Once i update i redirect the page to gridview. I want the grid view to remain in that particular page say 4 of the grid view

View 5 Replies

Entity Attribute Value (EAV) Vs. XML Column For New Product Attributes?

Mar 21, 2011

I have an existing, mature schema to which we need to add some new Product attributes. For example, we have Products.Flavor, and now need to add new attributes such as Weight, Fragrance, etc. Rather than continue to widen the Products table, I am considering a couple of other options. First is a new Attributes table, which will effectively be a property bag for arbitary attributes, and a ProductsAttributes table to store the mappings (and values) for a particular product's attributes. This is the Entity-Attribute-Value (EAV) pattern, as I've come to understand it. The other option is to add a new column to the Products table called Attributes, which is of type XML. Here, we can arbitrarily add attributes to any product instance without adding new tables.

What are the pros/cons to each approach? I'm using SQL Server 2008 and ASP.NET 4.0.

View 1 Replies

C# - Highlight Column Of Grid?

Jul 16, 2010

i need to highlight a column of a grid when clicked for sorting.

View 1 Replies

Forms Data Controls :: Binding Data In Column Of Data Grid To Other Column?

Jul 26, 2010

I have a boundcolumn that outputs string numbers. I have another column of checkboxes next to it. I need to have it so that when a user checks off a check box the value stored in the string column to the left is then plugged into a function on the server. How can I acheive this?Here is my code:

[Code]....

[Code]....

View 8 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

MVC :: How To Replicate In The Grid.Column Is Similar

Mar 2, 2011

In a classic Tabular MVC View I have put a column that shows or hide some Html.ActionLink() tags for every row, depending on the model.

I was trying to do the same with the razor WebGrid, but not being able to do that.

The code snippet I want to replicate in the grid.Column is similar to this

@if (item.CanDelete)
{
Html.ActionLink("Delete","Delete", new {id=item.id}
}
else
{
Html.ActionLink("Edit","Edit",new {id=item.id})
}

View 6 Replies

Access A Particular Column In Grid View?

Sep 15, 2010

In grid view I want to sort the particular column. For that we have to access that column
How to do this??

View 3 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

How To Add Data Into A Specific Column At Runtime In Grid

Dec 9, 2010

I have a rad grid, i have bounded the columns in the grid using GripBoundColumns which shows me dropdown cloumns when i edit the record, Insert/update/delete are working fine for me.

My question is it possible to insert new data into the column(Not the whole record just only to one column) when i edit the record.

For example...

suppose i have 5 columns (Client Name, Account No, Account name, account status, Custodian Dealer) CustodianDealer is my drop down coloumn and data for it comes from different table when i edit or insert a new record in the grid, i can select the existing Custodiandealers in the table.

now if i want to insert a new record to the custodianDealer table not to the grid, how can i acheive it

View 3 Replies

Telerik MVC Grid - Putting A Button In A Column?

Oct 25, 2010

What im trying to do is have an edit button that instead of opening the line for editing, it forwards you to a page where you can edit. Is this possible? I tried something with the client template, but the grid render is ignoring it completely.

View 1 Replies

Hide Last Entire Column Of Data Grid?

Dec 7, 2010

I have one data grid,I want to Hide last entire column of data grid How to do this... Iam using Asp.net1.1

View 1 Replies

JQuery :: Pass A Grid Column Value To A Modal?

Aug 19, 2010

I have a requirement to hide a field called details on a gridview and show it in a jQuery modal dialog when users click on the Customer ID hyperlink. This grid is created programmatically. I will be hiding the details column via the CSS display:none property. Does some one know how can I pass the grid's selected hidden column value to the modal? Here is some of the code I started:

[Code]....

View 3 Replies

AJAX :: .Net Grid With Column Header Grouping?

May 29, 2010

I have a requirement to build a grid with column header grouping. Each column header of the grid can have nested column. On expanding the column header subsequent columns will be displayed.Is it possible with asp.net grids

View 2 Replies







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