
Saravanaraja
Top achievements
Rank 1
Saravanaraja
asked on 14 May 2013, 12:53 PM
When using the Dynamic Linq datasource option NeedDataSource Event was not firing, then the grid will display all records.
4 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 14 May 2013, 01:16 PM
Hi Saravanaraja,
RadGrid fires the NeedDataSource event each time it needs to be bound to a data source. RadGrid does not fire the NeedDataSource event unless it is visible (Visible=True). Can you please elaborate how are you binding the RadGrid so that i can replicate the scenario.
Thanks,
Princy
RadGrid fires the NeedDataSource event each time it needs to be bound to a data source. RadGrid does not fire the NeedDataSource event unless it is visible (Visible=True). Can you please elaborate how are you binding the RadGrid so that i can replicate the scenario.
Thanks,
Princy
0

Saravanaraja
Top achievements
Rank 1
answered on 15 May 2013, 09:31 AM
Hi Princy,
Thanks for reply.
In Radgrid
1. I used Linqdatasuorceid based binding entire table.
2. In runtime i will change the condition find the below code i used
private void loaddropdownlist()
{
lblerror.Text = "";
Radcmb.SelectedIndex = 0;
if (Radcmbcm.SelectedValue == "Category")
{
Radcmb.DataSourceID = "linkcategory";
linkcategory.Where = "ystatus=True";
linkcategory.OrderBy = "cCategoryCode";
Radcmb.DataTextField = "cCategory";
Radcmb.DataValueField = "cCategoryCode";
}
if (Radcmbcm.SelectedValue == "Manufacturer")
{
Radcmb.DataSourceID = "linkmanufact";
linkmanufact.Where = "ystatus=@ystatus";
linkmanufact.WhereParameters.Add("ystatus",DbType.String,"Yes");
Radcmb.DataTextField = "cManufacturerName";
Radcmb.DataValueField = "cManufacturerId";
}
}
3. When i navigate to next page it loads entire table and needdatasource also not firing.
Thanks for reply.
In Radgrid
1. I used Linqdatasuorceid based binding entire table.
2. In runtime i will change the condition find the below code i used
private void loaddropdownlist()
{
lblerror.Text = "";
Radcmb.SelectedIndex = 0;
if (Radcmbcm.SelectedValue == "Category")
{
Radcmb.DataSourceID = "linkcategory";
linkcategory.Where = "ystatus=True";
linkcategory.OrderBy = "cCategoryCode";
Radcmb.DataTextField = "cCategory";
Radcmb.DataValueField = "cCategoryCode";
}
if (Radcmbcm.SelectedValue == "Manufacturer")
{
Radcmb.DataSourceID = "linkmanufact";
linkmanufact.Where = "ystatus=@ystatus";
linkmanufact.WhereParameters.Add("ystatus",DbType.String,"Yes");
Radcmb.DataTextField = "cManufacturerName";
Radcmb.DataValueField = "cManufacturerId";
}
}
3. When i navigate to next page it loads entire table and needdatasource also not firing.
0

Princy
Top achievements
Rank 2
answered on 15 May 2013, 10:19 AM
Hi,
I am not sure about your requirement. Try Calling the method
Thanks.
Princy.
I am not sure about your requirement. Try Calling the method
Rebind()
and thus the NeedDataSource event should be fired. Please provide the way you are binding the RadGrid and in which event you are calling the loaddropdownlist() method.Thanks.
Princy.
0

Saravanaraja
Top achievements
Rank 1
answered on 15 May 2013, 10:24 AM
HI,
Thanks.
My problem was solved. I removed the rebind() from the page load event.
saran
Thanks.
My problem was solved. I removed the rebind() from the page load event.
saran