Beispiel #1
0
    //end grid call back
    /// <summary>
    /// javascript added to rows on the fly so we can track what has been ticked
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgdvOrder_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
    {
        if (e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Data)
        {
            DevExpress.Web.ASPxGridView.ASPxGridView _grid = (DevExpress.Web.ASPxGridView.ASPxGridView)sender;
            //string _hfKey = "key" + e.KeyValue.ToString(); //this seems to be problematic (string too big for key??)
            //string _hfKey = "key" + e.GetValue("OrderID").ToString();
            string _hfKey = "orderidkey";

            //find order id
            //string _test = e.GetValue("OrderID").ToString();

            //find template controls
            DevExpress.Web.ASPxGridView.GridViewDataColumn _col1 = (DevExpress.Web.ASPxGridView.GridViewDataColumn)_grid.Columns["chkcustom"];
            DevExpress.Web.ASPxEditors.ASPxCheckBox        _chk  = (DevExpress.Web.ASPxEditors.ASPxCheckBox)_grid.FindRowCellTemplateControl(e.VisibleIndex, _col1, "dxchktick");
            //var _chk = (DevExpress.Web.ASPxGridView.Rendering.GridViewTableCommandCell)e.Row.Cells[0];
            //and pass data from hidden field if it's stored - make sure text box is ticked
            if (_chk != null)
            {
                _chk.ClientSideEvents.CheckedChanged = "function(s,e){rowTicked(" + e.GetValue("OrderID") + "," + e.GetValue("OrderNumber") + ");}";

                if (this.dxhfsource.Contains(_hfKey))
                {
                    if (this.dxhfsource.Get("orderidkey").ToString() == e.GetValue("OrderID").ToString())
                    {
                        _chk.Checked = true;
                    }
                }
            }
        }
    }
Beispiel #2
0
 /// <summary>
 /// remove all groupings from aspxdatagrid
 /// </summary>
 ///
 public static void remove_dxgrid_grouping(DevExpress.Web.ASPxGridView.ASPxGridView grid)
 {
     try
     {
         for (int i = 0; i < grid.Columns.Count; i++)
         {
             if (grid.Columns[i] is DevExpress.Web.ASPxGridView.GridViewDataColumn)
             {
                 DevExpress.Web.ASPxGridView.GridViewDataColumn _gridViewDataColumn = (DevExpress.Web.ASPxGridView.GridViewDataColumn)grid.Columns[i];
                 if (_gridViewDataColumn.GroupIndex > -1)
                 {
                     grid.UnGroup(_gridViewDataColumn);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         string _result = ex.Message.ToString();
         //Response.Write(ex.Message.ToString());
         //this.lblmsgboxdiv.Text += "<div class='alert'>Error description" + ": " + ex.Message.ToString() + "</div>";
     }
 }