Gridview Formating Tutorail for Beginers

In Asp.Net gridview has its own importance because it bind same type of repeated data from server in bulk and give flexibility to programers.
When I started working on gridview it was quite difficult for me to manage data in gridview because when you see other side arranging data in very stylish way and when you try to achieve it and do not succeeded in it, then it give you mental pain. But here i described some simple way to make it more understandable for you. So here we go.

Suppose you want to make three columns in gridview and in one column want to set 'Tile' for your data i.e in one section Titles appear automatically. See in the above picture colored area represent different region of different data from database like Title, Description, Author Name, Date and video URL.   

Do the following Steps:

1. Set The AutoGenerateColumns to Off.

It will allow you to manage your own columns in Grid View. Now you can see that there are two columns in the picture and in one column there is three rows and the last row contains two columns. Now you can think that it is like defining table like these properties. So make it like as you wish. See the following code.


 <asp: TemplateField> will be under under columns section so that we can achieve our motive. In the coding part you can see that we developed various row and columns as we want very similar like defining table in HTML.

Here Eval will fetch data from database but you will have to give Sql command from Page load events or button click events. The row or columns in which you want to display data you can add Eval as shown in coding. Hope it will work for you if not then write comment if possible in will help you. 

Comments

Popular posts from this blog

DTS package conversion in SSIS to use in SQL 2012 and SQL 2016

Infinite Scroll in Asp.Net C# using Javascript without Third party Plugin

Add Custom Tags in Web config file in ASP .Net