This is a migrated thread and some comments may be shown as answers.

Grid columns out of alignment and tooltip - both brake on sort

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 2
Joshua asked on 11 May 2010, 05:09 PM
My radGrid displays data from a SQL Server 2008 data source. Because the information is proprietary I have have had to blot out any real information but I have left what is needed to show you the issue I am seeing.

When the radGrid is populated everything works great. Data lines up properly in all columns, when you hover on the link a radTooltip popup out displaying information.

But when you sort on any column, the columns stop lining up because it looks like "word wrapping" gets turned off. So instead of one of our Agency names wrapping and displaying on two lines in the grid column it is shown on one line. This would be fine if I could get this to be consistent for all columns and column headers. The agency name is pushed into the next 2 columns data so that data is pushed over as well.

I have attached two screenshots showing what I am talking about. As you can see in the Before.png, everything looks and works fine including the tooltip. After sorting, the Agent Name column spans well into the 3rd column over, SCAC. Also, strangely after sorting my tooltip ceases working.

How do I get my columns to stay lined up and can anyone answer why the tooltip breaks when the data is sorted?

search.ascx
<telerik:RadAjaxManager ID="radAM" runat="server"
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="radRadiusSearch"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="radRadiusSearch" LoadingPanelID="radALP" /> 
                <telerik:AjaxUpdatedControl ControlID="radTTM" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 
<telerik:RadAjaxLoadingPanel ID="radALP" runat="server"></telerik:RadAjaxLoadingPanel> 
<telerik:RadToolTipManager ID="radTTM" runat="server" OffsetY="-1" HideEvent="LeaveToolTip" 
 Width="300" Height="75" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element" Position="BottomRight" Skin="Windows7"
 </telerik:RadToolTipManager> 
 
