This is a migrated thread and some comments may be shown as answers.

RadGrid select and grouping feature not working on next rebind of RadGrid

2 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jomar
Top achievements
Rank 1
Jomar asked on 20 Jul 2010, 07:37 PM
Hi,

I have created a RadGrid (_grdDocuments) inside RadAjaxPanel. I just need to enable multi-row selection and grouping in that RadGrid so below are the codes I have used. Data of the RadGrid is gathered thru a dropdown value say (Company1, Company2, Company3).

Initially when data is loaded in the RadGrid, you can select a row or even group the grid based on the dragged column name.

Now when you change the value of the dropdown say Company 2, you cannot select or group in the Grid anymore. Why? Am I missing something here?

This is WSS 3.0 WebPart application. No client or server events attached.

I am using Telerik version 2008.3.1314.35


Thanks


-----------------------------------------------------------------------------------------------------

        private void InitGrid2()
        {
            try
            {
                _grdDocuments2.ID = "_grdDocuments2";
                _grdDocuments.Skin = "Forest";

                // No Wrapping
                _grdDocuments2.HeaderStyle.Wrap = false;
                _grdDocuments2.FooterStyle.Wrap = false;
                _grdDocuments2.PagerStyle.Wrap = false;
                _grdDocuments2.ItemStyle.Wrap = false;
                _grdDocuments2.AlternatingItemStyle.Wrap = false;
                _grdDocuments2.SelectedItemStyle.Wrap = false;

                // set general properties
                _grdDocuments2.AllowAutomaticDeletes = false;
                _grdDocuments2.AllowAutomaticInserts = false;
                _grdDocuments2.AllowAutomaticUpdates = true;
                _grdDocuments2.AllowPaging = true;
                _grdDocuments2.MasterTableView.PagerStyle.HorizontalAlign = HorizontalAlign.Left;
                _grdDocuments2.AllowSorting = true;
                _grdDocuments2.AllowFilteringByColumn = false;
                _grdDocuments2.EnableViewState = true;
                _grdDocuments2.AutoGenerateColumns = true;
                _grdDocuments2.GridLines = GridLines.Both;
                _grdDocuments2.PageSize = 20;
                _grdDocuments2.GroupingEnabled = true;
                _grdDocuments2.ShowGroupPanel = true;
                _grdDocuments2.ShowHeader = true;
                _grdDocuments2.ShowFooter = false;

                _grdDocuments2.ClientSettings.Selecting.AllowRowSelect = true;
                _grdDocuments2.AllowMultiRowSelection = true;
                _grdDocuments2.MasterTableView.EditMode = Telerik.Web.UI.GridEditMode.InPlace;

                // Set client properties
                _grdDocuments2.ClientSettings.AllowColumnsReorder = true;
                _grdDocuments2.ClientSettings.AllowDragToGroup = true;
                _grdDocuments2.ClientSettings.AllowRowsDragDrop = true;
                _grdDocuments2.ClientSettings.Resizing.ResizeGridOnColumnResize = true;
                _grdDocuments2.ClientSettings.Resizing.AllowColumnResize = true;


            try 
            {

                if (CurrentKey != string.Empty)   //CurrentKey value is coming from Company dropdown.
                {

                    DataSet testData = new DataSet();

                    // Apply a schema from the file...
                    testData.ReadXmlSchema(Page.Server.MapPath("/GridSchema.xsd"));

                    testData.Tables[0].Columns[Document._FIELD_DOC_EXPIRATION_DATE].AllowDBNull = true;
                    testData.Tables[0].Columns[Document._FIELD_DOC_CREATED_DATETIME].AllowDBNull = true;
                    testData.Tables[0].Columns[Document._FIELD_DOC_MODIFIED_DATETIME].AllowDBNull = true;
                    testData.Tables[0].Columns[Document._FIELD_DOC_SIGNED_DATETIME].AllowDBNull = true;

                    string xmlData = string.Empty;

                    xmlData = LoadData(CurrentKey);

                    if (xmlData != string.Empty)
                    {
                        // Now we have a string, so put it in a dataset
                        StringReader readerString = new StringReader(xmlData);

                        testData.ReadXml(readerString);
                    }

                    _grdDocuments2.DataSource = testData;
                    _grdDocuments2.DataMember = testData.Tables[0].TableName;

                    _grdDocuments2.DataBind();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
       }

2 Answers, 1 is accepted

Sort by
0
Jomar
Top achievements
Rank 1
answered on 21 Jul 2010, 01:44 PM
Anyone?
0
Jomar
Top achievements
Rank 1
answered on 22 Jul 2010, 09:14 PM
Ok I have found out that the cause of this is the call to RaisePostBackEvent of RadAjaxPanel of the Grid.

So instead of _pnlGrid.RaisePostBackEvent(), I have used _pnlGrid.ResponseScripts.Add(.....)

What's with the RaisePostBackEvent? Why is it locking the functionality of the RadGrid?
Tags
Grid
Asked by
Jomar
Top achievements
Rank 1
Answers by
Jomar
Top achievements
Rank 1
Share this question
or