473,288 Members | 1,743 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,288 software developers and data experts.

Setting GridView PageSize at runtime

Hello,

Using VWD 2005 here and I want to set the GridView PageSize at runtime.
This URL has an example of what I exactly want to do...
http://msdn2.microsoft.com/en-US/lib....pagesize.aspx

Public Overridable Property PageSize As Integer

Dim instance As GridView
Dim value As Integer

value = instance.PageSize

instance.PageSize = value

Where I'm stuck is where does this code go? In what method to I put
this code into? I tried using GridView1.Load and it didn't work.

Any assitance is greatly appreciated... thanks!

May 16 '06 #1
4 3724
You can put this code in Page_Load of your page.

"Adam Sandler" <co****@excite.com> wrote in message
news:11*********************@j55g2000cwa.googlegro ups.com...
Hello,

Using VWD 2005 here and I want to set the GridView PageSize at runtime.
This URL has an example of what I exactly want to do...
http://msdn2.microsoft.com/en-US/lib....pagesize.aspx

Public Overridable Property PageSize As Integer

Dim instance As GridView
Dim value As Integer

value = instance.PageSize

instance.PageSize = value

Where I'm stuck is where does this code go? In what method to I put
this code into? I tried using GridView1.Load and it didn't work.

Any assitance is greatly appreciated... thanks!

May 16 '06 #2

Winista wrote:
You can put this code in Page_Load of your page.


Actually, I cannot... Public Overridable Property PageSize() As Integer
is a declaration... I get an error if I put a declaration inside an
event handler body.

VWD 2005 will create this stub for me:

Public Overridable Property PageSize() As Integer
Get

End Get
Set(ByVal value As Integer)

End Set
End Property

But that's where I get really confused... how does the code know which
PageSize I'm talking about? There could be more than 1 Gridview on a
page. Using e. and Me. doesn't help me out with scope issues.

May 16 '06 #3
grdMyGrid.PageSize = 10

"Adam Sandler" <co****@excite.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...

Winista wrote:
You can put this code in Page_Load of your page.


Actually, I cannot... Public Overridable Property PageSize() As Integer
is a declaration... I get an error if I put a declaration inside an
event handler body.

VWD 2005 will create this stub for me:

Public Overridable Property PageSize() As Integer
Get

End Get
Set(ByVal value As Integer)

End Set
End Property

But that's where I get really confused... how does the code know which
PageSize I'm talking about? There could be more than 1 Gridview on a
page. Using e. and Me. doesn't help me out with scope issues.

May 16 '06 #4
All... thanks for your help. I'm not sure if any code smells exist
here but this works:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim iPageSize As Integer
Dim myGridView As GridView
Dim ta As New DataSet1TableAdapters.T_ORDERSTableAdapter

myGridView = Me.GridView1
iPageSize = ta.GetData.Select.Length

myGridView.PageSize = iPageSize
End Sub

May 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ken | last post by:
Hi All - I have a filtered GridView. This GridView has a check box in the first column. This check box is used to identify specific rows for delete operations. On the button click event I...
3
by: John Daly | last post by:
I am using a Gridview to display a phone directory, with paging on. I have a link button that a user clicks to add a new record, which reloads the page, sets the visble property to false on the...
4
by: Chuck | last post by:
I'm setting the column with for a gridview (25+- columns) and have paging turned on. When the gridview is first displayed, the column widths are all set to the default. But after paging to...
8
by: AG | last post by:
ASP.NET 2.0, VS 2005 I have a gridview with paging enabled, bound to an objectdatasource. Both were dropped on to the page and configured via the wizards. Basically working as expected. The...
3
by: Nathan Sokalski | last post by:
I have a GridView control with three columns, all BoundField columns. They all have a HeaderText and DataField property set, and the third one has a DataFormatString property as well. When I run my...
1
nitindel
by: nitindel | last post by:
Hi All, Please tell me any good site for Gridview control.(not for datagrid). I am facing error in fetching the values of the Bound columns in the gridview: lease tell me how should i...
0
by: Jeff | last post by:
hi there ;) asp.net 2.0 I'm having problem with paging in GridView, I'm using custom paging. The ObjectDataSource reads in the rows needed for displaying each page as each page is selected....
8
by: hiranmaie | last post by:
Hi, I am having 3 textboxes and 1 gridview. I want to pass (reflect) the values from textboxes to gridview. I am not using the database here. I want to save the data directly from textboxes...
3
by: anjali5 | last post by:
Hello Everyone, I want to display an image in my gridview. The only thing is my datatabse table is returning true if there is an image and false if there is no image and I am binding my...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...

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.