Search code examples
vb.netgoogle-chromeradgridcolumn-width

Radgrid column widths not setting in Chrome browser


I have problem with rad grid in chrome browser .

column widths am setting in code behind.

In I.E and Firefox it is working fine setting same column width but in chrome it is not setting the widths specified.

It is taking column width based on content in column data.

here is my grid

    <asp:PlaceHolder ID="GridHolder" runat="server">

        <telerik:RadGrid ID="goGrid" ClientSettings-Scrolling-UseStaticHeaders="true" MasterTableView-TableLayout="Fixed"  runat="server" OnExcelExportCellFormatting="goGrid_ExcelExportCellFormatting" 
            OnGridExporting="goGrid_GridExporting"  OnItemCommand="goGrid_ItemCommand" OnPdfExporting="goGrid_PdfExporting" 
            OnExcelMLExportRowCreated="goGrid_ExcelMLExportRowCreated">

        </telerik:RadGrid>
    </asp:PlaceHolder>

am adding columns and column width in code behind

 sColDef = cColumns.Item(i).ToString
            sField = "GEN_" & i.ToString
            sLabel = goTR.ExtractString(sColDef, 2, Chr(1))
            sAlignment = goTR.ExtractString(sColDef, 3, Chr(1))
            sWidth = goTR.ExtractString(sColDef, 4, Chr(1))
            iDisplayAsIcon = goTR.StringToNum(goTR.ExtractString(sColDef, 5, Chr(1)))
            iDisplayAsLink = goTR.StringToNum(goTR.ExtractString(sColDef, 6, Chr(1)))
            iTextWidth = goTR.StringToNum(goTR.ExtractString(sColDef, 9, Chr(1)))
            iEllipsis = goTR.StringToNum(goTR.ExtractString(sColDef, 10, Chr(1)))

 Dim oField As New GridTemplateColumn

                If sUseOneLine = "1" Then
                    oField.ItemTemplate = New HyperlinkTemplate(sField, iTextWidth, sAlignment, "LIST", sSystemField, Me.ID, Me.gsSelectedRecordID, "GID_ID", gsFile, goTR.StringToNum(sWidth))
                Else
                    oField.ItemTemplate = New HyperlinkTemplate(sField, iTextWidth, sAlignment, "LIST", sSystemField, Me.ID, Me.gsSelectedRecordID, "GID_ID", gsFile, goTR.StringToNum(sWidth), False)
                End If

                If Not goTR.IsFieldCombined(sViewField) And goData.IsFieldSortable(sSystemField, gsFile) Then
                    oField.HeaderTemplate = New HeaderLinkTemplate(Me.ClientID, sSystemField, goView.GetSortFieldIndex(sSystemField), goView.GetSortFieldDirection(sSystemField), sLabel, goTR.StringToNum(sWidth), sAlignment, gbPrintMode, , sUseHeadings = "0")
                Else
                    oField.HeaderTemplate = New HeaderTemplate(sLabel, goTR.StringToNum(sWidth), sAlignment, gbPrintMode, sUseHeadings = "0")
                End If
                oField.HeaderText = sLabel
                'oField.HeaderStyle.Width = Unit.Pixel(goTR.StringToNum(sWidth))
                goGrid.Columns.Add(oField)

I tried by setting

 oField.HeaderStyle.Width = Unit.Pixel(goTR.StringToNum(sWidth))
                            oField.FilterControlWidth = New System.Web.UI.WebControls.Unit(sWidth, UnitType.Pixel)

these also but not resolved my issue

Help will be appreciated Please help me thorugh this.


Solution

  • Finally i tried to fix my bug in chrome browser by

      <MasterTableView Width="100%" TableLayout="Fixed"></MasterTableView>
    

    in rad grid view .

    This fixed my issue with widths in Rad Grid.