5 Answers, 1 is accepted
0
Hi,
If you want to display empty grid on PageLoad you can refer to the forum thread below:
http://www.telerik.com/forums/empty-datasource-radgrid-problem
In case you are trying to achieve something else elaborate a bit more.
Regards,
Pavlina
Telerik
If you want to display empty grid on PageLoad you can refer to the forum thread below:
http://www.telerik.com/forums/empty-datasource-radgrid-problem
In case you are trying to achieve something else elaborate a bit more.
Regards,
Pavlina
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0

rinu
Top achievements
Rank 1
answered on 22 Nov 2015, 01:36 PM
yes this is exactly what i am trying to do but i got the following error.
"Both DataSource and DataSourceID are defined on 'RadGrid1'. Remove one definition" .
0

rinu
Top achievements
Rank 1
answered on 22 Nov 2015, 01:37 PM
I am even open to loop through the radGrid and delete the records. can you show me some code to do that ?
0
Hello,
Regarding the error you received it is caused by the fact that the grid is not populated properly because you have set both DataSource and DataSourceID at the same time. For example if you have assigned your datasource for the grid through NeedDataSource event setting DataSource to empty string on PageLoad should work and the code will looks like the one below:
Additionally, if you want to loop through grid items and delete specific one you need to handle grid PreRender event because pageLoad is too early in the lifecycle and the grid is not populated yet.
Regards,
Pavlina
Telerik
Regarding the error you received it is caused by the fact that the grid is not populated properly because you have set both DataSource and DataSourceID at the same time. For example if you have assigned your datasource for the grid through NeedDataSource event setting DataSource to empty string on PageLoad should work and the code will looks like the one below:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
RadGrid1.DataSource = String.Empty;
}
}
protected
void
RadGrid1_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource = GetDataTable();
}
Additionally, if you want to loop through grid items and delete specific one you need to handle grid PreRender event because pageLoad is too early in the lifecycle and the grid is not populated yet.
Regards,
Pavlina
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0

rinu
Top achievements
Rank 1
answered on 26 Nov 2015, 07:05 AM
Thanks Pavlina , That solved my problem