button on ultragrid

I have a Ultragrid which has 3 levels of hierarchy.
I want to add a button on third level of hierarchy for each row in a separate column.
what kind of code or process should I to follow?
MasterabhiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jens FiedererTest Developer/ValidatorCommented:
Here's an easy example for a page with just a single grid on it.

Most of the code is just to set up the 3-level dataset, the important part is marked in a comment.
protected void Page_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            DataTable t1 = TextTable(new string[] { "countryid", "countryname" });
            AddRow(t1, new string[]{"1", "Germany"});
            AddRow(t1, new string[] { "2", "France" });
            DataTable t2 = TextTable(new string[] { "countryid", "stateid", "statename" });
            AddRow(t2, new string[] { "1", "1", "Hessen" });
            AddRow(t2, new string[] { "1", "2", "Niedersachsen" });
            AddRow(t2, new string[] { "1", "3", "Berlin" });
            AddRow(t2, new string[] { "1", "4", "Bremen" });
            AddRow(t2, new string[] { "1", "5", "Hamburg" });
            AddRow(t2, new string[] { "1", "6", "Bayern" });
            AddRow(t2, new string[] { "1", "7", "Franken" });
            AddRow(t2, new string[] { "2", "21", "Alsace" });
            AddRow(t2, new string[] { "2", "22", "Aquitaine" });
            AddRow(t2, new string[] { "2", "23", "Basse-Normandie" });
            AddRow(t2, new string[] { "2", "24", " Bourgogne" });
            AddRow(t2, new string[] { "2", "25", " Bretagne" });
            AddRow(t2, new string[] { "2", "26", "Limousin" });
            DataTable t3 = TextTable(new string[] { "stateid", "cityid", "cityname" });
            AddRow(t3, new string[] { "1", "1", "Frankfurt" });
            AddRow(t3, new string[] { "21", "2", "Strasbourg" });
            AddRow(t3, new string[] { "21", "3", "Wittenheim" });
            AddRow(t3, new string[] { "21", "4", "Colmar" });
            ds.Tables.Add(t1);
            ds.Tables.Add(t2);
            ds.Tables.Add(t3);
            ds.Relations.Add(t1.Columns[0], t2.Columns[0]);
            ds.Relations.Add(t2.Columns[1], t3.Columns[0]);
            UltraWebGrid1.DisplayLayout.ViewType = Infragistics.WebUI.UltraWebGrid.ViewType.OutlookGroupBy;

            // important part below!
            UltraGridColumn buttonColumn = new UltraGridColumn("but", "buttton", ColumnType.Button, "Press");
            buttonColumn.NullText = "Press";
            buttonColumn.CellButtonDisplay = CellButtonDisplay.Always;
            buttonColumn.CellButtonStyle.Width = Unit.Pixel(100);
            buttonColumn.CellButtonStyle.Height = Unit.Pixel(30);
            UltraWebGrid1.DataSource = ds;
            UltraWebGrid1.DataBind();
            UltraWebGrid1.Bands[2].Columns.Add(buttonColumn, false);
            UltraWebGrid1.Bands[0].ExpandAll();
            UltraWebGrid1.Bands[1].ExpandAll();
            UltraWebGrid1.Bands[2].ExpandAll();
        }

        public void AddRow(DataTable t, IEnumerable<string> fields)
        {
            DataRow row = t.NewRow();
            int i = 0;
            foreach (string field in fields) {
                row[i++] = field;
            }
            t.Rows.Add(row);
        }

        public DataTable TextTable(string[] names)
        {
            DataTable output = new DataTable();
            foreach (string name in names)
            {
                output.Columns.Add(name);
            }
            return output;
        }

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MasterabhiAuthor Commented:
Thanks.
0
MasterabhiAuthor Commented:
helped me
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.