Total Page Preview:   000000000135

What is gridview in ASP.NET in English and Hindi


Gridview in ASP.NET in English

GridView is a web control in ASP.NET that is used to display data in a tabular format. It is commonly used to display data from a database or other data source.

Here is an example of how to use a GridView control in ASP.NET:
First, create a new ASP.NET Web Forms project in Visual Studio. In the default.aspx file, add the following code:
In this example, the GridView control is named "GridView1". The "AutoGenerateColumns" property is set to "False", which means we will manually define the columns for the grid.
We then define three columns using the "BoundField" control. Each "BoundField" corresponds to a column in the GridView, and the "DataField" property specifies the name of the field in the data source that should be displayed in that column. The "HeaderText" property specifies the column header text.
Next, in the code-behind file (default.aspx.cs), we can bind data to the GridView control. For example:
In this example, we create a new DataTable object and add three columns to it ("ID", "Name", and "Email"). We then add two rows of data to the DataTable. Finally, we set the DataSource property of the GridView to the DataTable and call the DataBind method to bind the data to the GridView.
When you run the application, you should see a GridView with two rows of data, each containing three columns (ID, Name, and Email).
Gridview in ASP.NET in Hindi
GridView ASP.NET mein ek web control hai jo ki data ko tabular format mein display karne ke liye use kiya jata hai. Ye database ya kisi bhi data source se data ko display karne ke liye commonly use kiya jata hai.
Neeche ek example diya gaya hai jisme GridView control ka use kaise kiya jata hai ASP.NET mein:
Sabse pehle, Visual Studio mein ek naya ASP.NET Web Forms project create karein. default.aspx file mein, neeche diye gaye code ko add karein:
Is example mein, GridView control ka naam "GridView1" hai. "AutoGenerateColumns" property "False" pe set hai, jo yeh signify karta hai ki hum grid ke liye columns manually define karenge.
Hum fir "BoundField" control ka use karke teen columns define karte hain. Har "BoundField" GridView ke ek column ko correspond karta hai, aur "DataField" property uss column mein display hone wale field ka naam specify karta hai jo data source mein available hai. "HeaderText" property column header text ko specify karti hai.
Agla, code-behind file mein (default.aspx.cs), hum GridView control ko data ke saath bind karte hain. For example:
Is example mein, hum ek DataTable object create karte hain aur usmein teen columns ("ID", "Name", aur "Email") add karte hain. Hum fir DataTable mein do rows of data ko add karte hain. Ant mein, hum GridView ka DataSource property DataTable se set karte hain aur DataBind method ko call karke data ko GridView mein bind karte hain.
Jab aap application ko run karenge, aapko ek GridView dikh jayega jismein do rows of data honge, har ek row teen columns (ID, Name, aur Email) ko contain karega.

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn :





Facebook User: