in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

GetSelectedFieldValues method can not pick right value after delete operation

Last post 8/22/2008 4:11 AM by tao wang. 1 replies.
Page 1 of 1 (2 items)
Sort Posts:
Previous Next
  • 8/21/2008 11:52 AM

    GetSelectedFieldValues method can not pick right value after delete operation

    Hi

    i have exprienced a issus which i dont know whether or not it is my own mistake or bug

    this is my code :

    int primaryID = (int)GV.GetSelectedFieldValues(uniquID)[0];

    i have set my gridview as multi selection, and when i click (not with control key) New to add new row it can pick up the current selected row primaryID, but once i delete whatever which row in a gridview, and then next time i am going to click New to add new row, the primaryID i picked up by the method above is the row i already deleted,...

    however i have also attached whole codes in my function as followed (dont know its my design falut or what, the function is designed to insert an new row  in which position they did click to do the insert...) :

     public static void orderGridView(DevExpress.Web.ASPxGridView.ASPxGridView GV, SqlDataSource DS,string uniquID,string orderID,System.Web.SessionState.HttpSessionState tempSession, string sessionID)
      {
      if (GV.GetSelectedFieldValues(uniquID).Count != 0)
      {
      double tempValue1 = 1.0;
      int primaryID = (int)GV.GetSelectedFieldValues(uniquID)[0];
      DataView tempDataView = (DataView)DS.Select(DataSourceSelectArguments.Empty); //get dataview in select view of current DB

      int order_idCol = tempDataView.Table.Columns[orderID].Ordinal;
      int primaryCol = tempDataView.Table.Columns[uniquID].Ordinal;

      for (int i = 0; i < tempDataView.Table.Rows.Count; i++)
      {
      int compare = (int)tempDataView.Table.RowsIdea[primaryCol];
      if ( compare == primaryID)
      {
      if ((i + 1) < tempDataView.Table.Rows.Count) //make sure it is not last row in a table
      {
      int j = i + 1;
      double value1 = (double)tempDataView.Table.RowsIdea[order_idCol];
      double value2 = (double)tempDataView.Table.Rows[j][order_idCol];
      double sum = value1 + value2;
      double diviedValue = sum / 2;
      tempSession.Add(sessionID,diviedValue);
      }
      else //if it is last row in a table ,make default value as 0.5
      {
      double lastRow = (double)tempDataView.Table.RowsIdea[order_idCol];
      double plusValue = lastRow + 1.0 ;
      tempSession.Add(sessionID, plusValue);
      }
      break;
      }
      }
      if (tempDataView.Table.Rows.Count == 0) tempSession.Add(sessionID, tempValue1);  
      }
      }

     

    thank you

     

     

  • 8/22/2008 4:11 AM In reply to

    Re: GetSelectedFieldValues method can not pick right value after delete operation

    hi,

    i got solution myself,,

    just put two commands before the select

    says:

    gv.selection,unselectall();

    gv.bind();

     

    hope it helps other people

Page 1 of 1 (2 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED