473,614 Members | 2,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid navigation problem

Hello there,
Just a small problem while navigating datagrid, i am filling a datagrid by
output of query. i have given navigation buttons first,last, next,
previous.it is working but the problem is that i have to click twice to
navigate.any suggestion. i m using following code
Private Sub NavigationButto nClicked(ByVal sender As Object, _ByVal e As
EventArgs) Handles FirstPage.Click , PreviousPage.Cl ick, NextPage.Click,
LastPage.Click Dim direction As String = CType(sender, Button).Command Name
Select Case direction.ToUpp er() Case "FIRST"
DataGrid1.Curre ntPageIndex = 0 Case "PREVIOUS"
DataGrid1.Curre ntPageIndex = _ Math.Max(0,
DataGrid1.Curre ntPageIndex - 1) Case "NEXT"
DataGrid1.Curre ntPageIndex = _ Math.Min(DataGr id1.PageCount - 1,
_ DataGrid1.Curre ntPageIndex + 1) Case "LAST"
DataGrid1.Curre ntPageIndex = _ DataGrid1.PageC ount - 1 Case
Else End Select DataGrid1.DataB ind()End Sub
Nov 18 '05 #1
2 2683
Hi anand,

Check to see you are only binding the datagrid in the page_load if its not
postback

in Page_Load do databinding only if
if(!Page.IsPost Back)
{
DataGrid1.Datas ource = yourdatasource;
DataGrid1.DataB ind();
}
Regards
Ashish M Bhonkiya

"anand" <an****@armour. com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hello there,
Just a small problem while navigating datagrid, i am filling a datagrid by output of query. i have given navigation buttons first,last, next,
previous.it is working but the problem is that i have to click twice to
navigate.any suggestion. i m using following code
Private Sub NavigationButto nClicked(ByVal sender As Object, _ByVal e As
EventArgs) Handles FirstPage.Click , PreviousPage.Cl ick, NextPage.Click,
LastPage.Click Dim direction As String = CType(sender, Button).Command Name Select Case direction.ToUpp er() Case "FIRST"
DataGrid1.Curre ntPageIndex = 0 Case "PREVIOUS"
DataGrid1.Curre ntPageIndex = _ Math.Max(0,
DataGrid1.Curre ntPageIndex - 1) Case "NEXT"
DataGrid1.Curre ntPageIndex = _ Math.Min(DataGr id1.PageCount - 1, _ DataGrid1.Curre ntPageIndex + 1) Case "LAST"
DataGrid1.Curre ntPageIndex = _ DataGrid1.PageC ount - 1 Case Else End Select DataGrid1.DataB ind()End Sub

Nov 18 '05 #2
thanks there , i tried but seems not working.any work around
"Ashish M Bhonkiya" <bh******@hotma il.com.nospam> wrote in message
news:O7******** ******@tk2msftn gp13.phx.gbl...
Hi anand,

Check to see you are only binding the datagrid in the page_load if its not postback

in Page_Load do databinding only if
if(!Page.IsPost Back)
{
DataGrid1.Datas ource = yourdatasource;
DataGrid1.DataB ind();
}
Regards
Ashish M Bhonkiya

"anand" <an****@armour. com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hello there,
Just a small problem while navigating datagrid, i am filling a datagrid by
output of query. i have given navigation buttons first,last, next,
previous.it is working but the problem is that i have to click twice to
navigate.any suggestion. i m using following code
Private Sub NavigationButto nClicked(ByVal sender As Object, _ByVal e As
EventArgs) Handles FirstPage.Click , PreviousPage.Cl ick, NextPage.Click,
LastPage.Click Dim direction As String = CType(sender,

Button).Command Name
Select Case direction.ToUpp er() Case "FIRST"
DataGrid1.Curre ntPageIndex = 0 Case "PREVIOUS"
DataGrid1.Curre ntPageIndex = _ Math.Max(0,
DataGrid1.Curre ntPageIndex - 1) Case "NEXT"
DataGrid1.Curre ntPageIndex = _

