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


Similar Messages:

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

How To Disable Auto Generate Columns In Grid

Jan 19, 2010

how to make visible false some of my auto generated columns in grid dynamically.

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

Auto Generate Number In Asp.net Which Is Auto Add In Sql Server Table With Other Data?

Mar 25, 2011

I have project in asp.net with sql server backend.i want to auto generate a number for particular column.with the auto generated number i want to insert some other data in the same row same table. on button click event.details

railway PNR no.:- want to autogenerat
passenger details:- want to inserted simultaneously

View 2 Replies

MVC :: Use A Grid View In Application / Bind This Datatable With The Gridview?

Sep 6, 2010

i'm using asp.net MVC 2.0 , now i want to use a grid view in my applicationbut i don't want to use the third party control. my data contained in a datatable. so i want to bind this datatable with the gridview.

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

Forms Data Controls :: Best Way To Auto-format Auto-generated Grid Columns?

Mar 9, 2010

I have a "database explorer" page that is desgined to be pointed to an unknown database and allow users to browse the data, so it basically uses the SQL system tables to develop its queries and pull in data to tables using auto-generate columns.The problem that I have is that I would like certain types of columns to have certain formats and I'm wondering the best way to go about it. I could format the column in code in the RowDataBound event I assume, but I'm wondering if there some better standard way to do this? Is there a setting of any kind that I can use? For example I want all of the datetime fields to be formated for short date, like {0:d}, I want decimal fields to have 4 decimal places, etc.

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

SQL Server :: Auto Generate More Complex ID?

Jul 17, 2010

I really don't know if this Post fit in this Forum section. But here I go. I need some sugestion to develop an ASP.NET code that generate complex IDs / Keys automatically. Let me be more understandable:

I want to create uniquelly IDs with more complex composition (kind of 18958351512783997769711... or crlu0xakecjzlgmjsgnedr55) or something link that (doesn't matter the lenght... those are only examples).

So, I can use that to set COOKIE ID's... PRODUCTS CODE ID's.... CUSTOMER's CART ID's... etc... But it need to generate uniquelly numbers. I don't know if you got my point I hope you did.

View 3 Replies

Auto-generate Detail Fields In .NET

Jul 29, 2010

Is there anyway to auto-generate ASP.NET controls based on fields in a SQLDataSource? It is really easy to create a form in WinForms by dragging the fields onto the form. You can even determine which control will be used (like a dropdown). Is there anyway to do this in ASP.NET? I don't want a DetailsView since I need to have separate controls that are created.

View 1 Replies

Auto-generate A Web.config File?

Aug 3, 2010

My solution has a web.config file and it works, no problem. However, when i make a change to a file in one of my projects and then build, it auto-generates a web.config file for that project. Then if I go to the file in my browser, it throws a windows authentication error. I then have to delete the web.config file and it works.Why is it auto-generating this web.config file?

View 3 Replies

Web Forms :: Make Text Box Auto Generate?

Apr 23, 2010

i have three text boxes. one is for Rate , second one is for Quantity and third one is for Amount. when i am entering value in two text boxes. after press tab key multiplication of these two text boxes generated in third text box(Amount).

View 3 Replies

Databases :: How To Generate Auto Sequence Number

Jan 18, 2010

I've scouted around and found partial answers to my question. If I insert a row into an orcle 9i db, what is the syntax in both the insert statement and then the .net code to get the id value so I can use it elsewhere?

View 2 Replies

DataSource Controls :: Re - Auto Generate ID'S In Sqlserver?

Jun 27, 2010

I really need to create ID like this. But I don't know how use this Procedure .If you don't mind can you explain to me step by step how to use to procedure for create auto ID in database. (Should I call to this Procedure from somewhere else, like webpage button or something)

View 4 Replies

SQL Server :: Generate A Sequential Auto Generated Id In C#?

Feb 22, 2011

I wanna generate a sequential auto generated id in c# and store it in mssql database.

format is abc0009.. abc0010.. abc9999.... abc10000 abc10001 and goes on..

View 10 Replies

C# - Auto Generate Web Services From Stored Procedures?

Aug 12, 2010

I have looking for a code generation tool, that could auto generate web services based on feeding a tool the stored procedure that I would like.

Is there something that could achieve this for me ?

View 3 Replies

Auto-generate Resy Web Services Documentation / WADL

Feb 18, 2011

We are creating ReST Web Services using ASP.NET and OpenRasta.

Is there any tool that can:

create WADL file or/and create human readable API documentation similar which decribed resources/HTTP
methods supported for each resource, etc ?

View 2 Replies

Visual Studio :: How To Create Auto Generate IDNo

Feb 20, 2010

may i ask how to create auto generate IDNo in OO Approach

View 2 Replies

DataSource Controls :: How To Auto Generate Data In Database

Apr 6, 2010

I am having a field called Semester, i will enter it as 1 initially. Then it should automatically increase 1 semester every six months till sixth semester in the database (sql server 2005) is it possible?

View 5 Replies

How To Make WCF Auto Generate SOAP Docs Like ASMX

Jun 7, 2010

I'm currently writing a web service using WCF in VB.NET.Previous web services I wrote used ASMX but I wanted to learn WCF and so far it's going well. I actually prefer the way WCF does things.One thing I miss however is the way that ASMX used to generate example SOAP requests and responses. It was like getting documentation for free.Is there anyway to auto generate SOAP documentation for WCF?

View 1 Replies

SQL Reporting :: Report Manager - Stop Auto Generate?

Oct 25, 2010

I have a report with 4 different variables await user input, these variable can be null but the problem I am having is since null is set to the default value for all of the variables the report will automatically generate itself when the user starts it.

Is there a way to halt auto generation so the user just sees the variables and the view report button other than setting one of the variables to not have a default value of null?

View 1 Replies

Web Forms :: Auto Generate Page Level Event Handlers?

Nov 1, 2010

Inside VS2010 is there a way of auto generating page level event handler code?

View 2 Replies







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