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

System.Web.HttpException during binding gridview

Hi I have an asp.net gridview control. I have used pagging but when I click on grid for pagging it shows the following error
Error: A Runtime Error has occurred.Do you wish to Debug?
Line: 4723
Error: Sys.WebForms.PageRequestManagerServerErrorExceptio n: The GridView 'dgridAlarms' fired event PageIndexChanging which wasn't handled.


Here is code
Expand|Select|Wrap|Line Numbers
  1.  protected void Page_Load(object sender, EventArgs e)
  2.         {
  3.             if (IsPostBack) return;
  4.             FillAlarms("ALL");
  5.         }
  6.  
  7.  public MySite.AlarmList FillAlarms(string type)
  8.         {
  9.             MySite.Alarms obAlarms = new MySite.Alarms();
  10.  
  11.             //MySite.DataCollection<MySite.Alarms> obCollection = new MySite.DataCollection<MySite.Alarms>();
  12.  
  13.             MySite.AlarmList obCollection = new MySite.AlarmList();
  14.  
  15.             try
  16.             {
  17.  
  18.                 if (type == "ALL")
  19.                 {
  20.                     obCollection = obAlarms.GetAllAlarms(MySite.AlarmRetrieveType.All);
  21.                 }
  22.                 else if (type == "ACKNOWLEDGED")
  23.                 {
  24.                     obCollection = obAlarms.GetAllAlarms(MySite.AlarmRetrieveType.Acknowledged);
  25.                 }
  26.                 else
  27.                 {
  28.                     obCollection = obAlarms.GetAllAlarms(MySite.AlarmRetrieveType.NotAcknowledged);
  29.                 }
  30.  
  31.                 if (obCollection.Count > 0)
  32.                 {
  33.                     dgridAlarms.DataSource = obCollection;
  34.                     dgridAlarms.DataBind();
  35.                 }
  36.  
  37.                 return obCollection;
  38.             }
  39.             catch
  40.             {
  41.                 throw;
  42.             }
  43.             finally
  44.             {
  45.  
  46.             }
  47.  
  48.         }
  49.     }
  50.  
Here AlarmList is
Expand|Select|Wrap|Line Numbers
  1.   public class AlarmList : List<Alarms >
  2.     {
  3.  
  4.     }
  5.  
Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="dgridAlarms" runat=server AllowPaging=true 
  2.                                         onselectedindexchanging="dgridAlarms_SelectedIndexChanging" ></asp:GridView>
  3.  
Dec 19 '08 #1
1 3095
sorry it was my mistake.. i didn't use
Expand|Select|Wrap|Line Numbers
  1.   protected void dgridAlarms_PageIndexChanging(object sender, GridViewPageEventArgs e)
  2.         {
  3.             dgridAlarms.PageIndex = e.NewPageIndex ;
  4.  
  5.             FillAlarms("ALL");
  6.         }
  7.  
Dec 19 '08 #2

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

Similar topics

0
by: Amy | last post by:
Hi, I'm suddenly getting this error when I post back from my application. the application worked once, i added some code on one page (customizing a datagrid), and suddenly I'm getting this...
0
by: Jack Wright | last post by:
Dear All, I have a web Application "http://localhost/Web/WebForm1.aspx" that calls a WebService from "http://localhost/webserviceapp/service1.asmx"...I have set the executionTimeout to 10 secs in...
8
by: A P | last post by:
Hi! I'm using ASP.Net Web Matrix on my PC and wanting to publish the files to our server. I try to copy (thru explorer) the files but it didn't work! I receive Runtime Error: Server Error...
5
by: Amit | last post by:
Hello, I have a simple search screen, with two drop-downs and a text box. There's also a GridView control that is using a SqlDataSource control to show the matching results. The SqlDataSource uses...
2
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
1
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
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...
4
by: Mike | last post by:
I'm having trouble getting a gridview to bind. I probably missing something completely obvious and would appreciate any help on offer. I'm passing parameters via querystring, and have created a...
1
by: waihung.wee | last post by:
Hi I got the following error in my xxx.cs file (code behind file) According to the error message, I should add a form tag in the file. But form tag should not appear in a code behind file ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.