473,763 Members | 3,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate datagrid with values obtained from DAL, enable pagination

10 New Member
I am new to .Net. I am using ASP 2.0 and C#.

I want to pupolate a data grid programatically using the values obtained from a list conating domain objects.

E.g., DAL.GetEmployee () returns a List of all Employee object. Each Employee object has two attributes (ID and Name).

I drop a data grid control on ASP.Net Web form.

Data grid will have 2 columns - one to display ID, another to display Name of employee.

How can I accomplish it within C# code on server side to populate that data grid on web form with
the values from the list?

How can I add pagination on the data grid?

E.g. each page in the data grid only displays 30 employees. 31st employee is displayed in the next page by
paginating through the data grid.

So, my questios are:
1) How can I bind the values obtaiendthe from the list to the datagrid in web form?
2) How can I do pagination in the data grid?

If datagrid is complicated, can a table control in ASP.Net provide me pagination? If yes, how?

I will appreciate help with code snippet as i am new to this.
Dec 16 '06 #1
1 1840
kenobewan
4,871 Recognized Expert Specialist
For the datagrid, simply use the datagrid.dataso urce = list name and then databind().

Here is a good intro to paging - Paging Support in the DataGrid

Hope that this helps.
Dec 17 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1746
by: Mukesh Kumar | last post by:
Hi, Can anybody throw some light about displaying records in datagrid and pagination will be done alphabetically. Like I want to click on G and want to display all the records starts with G. Is there any property or custom coding in Datagrid helps us to achieve this? This is a bit urgent.
1
351
by: Job Lot | last post by:
My DataGrid is bound to a datatable named “dtClient” with following columns Date, BalanceCF, Income, Expenses, Withdrawls and BalanceCF. BalanceCF is an expression column. The column Withdrawals does not hold any values initial. I want to populate Withdrawal column using values from another datatable named “dt Withdrawal” which contains Date and Amount columns. How can I match the dates in “dtWithdrawals” with dates in...
1
2745
by: Swadh | last post by:
Hi, I need urgent help on Windows Form datagrid. I have to Display a datagrid that has a textbox column and another one combo box column. I have two tables in my Access database as: Table 1: Columns: Part_ID, Descr Here Part_ID is Primary key. Table 2:
1
2808
by: David Petersen | last post by:
I need to change the paging buttons in my C# web datagrid from "previous" and "next" to something like "Records 10-20 of 100", etc., depending on which page the user is on. Any ideas? Thanks, Dave
3
8689
by: Joseph D. DeJohn | last post by:
I am trying to get pagination working on a datagrid. Can anyone point me to a resource for help on this? I'm not sure if custom paging is the best option or not.
0
1016
by: Amol | last post by:
Hello, I am developing an apllication in which i want to change the values of datagrid checkbox column according to parameter passed to the query. But the problem is that, at first time when i usedto send the parameter values it shows me the result ok for first time.But as i change the value of the parameter (taken from textbox on button click) it doesn't show me the appropriate values(not checking the checkboxes appropriately). I am...
1
1579
by: Khan.A.Mushtaq | last post by:
hi can any one help me how to make working page number, edit and delete when we use datagrid on a web application in vb.net 2003. I have made connection with my access data base and the lay out where it shows the data one my web page and underneath show Next Previous on the side I have Edit Delete hyperlinks but I dont know what code I should put to make them function
7
3228
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the column need to be a date picker field. I know things will be easier with ASPX datagrid.
2
1665
by: =?Utf-8?B?SnVsaWEgQg==?= | last post by:
Hi all Got a weird problem with pagination on a datagrid in asp.net 1.1. It's populated depending on user selected criteria (it either displays all or 1 record). It works fine in the following circumstances: Datagrid populated with 1 record then re-populated with all Datagrid populated with 1 record then re-populated with another single record Datagrid populated with multiple records and displaying page 1 then
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10144
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9997
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.