I have form designer that allows users to create any form they want the will then be used as a member form. The member form is then used to join a group. All this is working fine (except for a problem with RadDropDownList) and I have many members in the test database. I now wish to use the grid to display the users in a group member list for member management.
The problem I cannot solve is how to create the source with data for the grid. Every example I can find seems to know all its columns in advance. I actually do not know any of my columns in advance. I have a list of form rows that each have a name with a type and the ability to populate instances of the list.
I would also like to create a column selector. I wonder if there are any examples of that around.
Thanks,
George
The problem I cannot solve is how to create the source with data for the grid. Every example I can find seems to know all its columns in advance. I actually do not know any of my columns in advance. I have a list of form rows that each have a name with a type and the ability to populate instances of the list.
I would also like to create a column selector. I wonder if there are any examples of that around.
Thanks,
George
5 Answers, 1 is accepted
0
Accepted
Hello George,
To achieve this requirement you should create the grid on Page_Init:
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html#Section22
And follow the steps provided in the following article:
http://www.telerik.com/help/aspnet-ajax/grid-changing-structure-dynamically.html
Hope this helps.
Regards,
Eyup
Telerik
To achieve this requirement you should create the grid on Page_Init:
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html#Section22
And follow the steps provided in the following article:
http://www.telerik.com/help/aspnet-ajax/grid-changing-structure-dynamically.html
Hope this helps.
Regards,
Eyup
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

George
Top achievements
Rank 2
answered on 16 Mar 2015, 04:28 PM
I was creating the grid in Page_Init, The answer I am after is on one line at the very bottom of the second link.
My callbacks are working fine I just needed to get reference to the grid object.
Thanks,
George
RadGrid grid = PlaceHolder1.FindControl("grid") as RadGrid;
My callbacks are working fine I just needed to get reference to the grid object.
Thanks,
George
0

George
Top achievements
Rank 2
answered on 16 Mar 2015, 05:06 PM
I little confused in my posts, that was another answer I was looking for in how to reference a dynamically added grid in a grid callback.
Right now I am creating the grid and columns in the Page_Init() like the documentation described. The problem I still have is how to define a arbitrary columned data source. My solution to that right now is rather hacky.
I have a serialized class with more columns than need and then I use what I need.
I use Value1, Value2, Value3 and Integer1 for one form and Value1, Value2, Value3, Value4, Number1 and Integer1 for another. It seems to work though it would be better if I could create the datasource with the columns to match the data. I can never be sure my class will be sufficient for every form people create. My code is based on code in the Grid Virtualization example Every example I can find just gives a data source, except that one which uses a serializable to create a data source.
George
Right now I am creating the grid and columns in the Page_Init() like the documentation described. The problem I still have is how to define a arbitrary columned data source. My solution to that right now is rather hacky.
I have a serialized class with more columns than need and then I use what I need.
[Serializable]
public class Member
{
public string ID { get; set; }
public string Value0 { get; set; }
public string Value1 { get; set; }
public string Value2 { get; set; }
public string Value3 { get; set; }
public string Value4 { get; set; }
public string Value5 { get; set; }
public string Value6 { get; set; }
public string Value7 { get; set; }
public string Value8 { get; set; }
public string Value9 { get; set; }
public string Value10 { get; set; }
public string Value11 { get; set; }
public string Value12 { get; set; }
public string Value13 { get; set; }
public string Value14 { get; set; }
public string Value15 { get; set; }
public double Number0 { get; set; }
public double Number1 { get; set; }
public double Number2 { get; set; }
public double Number3 { get; set; }
public double Number4 { get; set; }
public double Number5 { get; set; }
public int Integer0 { get; set; }
public int Integer1 { get; set; }
public int Integer2 { get; set; }
public int Integer3 { get; set; }
public int Integer4 { get; set; }
public int Integer5 { get; set; }
}
I use Value1, Value2, Value3 and Integer1 for one form and Value1, Value2, Value3, Value4, Number1 and Integer1 for another. It seems to work though it would be better if I could create the datasource with the columns to match the data. I can never be sure my class will be sufficient for every form people create. My code is based on code in the Grid Virtualization example Every example I can find just gives a data source, except that one which uses a serializable to create a data source.
George
0

George
Top achievements
Rank 2
answered on 16 Mar 2015, 06:53 PM
I am using DataTable which I found in RadGrid Data Binding
0
Accepted
Hello George,
Using the NeedDataSource event handler, you can set a different DataSource depending on user selection:
http://www.telerik.com/help/aspnet-ajax/grid-advanced-data-binding.html
Again, you can get the user selection using the Request.Form.Get("DropDownList1") method.
Regards,
Eyup
Telerik
Using the NeedDataSource event handler, you can set a different DataSource depending on user selection:
http://www.telerik.com/help/aspnet-ajax/grid-advanced-data-binding.html
Again, you can get the user selection using the Request.Form.Get("DropDownList1") method.
Regards,
Eyup
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.