
Hi,
I would like to send a GridView to the RadGridReportingLite in order to create a report. Since I need to change the grouping and sorting of the GridView for the report with no effect on the display, I thought of cloning the GridView, send it to the RadGridReportingLite and dispose it.
There is no method of deep copying of the GridView so what I do is:
The following code snippet demonstrates it.
// Create a new grid for the report.RadGridView grdReport = new RadGridView();// Clone the dataset with the original data.DataSet dsReport = ((DataView)grdOriginal.DataSource).Table.DataSet.Copy();// Set it as the new grid's data source.grdReport.DataSource = dsReport.Tables[0].DefaultView;// Create a stream in the memory.using (MemoryStream stream = new MemoryStream()){ // Save the grid to the stream. grdOriginal.SaveLayout(stream); stream.Seek(0, SeekOrigin.Begin); // Load the original grid layout to the new one. grdReport.LoadLayout(stream);}When I execute this code I get an exception from the RadGridReportingLite, because the GridView is empty. The GridView is never displayed so the binding doesn’t occur. What I’m asking is how do I execute the binding explicitly (something like the DataBind() method in ASP.NET)?
BTW, is there a better way to achieve this functionality?
I’m using 2010 Q1 SP controls.
Thanks in advance,
Sharon.
radProgressBarSearchLocal.Minimum = 0;
radProgressBarSearchLocal.Maximum = 100;
radProgressBarSearchLocal.StepWidth = 12;
radProgressBarSearchLocal.Text =
"Loading Collection...";
radProgressBarSearchNetwork.Minimum = 0;
radProgressBarSearchNetwork.Maximum = 100;
radProgressBarSearchNetwork.StepWidth = 12;
radProgressBarSearchNetwork.Text =
"Loading Collection...";
radProgressBarSearchOutlook.Minimum = 0;
radProgressBarSearchOutlook.Maximum = 100;
radProgressBarSearchOutlook.StepWidth = 12;
radProgressBarSearchOutlook.Text =
"Loading Collection...";
totalitems = 0L;
processeditems = 0L;
radBack.Enabled =
false;
radCancel.Enabled =
false;
radNext.Enabled =
false;
radFilterLDCollection.Enabled =
false;
radFilterNDCollection.Enabled =
false;
radFilterOutlookCollection.Enabled =
false;
radSearchLDCollection.Enabled =
false;
radSearchOutlookCollection.Enabled =
false;
radSearcNDhCollection.Enabled =
false;
Program.myIndex = null;
this.Cursor = Cursors.WaitCursor;
whichbackground = 1;
backgroundWorker1.RunWorkerAsync();
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
switch (Program.activeCollection)
{
case COLLECTION_TYPE_LOCALDRIVES:
radProgressBarSearchLocal.Text = e.UserState.ToString();
radProgressBarSearchLocal.Value1 = e.ProgressPercentage;
radProgressBarSearchLocal.ProgressBarElement.PerformStepValue1();
radProgressBarSearchLocal.Refresh();
break;
case COLLECTION_TYPE_NETWORKDRIVES:
radProgressBarSearchNetwork.Text = e.UserState.ToString();
radProgressBarSearchNetwork.Value1 = e.ProgressPercentage;
radProgressBarSearchNetwork.ProgressBarElement.PerformStepValue1();
radProgressBarSearchNetwork.Refresh();
break;
case COLLECTION_TYPE_OUTLOOK:
radProgressBarSearchOutlook.Text = e.UserState.ToString();
radProgressBarSearchOutlook.Value1 = e.ProgressPercentage;
radProgressBarSearchOutlook.ProgressBarElement.PerformStepValue1();
radProgressBarSearchOutlook.Refresh();
break;
}
}
| if (showAll.CheckState != CheckState.Checked) { |
| FilterExpression _filter = new FilterExpression(FilterExpression.BinaryOperation.AND, |
| GridKnownFunction.EqualTo, |
| GridFilterCellElement.ParameterName); |
| _filter.Parameters.Add(GridFilterCellElement.ParameterName, 123); |
| Grid1.MasterGridViewTemplate.FilterExpressions.Clear(); |
| Grid1.Columns["ID"].Filter = _filter; |
| } |
| else { |
| Grid1.MasterGridViewTemplate.FilterExpressions.Clear(); |
| Grid1.Columns["ID"].Filter = null; |
| } |