Hi! I have this scheme of Data on my Ultrawebgrid. By default all columns that have information are visible, now, I need to hide some columns depending of the value at TasCodigo in the 2nd Band. For example, if the value is "1" I need to hide since "AfoCodigo" column until "AfoIncorporationDate", and if the value is "2" I need to hide since "AcoCodigo" until "AcoStatus". Is it this posible ?
<Bands> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" Key="TasCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasDescripcion" Key="TasDescripcion"> <Header Caption="TXT_DESCRIPCION"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="AssCodigo" DataType="System.Int32" Hidden="True" Key="AssCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" DataType="System.Int32" Hidden="True" Key="TasCodigo"> <Header> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoCodigo" DataType="System.Int32" Hidden="True" Key="AcoCodigo"> <Header> <RowLayoutColumnInfo OriginX="2" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoCompanyName" Key="AcoCompanyName"> <Header Caption="DP_COMPANYNAME"> <RowLayoutColumnInfo OriginX="3" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="3" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoJurisdition" Key="AcoJurisdition"> <Header Caption="DP_JURISDICTION"> <RowLayoutColumnInfo OriginX="4" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="4" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoId" Key="AcoId"> <Header Caption="DP_ID"> <RowLayoutColumnInfo OriginX="5" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="5" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoDateIncorporation" DataType="System.DateTime" Format="MM/dd/yyyy" Key="AcoDateIncorporation"> <Header Caption="DP_DATEINCORPORATION"> <RowLayoutColumnInfo OriginX="6" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="6" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoStatus" Key="AcoStatus"> <Header Caption="DP_STATUS"> <RowLayoutColumnInfo OriginX="7" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="7" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoCodigo" DataType="System.Int32" Hidden="True" Key="AfoCodigo"> <Header> <RowLayoutColumnInfo OriginX="8" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="8" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoFoundationName" Key="AfoFoundationName"> <Header Caption="DP_FOUNDATIONNAME"> <RowLayoutColumnInfo OriginX="9" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="9" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoJurisdition" Key="AfoJurisdition"> <Header Caption="DP_JURISDICTION"> <RowLayoutColumnInfo OriginX="10" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="10" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoIdNumber" Key="AfoIdNumber"> <Header Caption="DP_IDNUMBER"> <RowLayoutColumnInfo OriginX="11" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="11" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoStatus" Key="AfoStatus"> <Header Caption="DP_STATUS"> <RowLayoutColumnInfo OriginX="12" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="12" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoIncorporationDate" DataType="System.DateTime" Format="MM/dd/yyyy" Key="AfoIncorporationDate"> <Header Caption="DP_DATEINCORPORATION"> <RowLayoutColumnInfo OriginX="13" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="13" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> </Bands>
</Code>
Hello,
You are trying to hide a column based on the value of a child row, is that correct? If so, handle the InitializeRow event of WebGrid and check the child rows for that particular value. Hide the column if it mathces a criteria.
Not really, I need do something like this. In this case I have 5 grids, one for each kind, but if I want to add another kind I must modify my aspx and add the code for databind the information.
Is you grid databound or did you just add this information explicitly. I do not know what you mean by 5 grids. I see 5 parent records with 2 child records, hence 2 bands in all. Now I see that you set this schema up, but do you at any point bind to data or did you add the rows yourself?
When you say add another kind, do you mean you want to add an additional row, band, or column to this existing schema? Please clarify.
Actually I have this schema at my aspx, but I wish have only one grid with the schema from above.
<igtbl:UltraWebGrid ID="dgAssetsCompany" runat="server" Width="698px" style="left: 1px; top: 1px"> <Bands> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" Key="TasCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasDescripcion" Key="TasDescripcion"> <Header Caption="TXT_DESCRIPCION"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="AssCodigo" DataType="System.Int32" Hidden="True" Key="AssCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" DataType="System.Int32" Hidden="True" Key="TasCodigo"> <Header> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoCodigo" DataType="System.Int32" Hidden="True" Key="AcoCodigo"> <Header> <RowLayoutColumnInfo OriginX="2" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoCompanyName" Key="AcoCompanyName"> <Header Caption="DP_COMPANYNAME"> <RowLayoutColumnInfo OriginX="3" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="3" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoJurisdition" Key="AcoJurisdition"> <Header Caption="DP_JURISDICTION"> <RowLayoutColumnInfo OriginX="4" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="4" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoId" Key="AcoId"> <Header Caption="DP_ID"> <RowLayoutColumnInfo OriginX="5" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="5" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoDateIncorporation" DataType="System.DateTime" Format="MM/dd/yyyy" Key="AcoDateIncorporation"> <Header Caption="DP_DATEINCORPORATION"> <RowLayoutColumnInfo OriginX="6" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="6" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AcoStatus" Key="AcoStatus"> <Header Caption="DP_STATUS"> <RowLayoutColumnInfo OriginX="7" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="7" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> </Bands></igtbl:UltraWebGrid><igtbl:UltraWebGrid ID="dgAssetsTrust" runat="server" Width="698px"> <Bands> <igtbl:UltraGridBand ColHeadersVisible="No"> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" Key="TasCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasDescripcion" Key="TasDescripcion"> <Header Caption="TXT_DESCRIPCION"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="AssCodigo" DataType="System.Int32" Hidden="True" Key="AssCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" DataType="System.Int32" Hidden="True" Key="TasCodigo"> <Header> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AtrCodigo" Hidden="True" Key="AtrCodigo"> <Header> <RowLayoutColumnInfo OriginX="2" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AtrTrustName" Key="AtrTrustName"> <Header> <RowLayoutColumnInfo OriginX="3" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="3" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AtrJurisdiction" Key="AtrJurisdiction"> <Header> <RowLayoutColumnInfo OriginX="4" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="4" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AtrSettlorName" Key="AtrSettlorName"> <Header> <RowLayoutColumnInfo OriginX="5" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="5" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AtrDateIncorporation" DataType="System.DateTime" Format="MM/dd/yyyy" Key="AtrDateIncorporation"> <Header> <RowLayoutColumnInfo OriginX="6" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="6" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> </Bands></igtbl:UltraWebGrid><igtbl:UltraWebGrid ID="dgAssetsFoundation" runat="server" Width="698px" style="left: 0px; top: 0px"> <Bands> <igtbl:UltraGridBand ColHeadersVisible="No"> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" Key="TasCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasDescripcion" Key="TasDescripcion"> <Header Caption="TXT_DESCRIPCION"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="AssCodigo" DataType="System.Int32" Hidden="True" Key="AssCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" DataType="System.Int32" Hidden="True" Key="TasCodigo"> <Header> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoCodigo" DataType="System.Int32" Hidden="True" Key="AfoCodigo"> <Header> <RowLayoutColumnInfo OriginX="2" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoFoundationName" Key="AfoFoundationName"> <Header Caption="DP_FOUNDATIONNAME"> <RowLayoutColumnInfo OriginX="3" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="3" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoJurisdition" Key="AfoJurisdition"> <Header Caption="DP_JURISDICTION"> <RowLayoutColumnInfo OriginX="4" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="4" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoIdNumber" Key="AfoIdNumber"> <Header Caption="DP_IDNUMBER"> <RowLayoutColumnInfo OriginX="5" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="5" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoStatus" Key="AfoStatus"> <Header Caption="DP_STATUS"> <RowLayoutColumnInfo OriginX="6" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="6" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AfoIncorporationDate" DataType="System.DateTime" Format="MM/dd/yyyy" Key="AfoIncorporationDate"> <Header Caption="DP_DATEINCORPORATION"> <RowLayoutColumnInfo OriginX="7" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="7" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> </Bands></igtbl:UltraWebGrid><igtbl:UltraWebGrid ID="dgAssetsBrokerage" runat="server" Width="698px" style="left: 1px; top: 1px"> <Bands> <igtbl:UltraGridBand ColHeadersVisible="No"> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" Key="TasCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasDescripcion" Key="TasDescripcion"> <Header Caption="TXT_DESCRIPCION"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="AssCodigo" DataType="System.Int32" Hidden="True" Key="AssCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" DataType="System.Int32" Hidden="True" Key="TasCodigo"> <Header> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbrCodigo" Key="AbrCodigo"> <Header> <RowLayoutColumnInfo OriginX="2" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbrNameAccount" Key="AbrNameAccount"> <Header> <RowLayoutColumnInfo OriginX="3" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="3" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbrJurisdiction" Key="AbrJurisdiction"> <Header> <RowLayoutColumnInfo OriginX="4" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="4" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbrDirector" Key="AbrDirector"> <Header> <RowLayoutColumnInfo OriginX="5" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="5" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbrClient" Key="AbrClient"> <Header> <RowLayoutColumnInfo OriginX="6" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="6" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbrAccount" Key="AbrAccount"> <Header> <RowLayoutColumnInfo OriginX="7" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="7" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> </Bands></igtbl:UltraWebGrid><igtbl:UltraWebGrid ID="dgAssetsBank" runat="server" Width="698px" style="left: 0px; top: 0px"> <Bands> <igtbl:UltraGridBand ColHeadersVisible="No"> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" Key="TasCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasDescripcion" Key="TasDescripcion"> <Header Caption="TXT_DESCRIPCION"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <Columns> <igtbl:UltraGridColumn BaseColumnName="AssCodigo" DataType="System.Int32" Hidden="True" Key="AssCodigo"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TasCodigo" DataType="System.Int32" Hidden="True" Key="TasCodigo"> <Header> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbaCodigo" DataType="System.Int32" Hidden="True" Key="AbaCodigo"> <Header> <RowLayoutColumnInfo OriginX="2" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbaCompany" Key="AbaCompany"> <Header> <RowLayoutColumnInfo OriginX="3" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="3" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbaJurisdiction" Key="AbaJurisdiction"> <Header> <RowLayoutColumnInfo OriginX="4" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="4" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbaCurrency" Key="AbaCurrency"> <Header> <RowLayoutColumnInfo OriginX="5" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="5" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbaBank" Key="AbaBank"> <Header> <RowLayoutColumnInfo OriginX="6" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="6" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="AbaStatus" Key="AbaStatus"> <Header> <RowLayoutColumnInfo OriginX="7" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="7" /> </Footer> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> </Bands></igtbl:UltraWebGrid>
dgAssetsCompany.DataSource = returnTipoasset(1);dgAssetsCompany.DataBind();dgAssetsTrust.DataSource = returnTipoasset(2);dgAssetsTrust.DataBind();dgAssetsFoundation.DataSource = returnTipoasset(3);dgAssetsFoundation.DataBind();dgAssetsBrokerage.DataSource = returnTipoasset(4);dgAssetsBrokerage.DataBind();dgAssetsBank.DataSource = returnTipoasset(5);dgAssetsBank.DataBind();
foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow rowBanda0 in dgAssets.Rows) { foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow row in rowBanda0.Rows) { if (row.Cells.FromKey("TasCodigo").Text == "1") { // code to hide colums differents from AssetCompany } else if (row.Cells.FromKey("TasCodigo").Text == "3") { // code to hide colums differents from AssetFoundation } } }
A column belongs to the entire band. When you hide a column, it is hidden from the entire band. Hence you will not see its cells in every row of that band. I do not see why you want to hide it for individual rows. You could blank out individual cells with your own styles if you wish.
You're right, my code for databounding the grid is this. I get both tables and create the relation.
private DataSet returnTipoasset(int TasCodigo) { DataSet dtsInformacion = new DataSet(); Tipoasset.Criteria objCT = new TipoassetBase.Criteria(); objCT.AgregarEntidadCriteria(Tipoasset.TipoFiltro.Add, Tipoasset.OperadordeComparacion.Equal, Tipoasset.IndiceCampo.TasEstadoIndex, "AC"); if (TasCodigo != new Tipoasset().TasCodigo) { objCT.AgregarEntidadCriteria(Tipoasset.TipoFiltro.Add, Tipoasset.OperadordeComparacion.Equal, Tipoasset.IndiceCampo.TasCodigoIndex, TasCodigo); } dtsInformacion.Tables.Add(new Tipoasset().FetchMultiDataTable(objCT)); VwAssets.Criteria objCriteria = new VwAssetsBase.Criteria(); objCriteria.AgregarEntidadCriteria(VwAssets.TipoFiltro.Add, VwAssets.OperadordeComparacion.Equal, VwAssets.IndiceCampo.CliCodigoIndex, Convert.ToDecimal(11)); if (TasCodigo != new Tipoasset().TasCodigo) { objCriteria.AgregarEntidadCriteria(VwAssets.TipoFiltro.Add, VwAssets.OperadordeComparacion.Equal, VwAssets.IndiceCampo.TasCodigoIndex, TasCodigo); } dtsInformacion.Tables.Add(new VwAssets().FetchMultiDataTable(objCriteria)); DataColumn[ parentCol = new DataColumn[1] { dtsInformacion.Tables[0].Columns["TasCodigo"] }; DataColumn[ childCol = new DataColumn[1] { dtsInformacion.Tables[1].Columns["TasCodigo"] }; DataRelation dr; dr = new DataRelation("RelacionGrid", parentCol, childCol, false); dtsInformacion.Relations.Add(dr); return dtsInformacion; }
foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow rowBanda0 in dgAssets.Rows) { foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow row in rowBanda0.Rows) { string[ NoShow = null; if (row.Cells.FromKey("TasCodigo").Text == "1") // Kind Company -- Hide Columns not this kind { NoShow = new string[ { "AfoFoundationName", "AfoJurisdition", "AfoIdNumber", "AfoStatus", "AfoIncorporationDate" }; } else if (row.Cells.FromKey("TasCodigo").Text == "3") // Kind Foundation -- Hide Columns not this kind { NoShow = new string[ { "AcoCompanyName", "AcoJurisdition", "AcoId", "AcoDateIncorporation", "AcoStatus" }; } if (NoShow != null) { foreach (string campo in NoShow) { //row.Cells.FromKey(campo).Style.CssClass = "Hidden"; row.Cells.FromKey(campo).Column.Hidden = true; } } } }
It is wasteful to have 5 grids like this. What you want to do is use one grid, get the data that you need and set up a data object such as a DataSet to have the top level parent data in one table, and the child data in another table. Set up a relation. That way you can bind WebGrid and have the data show up in one grid. Then you can do any sort of conditional manipulation that you'd like.
You may find the following documentation useful as it describes how to set up hierarchical data in WebGrid:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR3.5/html/WebGrid_Binding_WebGrid_to_a_Hierarchical_Data_Set.html