Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."

and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".

 

Here is my event handling...

protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e)

{

try

{

AdhocJobGridView.DataSource = wsBaseInfoArray;

AdhocJobGridView.PageIndex = e.NewPageIndex;

AdhocJobGridView.DataBind();

}

catch (Exception ex)

{

throw ex;

}

 

Here is my aspx...

<asp:GridView ID="AdhocJobGridView" runat="server"

AutoGenerateColumns="false"

AlternatingRowStyle-BackColor="LightYellow"

SelectedRowStyle-BackColor="LightGray"

AutoGenerateSelectButton="true" DataKeyNames="jobGroupID"

HorizontalAlign="NotSet"

AllowPaging="false"

PageSize="15"

onpageindexchanged="AdhocJobGridView_PageIndexChanged"

Font-Names="calibri"

Font-Size="medium">

<pagersettings mode="Numeric"

position="bottom"

pagebuttoncount="10"/>

<pagerstyle backcolor="Lightgrey"/>

<Columns>

<asp:BoundField HeaderText="Plan/Group/Job" DataField="jobGroupName" ReadOnly="true" />

<asp:BoundField HeaderText="Job" DataField="code" />

<asp:BoundField HeaderText="Description" DataField="description" />

</Columns>

<SelectedRowStyle BorderColor="Red"></SelectedRowStyle>

</asp:GridView>

Any ideas as to what I am missing?

Thanks

 

P.S. I dont need the sorting so that part was purposefully left out!

0
mathiasX
3/16/2009 9:59:57 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

4 Replies
3056 Views

Similar Articles

[PageSpeed] 35

mathiasX:

and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".

 

Here is my event handling...

protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e)

{

try

{

AdhocJobGridView.DataSource = wsBaseInfoArray;

AdhocJobGridView.PageIndex = e.NewPageIndex;

AdhocJobGridView.DataBind();

}

catch (Exception ex)

{

throw ex;

}

 

The PageIndexChanged event the signature is (object sender, EventArgs e) NOT (object sender, GridViewPageEventArgs e) .

The signature you are using matches with PageIndexChanging event.

http://ryanolshan.com/articles/c-gridview-sorting-paging-w-o-a-datasourcecontrol-datasource/


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
3/17/2009 1:13:16 AM

I am trying to use the code that is represented in the FAQ on this forum as follows...

http://forums.asp.net/t/1352646.aspx#_1.1_Sorting_and 

As you can see from that example I they are able to use the GridViewPageEventArgs e object. I am basically trying to imlement the same code but without the sorting portion.  If I use the EventArgs e object I wont have access to the e.NewPageIndex property, which I need per the example.  Unless there is another way of extracting the e.NewPageIndex property that I am overlooking?

0
mathiasX
3/17/2009 4:37:55 AM

mathiasX:

I am trying to use the code that is represented in the FAQ on this forum as follows...

http://forums.asp.net/t/1352646.aspx#_1.1_Sorting_and 

As you can see from that example I they are able to use the GridViewPageEventArgs e object. I am basically trying to imlement the same code but without the sorting portion.  If I use the EventArgs e object I wont have access to the e.NewPageIndex property, which I need per the example.  Unless there is another way of extracting the e.NewPageIndex property that I am overlooking?

 

The sample codes in the link uses PageIndexChanging and in your codes you are using PageIndexChanged event which is incompatible with the signatures you used.. Please note that the two events are a bit different.. So you need to use PageIndexChanging event instead..


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
3/17/2009 4:52:25 AM

Nice catch!  Sometimes I can't see the forest for all these damn trees in the way!  Thanks vinz!

0
mathiasX
3/17/2009 6:24:02 AM
Reply:

Similar Artilces:

Problem to use TreeView Control in a 'content page' This Error Occur "Only Content controls are allowed directly in a content page that contains Content controls."
hi I am trying to use the TreeView Control inside the content page (Page that has a master page is a content page). On compiling the project I got the following ASP.Net runtime error: "Only Content controls are allowed directly in a content page that contains Content controls."B@b@R J Issue resolved. I was putting script tag in the content page that is not allowed. when remove the script from content page problem is resolved.B@b@R J...

Error Rendering Control ... using the Title property of Page requires a header control on the page. (e.g. <head runat="server" />
Hi All,I have a custom control that inherits from CompositeControl and implements INamingContainer and IPostBackDataHandler.  The control is an intelligent BreadCrumb generator for use on a MasterPage.  It generates LinkButtons for the crumbs based on Server.Transfer() calls to and from ClientPages.Instead of the control rendering as the value of its Text property on the aspx page (which it did when I first started it), I get the following error ***************** Error Rendering Control - ControlNameAn unhandled exception has occurred.Using the Title property of the Page ...

History control: Navigating away from and "back" to a page using History control.
Hi,Another little issue with the History control.  This one has been racking my brain now for some time, but I think I've narrowed it down to what is actually causing the problem.  My setup: I have a page that is a Repeater (or Gridview, both have this bug) listing of data, that is Paged AND/OR Filtered by a keyword, and is in an UpdatePanel so that it is AJAX style paging and filtering.  I'm using the History control from the May Futures -- the main point of this (and what is mainly broken) is so that when users click on a item in the Repeater and go to the details vi...

How to use "Page base Type" and "User Control base Type"
Who can give me a sample about "How to use 'Page base Type' and 'User Control base Type' "?thanks!...

Passing Data from View to Controller: Use controller parameters or Request.Form["..."]
I develop a small mvc web application (similar to dotnetkicks or kigg ;) ). I read a lot of blog posts, tutorials and saw the great videos from ScottHa.In this blogpost show us Scott how to passing data from the view to the contoller.One time he use this syntax: public void Create(string ProductName, int CategoryID...) {...}Later he recommand to use the Binding Helper - without using any method parameters. The Binding Helper is a very nice time saver, but in my opinion the "parameter"-way would be better, because everyone see, what this method "need" to work and its...

"Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control" when using cascading dropdown list in Gridview
Hi, it seems my sad little attempts at developing ASP.NET web page are full of problems.. Earlier I asked a question about using a dropdown list in the gridview to update a table. Someone helped me with that. Thank you. But now I run into another problem after solving that one... Basically, I have a gridview control that reads data from the main table (table name: transaction). When a user clicks the "Edit" link, the user will be able to select an item from a dropdown list, which reads from a second table (table name: source), and when the user click "Update" li...

Sorting in GridView control across pages using a List<> as the data source
Hi All, Ok so I am relatively new to asp.net and am not sure if this is the best way to implement this but I have the following... 1) A GridView with a number of columns which are bound to a list though TemplateFields which has both column sorting and paging on. 2) A Method bind the grid view coded as follows private void BindGridViewData(String sortExpression, String sortOrder) { TestModel aModel = new TestModel(); List models = (List)aModel.GetModels(); if (sortExpression == "ModelId") models.Sort(new ModelComparer()); gvMyGrid.DataSource = models; ...

Finding a control in the master page from within a control on the "child" page....
I've seen several examples of finding controls, but I'm struggling with this.  I want to turn a panel to visible and set a label's text field from within a control... All the examples that I've seen, including the really good one at MSDN2 shows Master.FindControl.  When I use that, it says Master is not declared.  Is there an easy way to set the panel and the label from within the control? Am I close? '---------- My Master page...abbreviated... <%@ Master Language="VB" CodeFile="Secure_Master.master.vb" Inherits="MasterPage" %><%@ Register TagPrefix="cc" TagName="men...

Best method for handling events for a single page that uses dymanic controls to "become" 10+ different paged
I have an aspx page with dynamic controls that can end up looking like 10+ completely different pages depending on the xml file it's pointed at....My problem is that I need to then write & wire-up the events for all the controls that could appear on the page under any given configuration in the code behind.This has two major downfalls...1) Its not very dynamic  2) It makes the code behind grossly over cluttered with events; of which it will only use a small portion at any given time.Is there anyway I can solve these problems?Could I possibly call .NET methods via Javascript/Ajax...

"How to refresh only content page using ajax control"
hi i have created master page and there are 5 menu items. i want to refresh only content page while clicking on particular menu, but it is not working. where is the error ? my code is <asp:ScriptManager  ID="ScriptManager1"  runat="server"/> <asp:UpdatePanel   ID="UpdatePanel2"  UpdateMode="Conditional"  runat="server"> <ContentTemplate> <div class="size"> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentpla...

What control do I use (or do I not use a control at all...)
Okay so here's the story so far. I am making a blog to be incorporated into a website. Well, I'm doing the blog from scratch. I'm using MySQL to source all the data via MySQL .NET/Connector. Now while developing the script, I used DataReader and Response.Write to show the blog topics. Now that it has come to put it under a design (I'm using a Master Page for that), I've hit the problem. Response.Write shows all the topics before any of the design elements could be incorporated. So that (more or less) is out of question. So next I looked into the data presentation controls. I looked up GridVi...