Math.Min(DataGr id1.PageCount - 1,
_ DataGrid1.Curre ntPageIndex + 1) Case "LAST"
DataGrid1.Curre ntPageIndex = _ DataGrid1.PageC ount - 1

Case
Else End Select DataGrid1.DataB ind()End Sub


Nov 18 '05 #3

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

Similar topics

2
3705
by: Ricardo Manuel | last post by:
Hi, I'm using a Datagrid that I fill with a Dataset but when I configure the paging with the Navigation Buttons I can't put them working, I've tried both methods (Next, Previous and Page Numbers) when I click on the Next link of the navigation buttons I see on status bar the folowing code -> Javascript:__doPostBack('Datagrid1$_ctl9 $_ctl1','') but nothing happens on Datagrid. I've configured the datagrid for 5 rows and Dataset
0
1613
by: Stephen | last post by:
This is a real brain-teaser and i'd really appreciate it if someone can try and understand what im trying to do and give me a few pointers or ideas to help me work out my problem. Im basically using the example of CUSTOM PAGING on a DataGrid on this page: http://www.dotnetjunkies.com/Tutorial/EA868776-D71E-448A-BC23-B64B871F967F.dcik and im trying to add extra functionality in the DataGrid Paging - Custom Paging example. I'm able to get...
1
2899
by: GregM | last post by:
I have a read only datagrid that is designed to coordinate itself with textboxes. When the user clicks on a row in the datagrid, detailed data for that row is displayed for editing in the textboxes. The datagrid and textboxes are populated from the same underlying SQL Server table but using different strongly typed data adapters and datasets for display and editing. So I coordinate syncronization of the two sets of data using code. I use...
0
1316
by: Raed Sawalha | last post by:
Hello: I have windows application that do monitoring task, there is a thread continously running to check updates made on XML file then updates the datagrid information with new information as follows : DataSet dsUsers = new DataSet("dsUsers"); dsUsers.ReadXml(EduFilterMonitorFile); if(dsUsers.Tables.Count == 2) sbUsers.Text = "No Information avaiable - No Users in EduFilter Cache
1
1308
by: Stephen | last post by:
Hey, does anyone know of any good sites or examples showing me how to create a datagrid which i can easily navigate through. I would like to be able to navigate through a datagrid using wee link buttons. Can someone please point me in the right direction of how to do something like this. Here is the kind of navigation I would like to achieve on my datagrid. First < << |1|2|3|4|5| >> > Last
8
1937
by: Inigo Jimenez | last post by:
I have an ASP .net web application installed in a Windows 2003 server. This web application has a webform that has a Datagrid. This Datagrid is filled with the data of a SQL table. I have a button that inserts a new row in the SQL table and then refresh the datagrid.
2
1852
by: Axel Dahmen | last post by:
Hi, I'm using a DataGrid control to show a table's content with paging. For navigation through the pages I'm using the DataGrid's intrinsic navigation section. My problem: The DataGrid navigation links use JavaScript to jump between pages. I want them to use standard hyperlinks providing the page number in some URL parameter so that I can copy the hyperlink elsewhere.
4
1785
by: Daniel | last post by:
Hi All, I need to change the "1 2 3 4..." link button page browsing to 2 buttons which are "<" button and ">" button. is it possible? any guidelines? your help will be appreciated. thank you.. best regards,
10
2027
by: Doug Bell | last post by:
Hi I am still having problems with Tabbing through a DataGrid with a DataGridComboBox Column. I need to allow the User to Type the value into the ComboBox so consequently its ComboBoxStyle is set to DropDown. This causes the Tabbing to work incorrectly. Even though I am consuming the Windows Message WM_KEYUP, it still Tabs through the ComboBox Column on to the next Column. I found if I do not give the keyboard focus ie remark out...
0
8620
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...
1
8265
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8423
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5537
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
4115
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2560
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
1
1705
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1420
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.