<telerik:RadGrid ID="radRadiusSearch" runat="server"  
    AllowSorting="True" AllowPaging="True"   
    width="950px" AutoGenerateColumns="False"     
     Skin="Windows7"  
    EnableViewState="False" Visible="False"
    <MasterTableView Width="950px" AllowMultiColumnSorting="true" DataKeyNames="AgentNumber" CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst" Dir="LTR" Frame ="Border" TableLayout="Auto"
        <Columns> 
            <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="AgentNumber" Display="false" 
                DataType="System.String" FilterListOptions="VaryByDataType" ForceExtractValue="None" 
                HeaderText="Agent #" ReadOnly="True" SortExpression="AgentNumber" UniqueName="AgentNumber"
            </telerik:GridBoundColumn>                               
            <telerik:GridTemplateColumn HeaderText="Agent #" SortExpression="AgentNumber"
                <ItemTemplate> 
                    <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("AgentNumber") %>'></asp:HyperLink> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn>             
            <telerik:GridBoundColumn DataField="AgentName" DataType="System.String" HeaderText="Agent Name" SortExpression="AgentName" UniqueName="AgentName" /> 
            <telerik:GridBoundColumn DataField="WhseCity" DataType="System.String" HeaderText="City" SortExpression="WhseCity" UniqueName="WhseCity" /> 
            <telerik:GridBoundColumn DataField="WhseState" DataType="System.String" HeaderText="St" SortExpression="WhseState" UniqueName="WhseState" /> 
            <telerik:GridBoundColumn DataField="PrimeSCAC" DataType="System.String" HeaderText="SCAC" SortExpression="PrimeSCAC" UniqueName="PrimeSCAC" /> 
            <telerik:GridBoundColumn DataField="AgentClass" DataType="System.String" HeaderText="Class" SortExpression="AgentClass" UniqueName="AgentClass" /> 
            <telerik:GridBoundColumn DataField="Miles" DataType="System.String" HeaderText="Miles" SortExpression="Miles" UniqueName="Miles" /> 
            <telerik:GridBoundColumn DataField="DP3_OA_COUNT" DataType="System.String" HeaderText="OA" SortExpression="DP3_OA_COUNT" UniqueName="DP3_OA_COUNT" /> 
            <telerik:GridBoundColumn DataField="DP3_HLG_COUNT" DataType="System.String" HeaderText="HLG" SortExpression="DP3_HLG_COUNT" UniqueName="DP3_HLG_COUNT" /> 
            <telerik:GridBoundColumn DataField="DP3_DA_COUNT" DataType="System.String" HeaderText="DA" SortExpression="DP3_DA_COUNT" UniqueName="DP3_DA_COUNT" /> 
            <telerik:GridBoundColumn DataField="DP3_Q4_PERC" DataType="System.String" HeaderText="Q4%" SortExpression="DP3_Q4_PERC" UniqueName="DP3_Q4_PERC" /> 
            <telerik:GridBoundColumn DataField="DP3_Q5_PERC" DataType="System.String" HeaderText="Q5%" SortExpression="DP3_Q5_PERC" UniqueName="DP3_Q5_PERC" /> 
            <telerik:GridBoundColumn DataField="DP3_Q6_PERC" DataType="System.String" HeaderText="Q6%" SortExpression="DP3_Q6_PERC" UniqueName="DP3_Q6_PERC" /> 
            <telerik:GridBoundColumn DataField="DP3_Q7_PERC" DataType="System.String" HeaderText="Q7%" SortExpression="DP3_Q7_PERC" UniqueName="DP3_Q7_PERC" /> 
            <telerik:GridBoundColumn DataField="DP3_Q8_PERC" DataType="System.String" HeaderText="Q8%" SortExpression="DP3_Q8_PERC" UniqueName="DP3_Q8_PERC" /> 
            <telerik:GridBoundColumn DataField="ClaimsTotalShipments" DataType="System.String" HeaderText="12 Mth Cnt" SortExpression="ClaimsTotalShipments" UniqueName="ClaimsTotalShipments" /> 
            <telerik:GridBoundColumn DataField="QltyRatingDisplay" DataType="System.String" HeaderText="Qlty Rating" SortExpression="QltyRatingDisplay" UniqueName="QltyRatingDisplay" /> 
        </Columns> 
        <EditFormSettings> 
            <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
            </EditColumn> 
        </EditFormSettings> 
    </MasterTableView>  
    <ClientSettings> 
        <Scrolling AllowScroll="True" UseStaticHeaders="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 

