Can anyone help me how to create a hierarchical Ultrawebgrid in ASP.net using C#... I'm very new to this... So i need some basics and sample codes .. Can u help me ?
Hey Bompuis,
I need to use Ultra web grid only. I have created an Ultrawebgrid already... I need to make it as a 'Hierarchical' Ultra web grid which means that
for a particular row(parent) in the Grid, I'm inserting a child row which too has columns (data) in it and linked with the parent using the parent's primary key...
so that when you click '+' symbol (displayed near parent row), child rows inserted will be displayed....
<>
But i need to make it hierarchical ti facilitate child rows insertion,update etc (as I've so in my Database)
do i make sense???
One way to make an UltraWebGrid "Hierarchical" is to establish a data relation in a dataset and bind the dataset to the UltraWebGrid.
As an example, let's say we have a Blog and we want to show the Blog Articles as the parent and then any comments made to each article as children in a Hierarchical UltraWebGrid. The parent table is named "BlogArticle" and is keyed by "BlogArticleID" and the child table is named "BlogComment" and contains a "BlogArticleID" column as a foreign key to "BlogArticle".
First we would establish 2 datasets and fill them using whatever mechanism you prefer with the data we want. In this case I am simply retrieving all the Blog Articles and all the Comments. Then we would "merge" the dataset that is to be the child into the dataset that is to the parent. Finally, we would set our data relationship in the dataset and bind the dataset to the UltraWebGrid.
An example of the code for this is as follows...
DataSet dsBlogArticle = new DataSet();
DataSet dsBlogComment = new DataSet();
//
// Fill each dataset appropriately.
//
// Set Table Names. This is needed for the merge operation.
dsBlogArticle.Tables[0].TableName = "BlogArticle";
dsBlogComment.Tables[0].TableName = "BlogComment";
//
// Merge the Blog Comment dataset into the Blog Article dataset
// to create a single dataset object with two tables.
dsBlogArticle.Merge(dsBlogComment);
//
// Define Hierarchical relationships in the Dataset.
DataRelation dr = new DataRelation(
"BlogArticleToComments",
dsBlogArticle.Tables["BlogArticle"].Columns["BlogArticleID"],
dsBlogArticle.Tables["BlogComment"].Columns["BlogArticleID"],
false);
dsBlogArticle.Relations.Add(dr);
//
// Bind the dataset to the grid.
this.grdBlogArticle.DataSource = dsBlogArticle;
this.grdBlogArticle.DataBind();
The UltraWebGrid will automatically handle creating the Hierarchical grid based on the Data Relationship that is established in the dataset. To see this code populate an UltraWebGrid you can go here to view an example that I put together.
I hope this helps, Thanks
thanks a ton.... that was very useful ....thnk u again sebastian :)