We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridGroupingControls - No Results Found Display

Dear Syncfusion,

We are using v 4.2.0.37.

In our GGC, i want to display "No results found" message. I dont want to derive and paint as shown in the sample at http://64.78.18.34/Support/Forums/message.aspx?MessageID=38826

I am wondering if I can add a new row (similer to caption row being added at the top). This new row should look like any other row but span across all columns and should be able to display long string message.

We should be able to turn this on/off. Currently i want to use this for "No results found" display. But later i may display total no of rows displayed etc..

How can I do this?

Rgds
Rajani Kanth

15 Replies

AD Administrator Syncfusion Team September 27, 2006 04:54 AM UTC

Hi Rajani,

You will have to use the custom engine and derive the GridTableControl, overriding OnPaint method and draw the required Image to get an image stay on the GroupingGrid.

Here is a sample for implementing it.
http://www.syncfusion.com/Support/user/uploads/GGCNoRecordBackImage_68fe9286.zip

Let me know if you need any further assistance.

Regards,
Haneef


BR Badri Rajani Kanth September 27, 2006 08:43 AM UTC

Thank You Haneef,

But there is a problem using custom engine.
As I already reported (http://64.78.18.34/Support/Forums/message.aspx?MessageID=48782), all my grid will throw error while saving grid settings. So I cant use this unless the grid settings error is fixed by syncfusion.

Is there any work around for me?

Rgds
Rajani Kanth



BR Badri Rajani Kanth September 28, 2006 09:02 AM UTC

Haneef,

Can we not add a label to gridGroupingControl.GridTablePanel.Controls?

I added a label but it not displayed. No error also. If we can always display label next to the column header(when row count == 0), that should be fine. It appreas like a new row.

How can I do this?

Rgds
Rajani Kanth


AD Administrator Syncfusion Team September 28, 2006 09:22 AM UTC

Hi Rajani,

Try the below code

Label label = new Label();
label.Text = "No Results found";
label.Size = new Size(this.gridGroupingControl1.Size.Width,this.gridGroupingControl1.GroupDropPanel.ClientSize.Height );

this.gridGroupingControl1.GroupDropPanel.Controls.Add( label);

//Bring the label control to front of the Z - order.
label.BringToFront();

to add the label control to GroupDropPanel.

Best Regards,
Haneef


BR Badri Rajani Kanth September 28, 2006 09:52 AM UTC

Haneef,

Sdding label to GroupDropPanel is displaying the message above the column headers.

In similer lines, adding a label to GridTablePanel (instead of GroupDropPanel) is working fine.
And also I can make hide/show this label.

Now my question is, how Can I fix the location of this label.
It should always start at the location where normally a data row starts.
I have to keep all conditions (rowheader, grouped, with add new row, or any other).

Rgds
Rajani kanth


BR Badri Rajani Kanth September 28, 2006 10:05 AM UTC

Haneef,

When no data rows available, if we can find out the location of white area beginning (after the grid, which is diplayed in control color), that would be fine.

I mean the minumim location where we can get below flag false, in _TableControlMouseDown event.

bool clickedInsideGrid =
e.TableControl.PointToRowCol(new System.Drawing.Point(e.Inner.X, e.Inner.Y), out rowIndex, out colIndex);

Rgds
Rajani Kanth


BR Badri Rajani Kanth September 28, 2006 10:15 AM UTC

Haneef,

I am using the below lines to set the location..

int noOfRows = this.gridGroupingControl1.TableModel.RowCount;
int gridTotalHeight = this.gridGroupingControl1.TableModel.RowHeights.GetTotal(0, noOfRows);
this.label1.Location = new System.Drawing.Point(0, gridTotalHeight);

But I dont know if this works in all the conditions.

Can u plz look into this..

Rgds
Rajani Kanth


BR Badri Rajani Kanth September 28, 2006 10:31 AM UTC

Haneef,

Also I need one more event.

I want to display this label after the no of rows are found.

All my grids will be bound to dataviews/tables. And when no of rows in this dataviews/tables changes, which is the grid event that gets fired first, in which I can get grid rows count and apply the previous said grid height calculation? And this event should be fired only once.

Rgds
Rajani Kanth


AD Administrator Syncfusion Team September 28, 2006 10:57 AM UTC

Hi Rajani,

You can handle the TableControlPrepareViewStyleInfo event to set the location of the label control in a Grid. Please refer to the below code snippet to achieve this.

private void gridTableControlPrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTable table = e.TableControl.Table;
if( table.Records.Count == 0)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;

Element el = style.TableCellIdentity.DisplayElement;
if( el.Kind == DisplayElementKind.ColumnHeader && e.Inner.ColIndex == 0 )
{
GridCellRendererBase cr = e.TableControl.CellRenderers["TextBox"];
Point pt = cr.GetCellBoundsCore(e.Inner.RowIndex ,e.Inner.ColIndex).Location;
label.Location = new Point (pt.X,pt.Y + table.DefaultColumnHeaderRowHeight);
}
}
else
label.Location = new Point(-1000,-1000);
}

Sample : http://www.syncfusion.com/Support/user/uploads/GGCNoRecordBackImage_40f0d2d5.zip

Best Regards,
Haneef


BR Badri Rajani Kanth September 28, 2006 11:40 AM UTC

Haneef,

This eevent gets fired many times right. More that 10 times. Can I have another event that gets fired only once?

Rgds
Rajani Kanth


BR Badri Rajani Kanth September 28, 2006 11:51 AM UTC

Haneef,

Also, if I set add new row = true, this label will overlap that new row.

I this I am fine with the way of calculating grid height and placing label after that. Plz tell me if any thing wrong in that.

Now I just want an event that gets fired only once when no of rows changed, from 0 to max/max to 0.

Rgds
Rajani Kanth


BR Badri Rajani Kanth October 3, 2006 08:53 AM UTC

Haneef,

Can you plz reply me.

Rgds
Rajani Kanth


AD Administrator Syncfusion Team October 3, 2006 09:22 AM UTC

Hi Rajani,

The CustomSectionInGroup browser samples demonstrates how to customize the layout of grid. It adds a custom section for each group and displays the SummarySection above the details. The sample also shows how to derive custom elements from the Group and the ChildTable and how to hook them into a customized Engine object. Below is a sample path

\Syncfusion\Essential Studio\4.3.0.25\windows\Grid.Grouping.Windows\Samples\CustomSectionInGroup\cs

Also refer to the KnowledgeBase article "How do I efficiently customize the child table/group by using a custom engine?" for more information.

http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=363

Thanks,
Haneef


BR Badri Rajani Kanth October 4, 2006 09:56 AM UTC

Hi Haneef,

As I said earlier, adding label is working fine.

Now I just want to know if there any event which gets fired first and only once when the no of records changed in the grid data source. Assuming that first can max records then min, then zero and then can be any number. I am trying with list data change events.

Rgds
Rajani Kanth


AD Administrator Syncfusion Team October 5, 2006 10:12 AM UTC

Hi Rajani,

The TableSourceListChanged event arises whenever the datasource changes. Or you can even use the SourceListRecordChanged event when any record is changed in the GridGroupingControl. Let me know if this helps.

Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon