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

Display no rows found when no data is in datasource

8 Answers 571 Views
GridView
This is a migrated thread and some comments may be shown as answers.
RAGHAVENDRA
Top achievements
Rank 1
RAGHAVENDRA asked on 19 Jan 2011, 05:06 PM
Hello All,
I have a rad gridview for winforms. I am using Q3 SP 2010. I am trying to display NO DATA FOUND when we dont find any data in the dataset. I had a look at other forms and tried doing this.
me.radgridview.TableElement.Text="No data found"
But I am not able to access the "TableELement" property. I know with telerik it would be some where down the hierarchy. Any help would be great. Thanks in advance.

8 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 19 Jan 2011, 05:22 PM
Hello,

It is indeed RadGridView.TableElement.Text that you need to assign the text to. Once you have set your datasource, and are still showing the header rows, you can still set the text in the following way.
Me.RadGridView1.DataSource = BindingSource1
If Me.RadGridView1.Rows.Count = 0 Then
    Me.RadGridView1.TableElement.Text = "NO DATA FOUND"
End If

(see screenshot)

If you don't have TableElement on an instance of radGridView, then I'd suggest ensuring that you are using all the latest versions of the RadControls assemblies in case you are still using an old one.
Hope that helps
Richard
0
RAGHAVENDRA
Top achievements
Rank 1
answered on 19 Jan 2011, 05:34 PM
Hello Richard,
I am using Q3 SP 2010. I think after that there was only one release that too very recently. Dont we have this in Q3 SP 2010?
Is this going to be a problem since i dont use a dataosurce.

 

For Each relationship In Me.Items

 

RadGridView.Rows.Add(CorporationName, _

EffectiveDate, _

Description, _

Id)

 

Next

 

0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 19 Jan 2011, 05:40 PM
Hello,

I am also using Q3 2010 SP1. In your project, please can you check the version of each of the following assemblies that are being referenced.
  • Telerik.WinControls
  • Telerik.WinControls.UI
  • Telerik.WinControls.GridView
  • TelerikCommon

Also, if you can set

Me.RadGridView1.GridElement.Text = ""
then Visual Studio should tell you that the property "GridElement" is obsolete and you should use TableElement.

Look forward to hearing back from you
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 19 Jan 2011, 05:41 PM
Apologies, I missed one of your questions. No, not using a datasource should not affect this.
Richard
0
RAGHAVENDRA
Top achievements
Rank 1
answered on 19 Jan 2011, 05:47 PM
It doesnt tell me that its obsolete. It is letting me set it to an empty string. Can i use this property. I cannot update my controls now. We are near the fag end of the project. :)
0
Richard Slade
Top achievements
Rank 2
answered on 19 Jan 2011, 05:50 PM
Hello,

Yes, I beleive that this is the property in oder versions that you should use. Please let me know if that works for you.
Thanks
Richard
0
RAGHAVENDRA
Top achievements
Rank 1
answered on 19 Jan 2011, 05:51 PM
its working for me. Thanks a lot. GridElement is workign great..
0
Richard Slade
Top achievements
Rank 2
answered on 19 Jan 2011, 05:53 PM
Great. Glad I could help
All the best
Richard
Tags
GridView
Asked by
RAGHAVENDRA
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
RAGHAVENDRA
Top achievements
Rank 1
Share this question
or