By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,883 Members | 1,952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,883 IT Pros & Developers. It's quick & easy.

System.Web.HttpException during binding gridview

P: 70
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
Share this Question
Share on Google+
1 Reply


P: 70
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

Post your reply

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