473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Paging on a Datagrid added from code behind C#

I am using datagrid control
My code goes here

System.Web.UI.WebControls.DataGrid DataGrid1 = new System.Web.UI.WebControls.DataGrid();
private void CreateGrid()
{
DataGrid1.PageIndexChanged += new DataGridPageChangedEventHandler(dgRt_PageIndexChan ged);
DataGrid1.AllowPaging = true;
DataGrid1.PageSize = 5;
DataGrid1.DataSource = dt;//I binded my datasource here
DataGrid1.DataBind();
Form.Controls.Add(DataGrid1);
}
private void dgRt_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataBind();
}

I have only 5 rows when i run the code with < > buttons but my page number is missing.
How to add paging on dynamic datagrid
Please help
Thanks in Advance
Dec 6 '11 #1
0 1230

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

Similar topics

6
by: thejackofall | last post by:
I added a label server control in my aspx file. In the code behind, the IDE does not generate the corresponding object like it does with buttons and other objects. What am I doing wrong? Is...
2
by: Ken Tucker | last post by:
I've read about this issue in many articles across the net... But haven't found a solution. I see all kinds of custom code to perform sorting with datagrids, but my example is so simple, I must...
0
by: Shane O. Pinnell | last post by:
Does anyone know of a resource for information on how to create a working databound DDL in a datagrid using code behind? I have found a plethora of resources for doing this without code-behind,...
1
by: mike | last post by:
I'm having a problem with binding my sqldatareader to my datagrid in my asp .net page. Below is my code in the page_load section of the code behind page: Dim oCon2 As SqlClient.SqlConnection...
1
by: iforsyth | last post by:
Have a paging datagrid with a checkbox control in column(0). ViewState is enabled. I check the checkbox in first row of the grid on a page and then the program hits this event: Private Sub...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
2
by: Fabrice | last post by:
Hello, First, thanks to felix for his answer. But :-( , I'm feeling newbie :! I' don't understand all the situation. The trouble : Always in the road whith my Datagrid and my ItemTemplate...
19
by: Alan Silver | last post by:
Hello, I have been developing ASP.NET with a text editor so far (better way to learn initially), and have now been trying Visual Web Developer. I want to create a project for an existing site...
0
by: ashtek | last post by:
Hi, I have two (almost similar) web pages Page1 & Page2. Both of them have a datagrid and databinding is done during runtime by executing different stored procedures for each page. Datagrid has...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.