473,402 Members | 2,064 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,402 software developers and data experts.

PageIndexChanging in Gridview

shek124
50
In my form, the gridview is bind , according to my selectedvalue in dropdownlist


How can do paging in gridview using the pageindexchanging event for this condition.. please hwlp me
Mar 19 '08 #1
2 2770
write this code in PageIndexChanging event

{
_gridView.PageIndex = e.NewPageIndex; // Set the Page Index
// then call the Search() method which will b your custom event for the searching of data on basis of dropdown list selection.
}
Mar 19 '08 #2
Frinavale
9,735 Expert Mod 8TB
In my form, the gridview is bind , according to my selectedvalue in dropdownlist


How can do paging in gridview using the pageindexchanging event for this condition.. please hwlp me
You are going to have to have the DropDownList autopostback to the server. Then you need to write the event handler for the SelectedIndexChanged for the DropDownList. In that Method you need to set the GridView's Page Index, then rebind the data source to the GridView...


Eg:
Expand|Select|Wrap|Line Numbers
  1.  Protected Sub MyDropDownList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyDropDownList.SelectedIndexChanged
  2.         MyGridView.PageIndex = Integer.Parse(MyDropDownList.SelectedValue)
  3.         MyGridView.DataSource = m_datasource
  4.         MyGridView.DataBind()
  5. End Sub
  6.  
-Frinny
Mar 19 '08 #3

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

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
3
by: Kevin | last post by:
We have a base class that is responsible for creating the navigation and look and feel of our applications. So all our web pages inherit from this base page so they don't have to worry about the...
1
by: Jason Huang | last post by:
Hi, In my C# 2.0 web form project, I have GridView1 in Form1.aspx. I am wondering why I can't find the PageIndexChanging event in the Form1.aspx.cs but the GridView1 still can go to other...
3
by: HariKutty | last post by:
Hi! I am using ASP.NET with VB.In my application,i am using a gridview..My total records in the Database is 50.I am getting values from the database by passing some of the parameters .My O/P...
2
by: napstar | last post by:
I have a gridview in a web form and when I build the website I get this error:"The GridView 'PatientGridView' fired event PageIndexChanging which wasn't handled" Can any one helpe me out with this?
3
by: phpmel | last post by:
Hi Guys, I have a problem. I have a gridview that is bound to a SQLDataSource using a stored procedure that is used for Searching. it works fine. my problem is that if I select a page index, the...
0
by: s14m27 | last post by:
Hi..... I have a gridview control with paging enabled. I am entering values in the first page of the grid. On clicking the save button i automatically want to save & redirect it to the next page...
3
by: Peter | last post by:
I have a GridView which is populated by List<ofObjects> Does anyone have example of how to sort the columns of this GridView? I have found examples without DataSourceControl but these use...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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 project—planning, coding, testing,...

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.