I need a solution to disallow the Internet Explorer message "An ActiveX controle in this page might be unsafe to interact with other parts of the page...." without using the I.E option
I can't use the option in Internet Explorer /Tools/InternetOptions/Security/CustomLevel/Activex Control and Plugs in => enable, because I do not have permissions.So how do I do to substitue this by using VBscript language ?Think you in advance for your help ! Hi, and welcome to the forums. You cannot, and certailny should not be able to, control det security level of the clients browser like this. -- Tarjei ...

Controlling user access using "allow" "deny"
I have a web form application for deployment on Windows 2000 Server.  I wish to limit access to the web site to a certain group of users, all having accounts on the server.  The authentication mode is "Windows", impersonate ="true"...  From my reading, this seems the perfect situation to use "roles=" within the authentication block.  I must admit, however, that I am not a server admin guru.  What is a "role" in terms of 2000 server?  What sort of group, organizational unit, etc. would be created on the server to act as a "role"?  Any light shed would be app...

If I need "Sort" and "Paging" should I use DataList or DataGrid?
I using C# 1.0 , I get Data From SQL 2000 as a DataSet In Header have 5 columns (Date, Items, Action, User , Record) when user click the Date Column of Header , then sort record and in footer I need it shows like →  1234/ Page [TextBox][Button] the 1234 means have total 4 pages and the TextBox allow user to input which Page want to jump toafter click the button then we will jump to the page user input to TextBox if I need these 2 function (sorting and paging) which control I should use?is DataGrid or DataList? or maybe need repeater? thank you If thats the case then I would sugg...

Web resources about - Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..." - asp.net.presentation-controls

Resources last updated: 1/19/2016 11:35:25 AM