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:
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
Jan 19, 2010
how to make visible false some of my auto generated columns in grid dynamically.
View 5 Replies
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 get the error
</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. 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). .........
View 4 Replies
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
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
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
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
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
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
Aug 24, 2010
Is it possible to style the MvcContrib Grid pager to just show "1 2 3 4 ..." for paging?
View 1 Replies
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
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
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
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
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
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
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
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
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
Feb 20, 2010
may i ask how to create auto generate IDNo in OO Approach
View 2 Replies
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
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
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
Nov 1, 2010
Inside VS2010 is there a way of auto generating page level event handler code?
View 2 Replies