I have a dynamically bound UltraWebGrid that contains five columns of numbers, but one row. I use the sorting method to populate a new grid depending upon which column is "sorted". When you click the header, sometimes (most of the time) the columns loose their width and collapse to the smallest width available. I preset the width in the initialize row method. I've even resorted to having a method called in the page's pre-render method to set the widths, but nothing works. It doesn't always do this, but most of the time it does. Is there a way to make sure it keeps the columns widths all the time? Thanks.
Hi Maya, Just a final update. I went ahead and defined the columns in the <Band> element and they retain thier columns widths when defined manually. If I revert to the dynamic settings in InitializeLayout, they loose their widths when sorted. Thanks for you help with this, I really appreciated it.
Thanks, Maya. No my code is virtually identical to what you sent me. I'll keep playing with this. I generate the columns dynamically, so I'll try defining them in the <Bands> and setting the width manually to see if that will stabalize it. I haven't seen this behavior anywhere else I use the ultrawebgrids, just this one page. Thanks again for your help.
Hello dbishop9,
I'm just following up to see if you need further assistance with this issue.
If so don't hesitate to contact me.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
Hello dbishop9 ,
I tried to reproduce this issue with the exact code you provided against Ie8 with version 10.3.20103.2134 of our controls but that didn’t reproduce the issue on my side.
I’m attaching the sample filled with dummy data for your reference. Please test it on your side and let me know if the issue reproduces on your side. Let me know if i'm missing something essential in the sample that might be causing the issue.
If possible please modify this sample so that it reproduces the issue and attach it to your next post (if the reason you can add the attachment is that it’s too big it would be enough to zip and send the aspx page and the code behind).
Here is what I have. Sorry it is lengthy, but it won't let me upload a zip file. Thanks for you help.
<igtbl:UltraWebGrid ID="igMyCounts" runat="server" DisplayLayout-AutoGenerateColumns="true" EnableAppStyling="True" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/" DisplayLayout-CellPaddingDefault="5" DisplayLayout-AllowSortingDefault="Yes" DisplayLayout-AllowRowNumberingDefault="None" DisplayLayout-RowSelectorsDefault="No" DisplayLayout-HeaderStyleDefault-Cursor="Hand" DisplayLayout-Section508Compliant="true" > <Bands> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> </igtbl:UltraGridBand> </Bands> <DisplayLayout BorderCollapseDefault="Separate" CellPaddingDefault="5" Name="igMyCounts" RowHeightDefault="20px" Version="4.00" HeaderClickActionDefault="SortSingle" AllowUpdateDefault="No" > <FrameStyle> </FrameStyle> <ActivationObject BorderColor="" BorderWidth=""> </ActivationObject> <Images SortAscendingImage-Url="../ig_res/Office2007Blue/images/ig_tblFilterLike3.png" SortDescendingImage-Url="../ig_res/Office2007Blue/images/ig_tblFilterLike3.png"> </Images> </DisplayLayout></igtbl:UltraWebGrid>
<asp:Panel ID="pnlMyDetail" runat="server" Visible="false" > <asp:Panel ID="pnlMyDetailSub" runat="server" HorizontalAlign="Left" BorderColor="LightGray" BorderStyle="Solid" BorderWidth="1" BackImageUrl="~/ig_res/Office2007Blue/images/igg_header.gif" > <asp:ImageButton ID="ibtnMyDetailClose" runat="server" AlternateText="Close" ToolTip="Close" ImageUrl="~/ig_res/Office2007Blue/images/igdw_CloseHover2.gif" /> <igtbl:UltraWebGrid ID="igMyDetail" runat="server" DisplayLayout-AutoGenerateColumns="true" EnableAppStyling="True" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/" DisplayLayout-CellPaddingDefault="5" DisplayLayout-AllowSortingDefault="No" DisplayLayout-AllowRowNumberingDefault="None" DisplayLayout-RowSelectorsDefault="No" DisplayLayout-HeaderStyleDefault-Cursor="NotSet" DisplayLayout-NoDataMessage="" > <Bands> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> </igtbl:UltraGridBand> </Bands> <DisplayLayout BorderCollapseDefault="Separate" CellPaddingDefault="5" Name="igMyCounts" RowHeightDefault="20px" Version="4.00" AllowUpdateDefault="No"> <FrameStyle> </FrameStyle> <ActivationObject BorderColor="" BorderWidth=""> </ActivationObject> </DisplayLayout> </igtbl:UltraWebGrid> </asp:Panel></asp:Panel>
Protected Sub igMyCounts_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles igMyCounts.InitializeLayout With e.Layout.Bands(0).Columns.FromKey("Apples") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Applies" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End With With e.Layout.Bands(0).Columns.FromKey("Oranges") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Oranges" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End With With e.Layout.Bands(0).Columns.FromKey("Bananas") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Bananas" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End With With e.Layout.Bands(0).Columns.FromKey("Plums") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Plums" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End With With e.Layout.Bands(0).Columns.FromKey("Pears") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Pears" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End WithEnd Sub
Protected Sub igMyCounts_SortColumn(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.SortColumnEventArgs) Handles igMyCounts.SortColumn Dim ds As New DataSet Dim choice as String = String.Empty Try Select Case e.ColumnNo Case 0 choice = "appledetail" Case 1 choice = "orangedetail" Case 2 choice = "bananadetail" Case 3 choice = "plumdetail" Case 4 choice = "peardetail" End Select ds = GetDataSet(choice) If Not IsDatasetValid(ds) Then ds = GetDataSet("emptydetail") End If pnlMyDetail.Visible = True igMyDetail.DataSource = ds igMyDetail.DataBind() Catch ex As Exception End Try
End Sub
Protected Sub igMyDetail_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles igMyDetail.InitializeLayout With e.Layout.Bands(0).Columns.FromKey("ID") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "ID" .Width = Unit.Pixel(25) .CellStyle.Wrap = False .Hidden = True End With With e.Layout.Bands(0).Columns.FromKey("Type") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Type" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End With With e.Layout.Bands(0).Columns.FromKey("Count") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Count" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End With With e.Layout.Bands(0).Columns.FromKey("Location") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Location" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End With With e.Layout.Bands(0).Columns.FromKey("Date") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Date" .DataType = "System.DateTime" .Format = "MM/dd/yyyy" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End With With e.Layout.Bands(0).Columns.FromKey("Expires") .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center .Header.Caption = "Expires" .DataType = "System.DateTime" .Format = "MM/dd/yyyy" .Width = Unit.Pixel(100) .CellStyle.Wrap = False End With
Protected Sub ibtnMyDetailClose_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibtnMyDetailClose.Click igMyDetail.DataSource = Nothing igMyCounts.DisplayLayout.Bands(0).Columns(0).SortIndicator = SortIndicator.None pnlMyDetail.Visible = False End Sub