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

RAD Grid drill up and drill down

2 Answers 346 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Goran
Top achievements
Rank 1
Goran asked on 20 Sep 2011, 08:50 AM
Hi,

I create share point web part with Rad Grid control. Here is the code for grid

<telerik:RadGrid ID="gvTasks" runat="server" AutoGenerateColumns="False"
            CellSpacing="0" GridLines="None" AllowSorting="True" ShowGroupPanel="True">
            <ClientSettings AllowDragToGroup="True" AllowExpandCollapse = "false">
            </ClientSettings>
<MasterTableView>
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
  
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
  
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
  
    <Columns>
        <telerik:GridBoundColumn DataField="Title"
            FilterControlAltText="Filter column column" HeaderText="Naslov"
            UniqueName="column">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Task_x0020_priority"
            FilterControlAltText="Filter column1 column" HeaderText="Prioritet"
            UniqueName="column1">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Task_x0020_Status"
            FilterControlAltText="Filter column2 column" HeaderText="Status"
            UniqueName="column2">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Task_x0020_start_x0020_date"
            DataFormatString="{0:d}" FilterControlAltText="Filter column3 column"
            HeaderText="Početak" UniqueName="column3">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Task_x0020_due_x0020_date"
            DataFormatString="{0:d}" FilterControlAltText="Filter column4 column"
            HeaderText="Rok" UniqueName="column4">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Task_x0020__x0025__x0020_complet"
            FilterControlAltText="Filter column5 column" HeaderText="Procenat"
            UniqueName="column5">
        </telerik:GridBoundColumn>
    </Columns>
  
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
  
<FilterMenu EnableImageSprites="False"></FilterMenu>
  
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>
After that I populate RADGrid with listitemcollection based on sharepoint list. I do that on button event

protected void btnSearch_Click(object sender, EventArgs e)
        {
            web = site.OpenWeb();
            //QuerySerarch qs = new QuerySerarch();
  
                #region Filtered tasks
                SPQuery queryTasks = new SPQuery();
                queryTasks.Query = string.Concat(
                               "<Where>" +
                    // "<And>" +
                                   QuerySearch.QueryTaskList(ddProject.SelectedItem.Text, "", "", "", "", "", ""),
                    // "</And>" +
                               "</Where>"
                               );
                SPList listTasks = web.Lists["Project tasks"];
                SPListItemCollection itemsTask = listTasks.GetItems(queryTasks);
                DataTable ds = itemsTask.GetDataTable();
                gvTasks.DataSource = ds;
                gvTasks.DataBind(); // List field holding value - first column is called Title anyway!
                gvTasks.Visible = true;
                #endregion
        }


After button clicking I create some grouping on my grid but data source is null. If I click on button again I have what  I need (grouping)
After that I can make drill up and drill down without problems but I still have issue that force me to click button before
I see results.




After that I realize that I must bind RAD Grid on every event that happen on drill up and drill down in this case this is postback event.
After that I see results as I expected but when I try to drill up or drill down I have an error.


Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.


Please help.


Thanks

2 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 22 Sep 2011, 02:08 PM
Hello Goran,

I have examined your code and I noticed that you use Simple Data-binding. With it grouping is not supported.
Please use Advanced Data-binding (using NeedDataSource event) instead.

I hope this helps.

All the best,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Goran
Top achievements
Rank 1
answered on 22 Sep 2011, 02:24 PM
Fantastic it works!

Thanks,
Goran
Tags
Grid
Asked by
Goran
Top achievements
Rank 1
Answers by
Mira
Telerik team
Goran
Top achievements
Rank 1
Share this question
or