Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
520
Cancel click event of UltraWebGrid
posted

I am handling the Click event of a hierarchical UltraWebGrid.  Upon clicking any cell of a child row, I want to redirect to another page.  I have the code below.  I find that even when I click on a parent row,
the form is being submitted although I have e.Cancel = true.  Is there a way to prevent the form from being submitted in this case? :

   1:          void GridMain_Click(object sender, ClickEventArgs e)
   2:          {
   3:              UltraGridRow row = null;
   4:              if (e.Row != null)
   5:                  row = e.Row;
   6:              else if (e.Cell != null)
   7:                  row = e.Cell.Row;
   8:   
   9:              if (row != null && row.Band.Index == 1)
  10:              {
  11:                  int fundId = (int)row.Cells.FromKey("FundId").Value;
  12:                  Context.Items.Add("FundId", fundId);
  13:                  Server.Transfer("~/fund.aspx", true);
  14:              }
  15:              else
  16:              {
  17:                  e.Cancel = true;
  18:              }
  19:          }
Parents
No Data
Reply
  • 49378
    posted

    Hi cs31415,

    In this scenario I would suggest handling the CellClick client side event of the grid. Then in its handler you could use something similar to:


    if (igtbl_getCellById(cellId).Band.Index == 1) {
        Server.Transfer(
    "~/fund.aspx", true);
    }

    If you need to cancel a postback, returning true from the client side handler should be what you are looking for.

    Please do not hesitate to contact me if you have any questions.

    Best Regards,

    Petar Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://ko.infragistics.com/support

     

     

Children
No Data