how to get started with using `GridView` in ASP.net? - asp.net

How to get started with using GridView in ASP.net?

grid view is pretty slick especially in asp.net. You can check all the gridview tutorials on ASP DATA TUTORIALS.. it is the perfect place to start learning asp.net. If you don't want to learn then you can always add a sql database, insert a grid view and connect it to the data base via a datasource. Then you can play around with it. However i will strongly recommend those tutorials as they contain all tips and tricks you want to know. You can ask more questions here, i will be glad to answer.

And I inherited from the GridView to create the GridViewTree - a multi-column treeview server control. So reviewing this might give you some other ideas.
It can be found here.

Well, I have a few blog posts on the GridView:
Multiple Row Selections with CheckBoxes.
Checking All Rows Using Client-Side Script.
Attaching upload files to a record.
Sort Column Arrow Performance.
How to Work With a GridView Row in JavaScript.
All can be found here.

Related

Expandable/Collapsible Gridview Rows without using Nested Gridviews?

I need to add an expandable feature to my gridview and I am not quite sure if the tutorials I am finding online quite cover what I'm looking for. We have a gridview that is populated with the results of a SQL query. These results are sorted by "expiration date," with all expired records moved to the top and greyed out. We want to collapse all expired records to make it cleaner, visibility-wise. Does anyone have any tips on how to approach this? Most of what I am finding involves a nested gridview, however I'm not sure if that pertains to this project.
If you are using jQuery in your web page this is simple. Add a css class to those rows you want to hide. And just call the .hide() on them.
$('.greyedout').hide();
Below is a sample which shows hiding of rows is possible. Hope it explains the basic idea to you.
http://jsfiddle.net/deostroll/LVyvR/embedded/result/

ASP.NET DataGrid, DevExpress Grid or Report

I am new to asp.net and I want to create a table on my site.
The table should display data in a year-by-year manner (every row is another year).
When a row is clicked data in the table should change to the month-by-month data and so on.
I do not wnat to have another table under the first one or open new site.
i want to change columns and data binding in the table that is loaded as the first one.
I was wondering if it can be done using DataGrid or maybe I should think about some DevExpress
controls? I heard they are cool stuff :)
Oh, and one more thing - I want to generate report to pdf from data that is currently being shown.
Any suggestions how to do it? Like I said I am new in asp.net.
Thanks in advance for help.
surely you can use DevExpress ASPxGridView or even the MVC Grid extensions, both have no code required pdf/excel/HTML export. as you said, cool stuff, we just bought 14 licenses of their DXperience subscription, planning to use mostly the MVC and SL controls.
I don't know anything about DevExpress but I know what you are describing can be accomplished using a plain old ASP.NET GridView. The DataGrid is actually a somewhat deprecated control, so you wouldn't typically use that with a newer ASP.NET application.

Ajax enabled sorting and paging on grid in ASP.NET 3.5

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.
I'm replying my own question.
I found Ajax Data Controls as updated version of what I had specified in my question. Still I will not mark it as answer and will wait for better answer.
If you are using a datasource control (SqlDataSource, LinqDataSource etc) this would be done automatically (retrieving only the current page of data). To make paging and sorting ajax-enabled wrap the grid inside an UpdatePanel control.
I used devexpress grid. It has sorting, grouping and paging. It is not perfect one but looks nice and easy to use.

thoughts on asp.net grid controls

All, I am creating a web application and I need to give users the ability to add/edit/delete records in a grid type control. I can't use 3rd party controls so I am restricted to just whats in the box for asp.net (datagrid or gridview) or creating my own. Any thoughts on the best direction to go in. I'd like to keep the complexity level at a dull roar :)
thanks in advance
daniel
You should definitely use edit and insert templates. All you have to do is give the button/link the command name such as insert/delete/update and you can allow the Grid to do most of all the work.
Check out this link
I think you'll learn to love the gridviews because they are pretty powerful.
Gridviews have different item templates that you can use for editing and inserting data. That'd be an easy way to go about it.
As long as you set your datakeyid property to the primary key in the database, you should be able to make template fields based off of whether or not you're editing or inserting data. The command name of the button you use to fire the event will handle the statements required for updating/inserting data.
This is a good site for some examples.
the out of the box grid is not too bad.
Here are a few links on master detail records in asp.net this should get you started on the CRUD opperations.
http://www.exforsys.com/tutorials/asp.net-2.0/displaying-master-detail-data-on-the-same-page.html http://msdn.microsoft.com/en-us/library/aa581796.aspx
http://www.bing.com/search?q=asp.net+master+detail
this is the best site for what you are after
www.Asp.Net
Data Access Tutorials controls
Master/Detail Using a Selectable
Master GridView with a Details
DetailView
Using TemplateFields in the GridView
Control
Others
Beginners Guide to the GridView
Control
The GridView Control
IN-DEPTH LOOK AT THE GRIDVIEW CONTROL

Is the ASP.net GridView control a clever design?

I have been using gridview since a long time. I have a "cant live with you and cant live without you" relationship with it.
The idea of Edits, inserts and deletes from within the grid is great but having to do something like
var sometext = ((TextBox)editRow.FindControl("tbSomeText")).Text;
just seems very un-clever to me. Has anyone comeup with a solution or knows (resource) where you perform CRUD operations + paging and sorting from within the grid and dont have to write ugly code (like above). I am not looking for solutions using DataSource objects since I am not its biggest fan. I will be happy if someone can tell me how to live without GridView in asp.net.
I understand there are AJAX implementations but I am looking for something completely serverside.
I always use repeater control instead of others. Because i feel free with it. I build up the html by myself and can do a lot of thing like paging sorting. But of course you need more effort for the repeater for these kind of functionality.
For CRUD operations, i use jQuery thickbox (modal pop up and iframe).
My choice is Repeater
If you are trying to make a basic CRUD website, have a look at ASP.NET 3.5 Dynamic Data which is a great website to add as a pure data access website with CRUD ability. However, its extremely customizable.
Gridview has its advantages and I used to love it in the .Net 2.0 times about two/three years ago. However, since then there are much better .Net 3.5 controls (like ListView) that give you a better ability to customize content. I'd also have a look at many third party grid tools from (Telerik, Infragistics, ComponentArt, ComponentOne, DevExpress) that have a lot more capability than the inbuilt gridview control.
I despise it, every time I've used it or seen another developer use it, they almost always end up going with something else. I've never once heard any developer I've worked with say "I love GridView".
You can hook up the GridView and DetailsView and use basic SQL scripting or complex business objects along with DetailsView.
I have found DetailsView to be very useful.

Resources