Hi i have the following grid
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebInfagistics.Default" %><%@ Register assembly="Infragistics2.Web.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.GridControls" tagprefix="ig" %><%@ Register assembly="Infragistics2.WebUI.UltraWebGrid.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebGrid" tagprefix="igtbl" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title></title></head><body> <form id="form1" runat="server"> <div> </div> <igtbl:UltraWebGrid ID="grid1" runat="server" Height="200px" onclickcellbutton="grid1_ClickCellButton" Width="795px"> <bands> <igtbl:UltraGridBand> <addnewrow view="NotSet" visible="NotSet"> </addnewrow> </igtbl:UltraGridBand> </bands> <displaylayout allowcolsizingdefault="Free" allowcolumnmovingdefault="OnServer" allowdeletedefault="Yes" allowsortingdefault="OnClient" allowupdatedefault="Yes" bordercollapsedefault="Separate" headerclickactiondefault="SortMulti" name="UltraWebGrid1" rowheightdefault="20px" rowselectorsdefault="No" selecttyperowdefault="Extended" stationarymargins="Header" stationarymarginsoutlookgroupby="True" tablelayout="Fixed" version="4.00" viewtype="OutlookGroupBy"> <framestyle backcolor="Window" bordercolor="InactiveCaption" borderstyle="Solid" borderwidth="1px" font-names="Microsoft Sans Serif" font-size="8.25pt" height="200px" width="795px"> </framestyle> <pager minimumpagesfordisplay="2"> <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </PagerStyle> </pager> <editcellstyledefault borderstyle="None" borderwidth="0px"> </editcellstyledefault> <footerstyledefault backcolor="LightGray" borderstyle="Solid" borderwidth="1px"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </footerstyledefault> <headerstyledefault backcolor="LightGray" borderstyle="Solid" horizontalalign="Left"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </headerstyledefault> <rowstyledefault backcolor="Window" bordercolor="Silver" borderstyle="Solid" borderwidth="1px" font-names="Microsoft Sans Serif" font-size="8.25pt"> <padding left="3px" /> <borderdetails colorleft="Window" colortop="Window" /> </rowstyledefault> <groupbyrowstyledefault backcolor="Control" bordercolor="Window"> </groupbyrowstyledefault> <groupbybox> <boxstyle backcolor="ActiveBorder" bordercolor="Window"> </boxstyle> </groupbybox> <addnewbox hidden="False"> <boxstyle backcolor="Window" bordercolor="InactiveCaption" borderstyle="Solid" borderwidth="1px"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </boxstyle> </addnewbox> <activationobject bordercolor="" borderwidth=""> </activationobject> <filteroptionsdefault> <filterdropdownstyle backcolor="White" bordercolor="Silver" borderstyle="Solid" borderwidth="1px" customrules="overflow:auto;" font-names="Verdana,Arial,Helvetica,sans-serif" font-size="11px" height="300px" width="200px"> <padding left="2px" /> </filterdropdownstyle> <filterhighlightrowstyle backcolor="#151C55" forecolor="White"> </filterhighlightrowstyle> <filteroperanddropdownstyle backcolor="White" bordercolor="Silver" borderstyle="Solid" borderwidth="1px" customrules="overflow:auto;" font-names="Verdana,Arial,Helvetica,sans-serif" font-size="11px"> <padding left="2px" /> </filteroperanddropdownstyle> </filteroptionsdefault> </displaylayout> </igtbl:UltraWebGrid> </form></body></html>
and the code behind is
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using Infragistics.WebUI.UltraWebGrid;namespace WebInfagistics{ public partial class Default : System.Web.UI.Page { UltraGridBand band = new UltraGridBand(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { doBind(); addBand(); AddBandRows(); } } protected void removeBands() { grid1.DisplayLayout.ViewType = ViewType.Flat; foreach (UltraGridRow row in grid1.Rows) { row.Rows.Band = null; } } protected void addBand() { grid1.DisplayLayout.ViewType = ViewType.Hierarchical; band.CellPadding = 3; band.Columns.Add("Col1"); band.Columns.Add("Col2"); band.Columns.Add("Col3"); band.Columns.Add("Details"); band.Columns.FromKey("Col1").Width = 130; band.Columns.FromKey("Col2").Width = 130; band.Columns.FromKey("Col3").Width = 130; band.Columns.FromKey("Details").Width = 130; band.Columns.FromKey("Details").Type = ColumnType.Button; band.Columns.FromKey("Details").CellButtonDisplay = CellButtonDisplay.Always; band.Columns.FromKey("Details").Key = "BANDDETAILS"; grid1.Bands.Add(band); } protected void AddBandRows() { foreach (UltraGridRow row in grid1.Rows){ row.Rows.Band = band; for (int i = 0; i < 2; i++) { UltraGridRow newRow = new UltraGridRow(); for (int j = 0; j < 3; j++) { newRow.Cells.Add(new UltraGridCell()); newRow.Cells[j].Value = "Cell:" + i + "_" + j; } row.Rows.Add(newRow); } } } protected void doBind() { DataTable aTable = new DataTable(); aTable.Columns.Add("ProductID", typeof(int)); aTable.Columns.Add("ProductName", typeof(string)); DataRow dr; dr = aTable.NewRow(); dr[0] = 12; dr[1] = "Lap Top"; aTable.Rows.Add(dr); dr = aTable.NewRow(); dr[0] = 13; dr[1] = "DeskTop"; aTable.Rows.Add(dr); dr = aTable.NewRow(); dr[0] = 14; dr[1] = "Server"; aTable.Rows.Add(dr); dr = aTable.NewRow(); dr[0] = 15; dr[1] = "Mac PC"; aTable.Rows.Add(dr); grid1.DataSource = aTable; grid1.DataBind(); } protected void grid1_ClickCellButton(object sender, CellEventArgs e) { string s = e.Cell.Key; string s1 = e.Cell.Row.Cells.FromKey("Col1").Value.ToString(); } }}
I add a new band in each row with two rows in it the last one being a button.
I handle the ClickCellButton to do nothing for now but in the future will do.
When i click the button the rows in the band disappear from the screen leaving empty space.
I add the rows in initialize row event to add the extra band rows same effect.
Any ideas thanks.