gridview editing without using datasource control - asp.net

I am looking for some examples for gridview for common tasks like displaying, editing, deleting, paging, sorting, batch updates etc, but WITHOUT using any datasource controls. I would like to bind the data in the code to custom object collection. all the samples I found on the web so far use some data source control, I think Enterprise applications shouldn't be using this pattern. objects in my solution have only business logic and no data access code. instead I use manager objects to do this.
if you have any examples of gridview that performs the common tasks without using any data source control, can you please share them? that would be very helpful. thanks.

Editable GridView in ASP.NET 2.0
Sorting a GridView Bound to a Custom Data Object

Related

Entity framework, custom model, datgrid, paging, sorting not working

I am using vs 2012, .net 4.5, entity framework 5, web forms, vb (but c# help just as good for me)
I am new to using the Entity framework. I have decided to create a new project in .net 4.5 so i can use item Type for strongly typed data controls, in this case gridview.
I need to retrieve data from multiple tables 5+, which by its self is easy enough, but this means i cant use EntityDataSource as theres no option to build a query etc only select a single table. How can i achieve this plesae? I guess in the code behind i can set the gridview datasource but then do i need to implement custom paging and sorting?
I presume in this case i wont be able to use a strongly typed data control but i can live with that, does that mean its only viable for getting data from 1 table. Or do i need to populate my model with all results. The amount of data in the tables is well over 500,000 rows so obviously it has to be paged! And the page has a number of filters / search otpions
I am at a loss here, mainly i obviously am not understanding something.
I have been researching / googling this for a few hours som findings are below, but again they dont really answer or help me.
http://weblogs.asp.net/dwahlin/archive/2013/03/26/asp-net-4-5-web-forms-features-strongly-typed-data-controls.aspx
http://forums.asp.net/t/1677303.aspx/1
One option is creating a view with whatever you want in your database and then regenerating your EDMX to include the view. You will then have a strongly typed object designating the fields in the View.

ASp.Net GridView Updating using a stored procedure

I've read tons of sites on this. There are many "Examples" if you call some code with no explanation of how it was generated (design view vs typed) an example or just want to use simple select and update statements.
I have a Gridview. I am populating it using code from a stored proc. Now I want to edit the data. I have nothing set in the properties of the Gridview through design view (datasource, columns, etc.) My question is, how can I set this to allow editing and use a SP to send it back to the database?
Do I have to now manually create columns with code since I chose to not set properties in the design view?
Is it better to set the properties in design view and go that route? I started that way, but had problems when it came to updating with a SP.
I guess the whole do it in the designer vs do it in code thing has me confused.
I started adding RowEdit, RowCommand, etc. to the html and c#, but still don't see the EDIT/CANCEL on the webpage when I run it.
Learn to use the ObjectDataSource. It gives you maximum freedom of what way of storing the data you use - you delegate the select, update and delete to an external class where you just write your code which uses ado, linq, hibernate, a webservice or just anything.
Coding your views directly against fixed database structure would hurt you sooner or later.

Unbound Data Grid View

I have been trying to find a solution for this for a while but I've only managed to find junk on outdated forums.
I am using VB6 and I want to display data in a tabular form. I thought about using a DataGrid but I can't figure out how to add rows to the grid.
Note: The DataGrid is not bound to a recordset.
Is there any way to add the data to the GridView without storing it in a recordset. And is there a better VB6 control to use in this situation?
DataGrids are designed to be used bound to a data source, though it can be a custom data source object and not just an ADO Recordset.
For general display you might want to use the MSHFlexGrid (or the VB5 holdover MSFlexGrid).

asp.net - Possible to have formview edit data across multiple tables?

I am attempting to construct a formview that will edit two related objects at once.
In basic terms, I have a Linq To SQL object of teacher which has exactly one school. The formview has no problem displaying the data, but when in edit mode will only save the changes done to the parent object. Changes to the school data are seemingly ignored
Is there any way to achieve the kind of thing I want here?
Thanks,
This is probably similar to what I'm doing, although I'm not using Linq. I'm using a vanilla ObjectDataSource and displaying data in a drop down list via a different data source. Add a new Event for the FormView that is called during the "ItemUpdating" event. Embed code to directly save your changes in that event. Then as the FormView is saved, everything else is saved.
If you want it to be saved after the FormView, use the ItemUpdated event instead. It's a bit of a manual process, but it does get around the problem.

Alternative to GridView that sorts, pages and is cheap or free?

I've been spoiled by the SqlDataSource, but I'm in a scenario where I can't use it. Is there an alternative to GridView that implements sorting and paging for arbitrary data sources? I'm trying to avoid writing 1000s of lines of custom paging and sorting for each grid. At the office I use Telerik's grid, but for my hobby project, spending that much money is out of the question.
EDIT: It just seems to a lazy programmer like me that if I connect a grid and a data source it should automatically page and sort. So I'm looking for combinations of datasources + grids that result in code-less paging and sorting.
So far the only examples I know of are Telerik's grid (cost $, implements sorting and paging in the grid) and SqlDataSource + GridView (implements sorting and paging in the DataSource, but requires MS-SQL to be available)
I'm not sure if you are asking for an alternate to the GridView or the SqlDataSource....
But you can always use an ObjectDataSource and connect it to any bindable object, collection or Dataset
http://msdn.microsoft.com/en-us/library/aa479347.aspx
We never use a SqlDataSource, we use a wrapper for a SQL call out of our data layer, or use a collection in the ODS.

Resources