search.ascx.vb
Protected Sub OnAjaxUpdate(ByVal sender As ObjectByVal args As ToolTipUpdateEventArgs) 
        Me.UpdateToolTip(args.Value, args.UpdatePanel) 
    End Sub 
 
    Private Sub UpdateToolTip(ByVal elementID As StringByVal panel As UpdatePanel) 
        Dim ctrl As Control = Page.LoadControl("~/UserControls/Beta/AgentDetails.ascx"
        panel.ContentTemplateContainer.Controls.Add(ctrl) 
 
        Dim details As UserControls_Beta_AgentDetails = DirectCast(ctrl, UserControls_Beta_AgentDetails) 
        details.AgentNumber = elementID 
    End Sub 
 
    Protected Sub radRadiusSearch_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles radRadiusSearch.ItemDataBound 
        If TypeOf e.Item Is GridDataItem Then 
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem) 
            Dim strAN As String = item("AgentNumber").Text 
            Dim strMiles As String = item("Miles").Text 
            Dim intMiles As Integer = 0 
            Dim strOA As String = item("DP3_OA_COUNT").Text 
            Dim strHLG As String = item("DP3_HLG_COUNT").Text 
            Dim strDA As String = item("DP3_DA_COUNT").Text 
            Dim strQ4 As String = item("DP3_Q4_PERC").Text 
            Dim strQ5 As String = item("DP3_Q5_PERC").Text 
            Dim strQ6 As String = item("DP3_Q6_PERC").Text 
            Dim strQ7 As String = item("DP3_Q7_PERC").Text 
            Dim strQ8 As String = item("DP3_Q8_PERC").Text 
            Dim strQlty As String = item("QltyRatingDisplay").Text 
            Dim target As Control = e.Item.FindControl("targetControl"
            Dim targetLink As HyperLink = e.Item.FindControl("targetControl"
            targetLink.NavigateUrl = "~/Tools/RadiusSearch-DP3/ShowAgent.aspx?AgentNumber=" & strAN 
            If Not [Object].Equals(target, NothingThen 
                If Not [Object].Equals(Me.radTTM, NothingThen 
                    Me.radTTM.TargetControls.Add(target.ClientID, (TryCast(e.Item, GridDataItem)).GetDataKeyValue("AgentNumber").ToString(), True
                End If 
            End If 
            If Len(strMiles) > 0 Then intMiles = CInt(strMiles) 
            item("Miles").Text = Math.Round(intMiles) 
            strQlty = Replace(strQlty, "-ACCEPTABLE"""
            strQlty = Replace(strQlty, "-UNKNOWN"""
            strQlty = Replace(strQlty, "-UNACCEPTABLE"""
            item("QltyRatingDisplay").Text = strQlty 
        End If 
    End Sub 
 
    Protected Sub radRadiusSearch_ItemCommand(ByVal source As ObjectByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles radRadiusSearch.ItemCommand 
        If e.CommandName = "Sort" OrElse e.CommandName = "Page" Then 
            radTTM.TargetControls.Clear() 
        End If 
    End Sub 
 
    Protected Sub Page_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.PreRender 
        'Version 2 - 5/6/2010 
        radRadiusSearch.PageSize = 25 
        radRadiusSearch.ClientSettings.Scrolling.SaveScrollPosition = False 
        radRadiusSearch.ClientSettings.Scrolling.FrozenColumnsCount = 2 
 
        If IsPostBack Then 
            Dim strZip As String = radZip.Text 
            Dim strCity As String = radCity.Text 
            Dim strState As String = radState.Text 
            Dim strMiles As String = radMiles.Text 
 
            Dim sqlConn As New SqlConnection 
            Dim sqlCmd As New SqlCommand 
 
            sqlConn.ConnectionString = ConfigurationManager.ConnectionStrings("zip_codesConnectionString").ConnectionString 
            sqlConn.Open() 
 
            If (Len(strZip) > 0 And Len(strMiles) > 0) Or (Len(strCity) > 0 And Len(strState) > 0 And Len(strMiles) > 0) Then 
                If Len(strZip) > 0 Then 
                    sqlCmd = New SqlCommand("_Radius_AgentSearch_DP3_ByZip", sqlConn) 
                    sqlCmd.CommandType = Data.CommandType.StoredProcedure 
                    sqlCmd.Parameters.AddWithValue("@ZipCode", strZip) 
                    sqlCmd.Parameters.AddWithValue("@Miles", strMiles) 
                Else 
                    sqlCmd = New SqlCommand("_Radius_AgentSearch_DP3_ByCityState", sqlConn) 
                    sqlCmd.CommandType = Data.CommandType.StoredProcedure 
                    sqlCmd.Parameters.AddWithValue("@City", strCity) 
                    sqlCmd.Parameters.AddWithValue("@State", strState) 
                    sqlCmd.Parameters.AddWithValue("@Miles", strMiles) 
                End If 
 
                radRadiusSearch.DataSource = sqlCmd.ExecuteReader 
                radRadiusSearch.DataBind() 
                radRadiusSearch.Visible = True 
            Else 
                radRadiusSearch.Visible = False 
            End If 
 
        End If 
    End Sub 
 
    Protected Sub cmdSubmit_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles cmdSubmit.Click 
        radRadiusSearch.CurrentPageIndex = 0 
    End Sub 


1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 13 May 2010, 10:11 AM
Hi Joshua,

Please avoid posting the same question in the forums and in a support ticket, as this may make tracking your support history more difficult or may cause duplicate replies by different support officers. We have replied to you in the support thread.

Best wishes,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Joshua
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Share this question
or