.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Gridview Sorting and Page Orientation

Posted By:      Posted Date: August 25, 2010    Points: 0   Category :ASP.Net

Hi there,

I have looked at several posts on Gridview sorting but can't seem to get it to work in my code. I am using Subsonic objects as the DataSource. Every time I click on a page or sorting link it does a postback but the page orientation is left at the top, not where the gridview is on the page. Is there a way around this?

This is the code I have written for it:

        protected void PublicNoticeGridview_Sorting(Object sender, GridViewSortEventArgs e)
            MidvaleSiteDBDB db = new MidvaleSiteDBDB();
            SqlQuery pubNoticeQuery = db.Select.From<publicnotice>();

More Related Resource Links

AJAX GridView Paging and Sorting using C# in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

Sorting Gridview using Jquery with ASP.NET

I want to show how to sorting a gridview using a Jquery in ASP.NET, it is a flexible client-side table sorting. We have known that Jquery is a new kind of Javascript Library. You can find detail of Jquery in this site http://jquery.com/ there are lot of example with documentation and also allow free download a latest version.

Sorting Gridview using Jquery with ASP.NET

used table sorter plug-in which has written by Christian Bach can found http://tablesorter.com/docs/ . It is really cool plug-in and user can allow to download and customization as their wish.

I test this example in Visual Studio 2005. Some of other requirement needed is download a latest version of Jquery from official website and table sorter plug-in which can found as I mention above website.

GridView Sorting/Paging : 'REAL' AJAX with Asp.Net Series

This is a continuation of my 'REAL' AJAX with Asp.Net (not Asp.Net AJAX) series posts for those of us trying to stop relying on Asp.Net 'AJAX'.

Ok, nothing too dramatic to start things off, we are going to make some tabled data sortable and pagable all without using a bit of postback. Not only that, but it is going to be incredibly easy!

Sorting Data in a GridView Web Server Control

The GridView control provides built-in sorting functionality without requiring any coding. You can further customize the sort functionality of the GridView control by using custom SortExpression property values for columns as well as by using the Sorting and Sorted events

Sorting GridView Columns Manually

We all know that GridView columns can be sorted automatically when SQLDataSource is being used. But what if you are not using SqlDataSource to populate the GridView. Sorting the GridView manually is pretty straight forward task take a look at the code below

Manually sorting and paging Gridview without using datasource control

Many a times while working with Gridview we want to work with the paging and sorting functionality without using any datasource control. Gridview is flexible enough to perform these tasks without the use of any datasource control and only a few lines of code.

Optimized Paging and Sorting in ASP.NET GridView

In this article I am going to demonstrate what are the performance drawbacks of using conventional way to page and sort your GridView and then I will demonstrate 'An Optimized way to implement Paging and Sorting'.

update parentpage gridview with the values from child page?


hi   i am having a gridview on each row i am having a update and add button.

on click of either of the button i am opening a popup where the end user will enter data and on clck of ok button in the child page

based on the click ie

if i clicked update i need to update that particular row with the values from child page.

if i clicked on add i need to add a row below the row where i clicked add button .

can anyone help me with this?

Gridview extends past edge of div and page when editing users


I have a gridview pulling all data from one user. This gridview has an edit button and when that is clicked the gridview becomes too wide for the div/screen and I get a scroll bar. Since this gridview can only have one user in it anyway is it possible to display each field on seperate lines instead?

Master-Detail GridView in Single Page example with paging throws error

___http://www.java2s.com/Code/ASP/Data-Binding/MasterDetailGridViewinSinglePage.htmI followed example at the link above.When I enablind paging=true (by pagesize=3).and clicking to pages 2|3|4 etc and so;error occuringIndex was out of range. Must be non-negative and less than the size of the collection.at cs line :sourceProducts.SelectParameters[0].DefaultValue = gridMaster.DataKeys[e.Row.DataItemIndex].Value.ToString();got any idea?what should I make to fix this ? is this error  fixable ?thanks much.

How to return back to a specific page in a gridview list?

Hello,  I have a gridview with paging. So for instance, I'm on say the page number 10, and I open the form details on a specific record_id (link). After I update/submit the form, it returns to page number 10. But, if I go to another page, for instance page 5, and submit the form, it returns to page 10. I've tried some things, for instance history.back(), but it returns to the first page I went to, in this case page number 10 (or whatever the first page I go to). Hopefully this code helps to understand what I'm asking: <asp:GridView DataKeyNames="Referral ID" ID="gvList" runat="server" CellPadding="4"     ForeColor="#333333" GridLines="None" OnRowCommand="gvList_RowCommand"     OnRowDataBound="gvList_RowDataBound" OnRowDeleted="gvList_RowDeleted"     OnRowDeleting="gvList_RowDeleting" AllowPaging="True" PageSize="20"     AutoGenerateColumns="False" OnPageIndexChanging="gvList_PageIndexChanging"    OnRowCreated="OnRowCreated" AllowSorting="True" OnSorting="OnSort"> protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e)        {   &nb

jpg files will not display in gridview on aspx page

I have an image object in a template of a gridview The datasource of the image object evaluates to the path of the jpg file. However, the aspx page displays a little red x instead of the picture. How do I get the image to display/Frank learning vs 2005

Gridview (bound by ObjectDataSource) Sorting - VB.NET

Hello.. I have a gridview being data bound by an objectdatasource which points to a BLL/DAL.  I have paging and sorting enabled within the gridview. I have the fields configured in the look/fell I want from a templatefield.  This templatefield has the sort expression (date) I want things to be sorted by. All this works as it should and I have no issues with it. But, the issue is that when I click on the header to sort asc/desc by date, I have to click on it twice for it switch to descending order.  E.g.  I hit the webpage and it lists all the information in the gridview, sorted by date, ascending order.  If I want to sort by descending order, I have to click the date header twice in order for the gridview to sort the information in descending order; the clicks cause a post-back and the whole screen is refreshed. Any ideas why this may be occurring?  Thanks.. -Jeff  

Up Down GridView Icon Image for Column Sorting

I'm trying to add an Ascending and Descending sort direction Icon Image next to the header text of my ASP.NET 2.0 Gridview Columns.I've searched and found some examples that seem to do this but have had difficult time recoding them from C# to VB or some just seemed overly complex for what I want to do.Does anyone have a simple VB solution for sort icons?Thanks,Ethan   

Sorting in Data GridView using c#

Sallam & Hi to all,well i m making a project in asp .net c# i used data gridview which is bound at run time after many calculations... problem occured when i want to sort it.. anybody help me...ThanksSaqib

Binding Web Service Result in asp:gridview and enable sorting(paiging)

Hello everyoneI have web service and gridviewI'm binding it without problemcode: protected void Page_Load(object sender, EventArgs e) { GetCallsService wservice = new GetCallsService(); List<Call> list = wservice.getCalls(2); GridView1.DataSource = list; //GridView1.AllowSorting = true; GridView1.DataBind(); } But I want to enable sorting and(or) paging.   GridView1.AllowSorting = true; this doen't solves problem.everything worls fine if I'm usign sqlDatasource but when datasource is web service it doesn't wokdoes enyone know solution?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend