GridDropDownColumn text will not render in first row (only) of RadGrid if GridDroDownListColumnEditor is used

7 posts, 1 answers
  1. T. Stanley
    T. Stanley avatar
    22 posts
    Member since:
    Sep 2007

    Posted 04 Sep 2009 Link to this post

    Hi.  I have the following code using a RadGrid that contains three fields of GridDropDownList columns.  I want to control the width of the columns in edit mode (the edit DDLs are too wide if not), so I created a number of GridDropDownListColumnEditors and declaratively set the width of each.  The problem is that when I use the column editors, the grid renders correctly except for the first data row, in which the dropdownlist columns are not rendered.  This error does not occur with the BoundColumn fields (also under the control of a ColumnEditor).  When I put the first row into edit mode, then the dropdown list coulmns display.  When I close the editing (either cancel or accept), the text continues to display and does thereafter.  Only on initial loading of the grid and only on the first row do I see this problem.  And if I remove the references to the DropDownListColumnEditors, then all rows display correctly all the time (but then I still have the width problem).  Can you help?  Thanks!

    Tom Stanley

        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="sdsCRNAShifts" GridLines="None" Skin="Simple" 
            AutoGenerateColumns="False" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" PageSize="128" Width="100%" AllowSorting="True" > 
            <MasterTableView DataSourceID="sdsCRNAShifts" CommandItemDisplay="TopAndBottom" DataKeyNames="shiftID" EditMode="InPlace" > 
                <Columns> 
                    <telerik:GridCheckBoxColumn DataField="active" HeaderText="active" UniqueName="active" AllowFiltering="False" AllowSorting="False">  
                        <HeaderStyle Width="20px" /> 
                    </telerik:GridCheckBoxColumn> 
                    <telerik:GridDropDownColumn DataField="shiftType" DataSourceID="XmlDataSource1"  HeaderText="Type" 
                        ListValueField="ID" ListTextField="Text" UniqueName="shiftType" ColumnEditorID="GridDropDownListColumnEditor1" > 
                        <ItemStyle Width="60px" /> 
                    </telerik:GridDropDownColumn> 
                    <telerik:GridBoundColumn DataField="shiftName" HeaderText="Name" UniqueName="shiftName" ColumnEditorID="GridTextBoxColumnEditor1" > 
                        <HeaderStyle Width="120px" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="shiftDescr" HeaderText="Description" UniqueName="shiftDescr" ColumnEditorID="GridTextBoxColumnEditor2" > 
                        <HeaderStyle Width="200px" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridDropDownColumn DataField="bOff" DataSourceID="sdsTimeText" HeaderText="BeginTime" ListTextField="timeText" 
                         ListValueField="numMins" UniqueName="bOff" ColumnEditorID="GridDropDownListColumnEditor2" > 
                        <HeaderStyle Width="100px" /> 
                    </telerik:GridDropDownColumn> 
                    <telerik:GridDropDownColumn DataField="eOff" DataSourceID="sdsTimeText" HeaderText="EndTime" ListTextField="timeText" 
                         ListValueField="numMins" UniqueName="eOff" ColumnEditorID="GridDropDownListColumnEditor2" > 
                        <HeaderStyle Width="100px" /> 
                    </telerik:GridDropDownColumn> 
                    <telerik:GridEditCommandColumn ButtonType="ImageButton">  
                        <HeaderStyle Width="50px" /> 
                    </telerik:GridEditCommandColumn> 
                </Columns> 
           </MasterTableView> 
            <ClientSettings> 
                <Selecting AllowRowSelect="True" /> 
            </ClientSettings> 
        </telerik:RadGrid> 
        <telerik:GridDropDownListColumnEditor ID="GridDropDownListColumnEditor1" runat="server" DropDownStyle-Width="60px" /> 
        <telerik:GridDropDownListColumnEditor ID="GridDropDownListColumnEditor2" runat="server" DropDownStyle-Width="100px" /> 
        <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="120px" /> 
        <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="200px" /> 
      
     

  2. Chris
    Chris avatar
    58 posts
    Member since:
    Jun 2012

    Posted 07 Sep 2009 Link to this post

    Funnily enough I posted about this  a few days ago too. Here is a link to the post. http://www.telerik.com/community/forums/aspnet-ajax/grid/first-row-loses-dropdown-bound-value-when-using-griddropdownlistcolumneditor.aspx

    I'll let you know if I get a resoultion for my post.

    Chris
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 08 Sep 2009 Link to this post

    Hello Chris,

    Can you please try the latest version (Q2 2009 SP1) of RadControls for ASP.NET AJAX and let us know if there is any change in the behavior you are observing.

    Regards,
    Rosen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Chris
    Chris avatar
    58 posts
    Member since:
    Jun 2012

    Posted 08 Sep 2009 Link to this post

    Hi Rosen,
    the Q2 2009 SP1 cnotrols seem to work correctly after a quick test. One thing I did notice was that the Telerik.Web.UI 2009.2.826.** did not register in the GAC on install where as the Telerik.Web.Design 200.2.826.** did.

    Thanks

    Chris
  6. T. Stanley
    T. Stanley avatar
    22 posts
    Member since:
    Sep 2007

    Posted 09 Sep 2009 Link to this post

    Hi.  I updated my DLLs to Build 826 from 701 and all is well.  Thanks very much.

    Tom Stanley
  7. Randy
    Randy avatar
    23 posts
    Member since:
    Jul 2012

    Posted 22 Sep 2009 Link to this post

    Hello,

    First I just want to say, I love using the Telerik controls.  You guys have done a great job.  But...

    I ran into the same issue as the posts above regaurding having a ColumnEditor for the DropDownColumn, and yes removing the ColumnEditor for it resolves the issue.  I would have upgraded to the version as specified above, but one very big problem in your release of RadControls for ASP.NET AJAX 2009.2 826 (Aug 26, 2009), when I use the Autocomplete and Load on Demand feature together, the 826 release is broken, it stops firing any events from the dropdown after the first 3 chars are typed, I know this because I put in alerts to see if any of the client events would fire, nada.  After 3 chars it stops firing events.  When I use the RadControls for ASP.NET AJAX 2009.2 701 (Jul 1, 2009) version the code works as expected, perfectly and the events do fire after the first 3 chars are typed in the dropdown.  I am really concerned that I have to chose which bug is less impacting on my project to determin which version of Telerik controls I should be using.  My other concern is that your online demos work fine, which leads me to believe that you are using the older version of the controls.  It would be so nice if you guys listed (on your demos) which version of Telerik controls you are using on the backend.  I spent days thinking it was my code, and after money and time spent, it all came down to the version, because I assumed you used the 826 version on your demo website.

    I am using these 2 demos together on one single form (has nothing to do with a grid, grid isn't even on the form):
    http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/autocompleteclientside/defaultcs.aspx
    http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx

    Here is the code I used.

    ASPX Page:
    1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="_826BugWebApp._Default" %> 
    2  
    3 <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
    4  
    5 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    6  
    7 <html xmlns="http://www.w3.org/1999/xhtml" > 
    8 <head runat="server">  
    9     <title>826 Telerik Bug Example (701 Corrects this)</title> 
    10       
    11 </head> 
    12 <body> 
    13     <form id="form1" runat="server">  
    14     <telerik:RadScriptBlock runat="server">  
    15         <script language="javascript" type="text/javascript">  
    16             function HandleKeyPress(sender, eventArgs) {  
    17                 alert('key was pressed');  
    18                 var ddl = $find("<%= RadComboBox1.ClientID %>");  
    19                 var ddlddlInput = ddl.get_inputDomElement();  
    20  
    21                 // If BACKSPACE was pressed  
    22                 if (eventArgs.get_domEvent().keyCode == 8) {  
    23                     // Clear the user dropdown selection  
    24                     ddl.clearSelection();  
    25  
    26                     // Make sure focus is set back onto the dropdown since we cleared it.  
    27                     ddlInput.focus();  
    28                 }  
    29             }  
    30         </script> 
    31     </telerik:RadScriptBlock> 
    32     <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">  
    33     </telerik:RadScriptManager> 
    34     <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">  
    35     <div> 
    36       
    37         Type more than 3 chars:  
    38         <telerik:RadComboBox ID="RadComboBox1" runat="server" 
    39             AutoPostBack="false" 
    40             Width="318px" Height="150px" 
    41             EmptyMessage="Select an Item" 
    42             EnableLoadOnDemand="true" 
    43             ShowMoreResultsBox="true" 
    44             AllowCustomText="true" 
    45             EnableVirtualScrolling="true" 
    46             CloseDropDownOnBlur="true" 
    47             DropDownWidth="640px" 
    48             HighlightTemplatedItems="true" 
    49             DataValueField="WidgetID" DataTextField="WidgetName" 
    50             OnClientKeyPressing="HandleKeyPress" 
    51             OnItemsRequested="RadComboBox1_ItemsRequested">  
    52         </telerik:RadComboBox> 
    53       
    54     </div> 
    55     </telerik:RadAjaxPanel> 
    56       
    57     </form> 
    58 </body> 
    59 </html> 
    60  
    NOTE: Remove line 17, that was just there as a test....please remove alert('key was pressed'); from the javascript.


    The code behind:
    1 using System;  
    2 using System.Collections.Generic;  
    3 using System.Configuration;  
    4 using System.Data;  
    5 using System.Data.SqlClient;  
    6 using System.Linq;  
    7 using System.Web;  
    8 using System.Web.UI;  
    9 using System.Web.UI.WebControls;  
    10 using Telerik.Web.UI;  
    11  
    12 namespace _826BugWebApp  
    13 {  
    14     public partial class _Default : System.Web.UI.Page  
    15     {  
    16         /// <summary>  
    17         /// Gets or sets the value of the ItemsPerRequest.  
    18         /// </summary>  
    19         private const int ItemsPerRequest = 20;  
    20  
    21         protected void Page_Load(object sender, EventArgs e)  
    22         {  
    23             if (!this.IsPostBack)  
    24             {  
    25                 // Set the Initial Focus on the page.  
    26                 Page.SetFocus(this.RadComboBox1);  
    27             }  
    28         }  
    29  
    30         /// <summary>  
    31         /// As text changes in the drop down, a request is made to filter the result  
    32         /// in the drop down (like intellisense).  
    33         /// </summary>  
    34         /// <param name="sender">The object raising the event.</param>  
    35         /// <param name="e">The event arguments.</param>  
    36         protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)  
    37         {  
    38             DataTable data = GetData(e.Text);  
    39  
    40             int itemOffset = e.NumberOfItems;  
    41             int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);  
    42             e.EndOfItems = endOffset == data.Rows.Count;  
    43  
    44             for (int i = itemOffset; i < endOffset; i++)  
    45             {  
    46                 this.RadComboBox1.Items.Add(new RadComboBoxItem(data.Rows[i]["WidgetName"].ToString(), data.Rows[i]["WidgetID"].ToString()));  
    47             }  
    48  
    49             for (int i = 0; i < RadComboBox1.Items.Count; i++)  
    50             {  
    51                 RadComboBox1.Items[i].DataBind();  
    52             }  
    53  
    54             e.Message = GetStatusMessage(endOffset, data.Rows.Count);  
    55         }  
    56  
    57         /// <summary>  
    58         /// Sets the status message for drop down  
    59         /// </summary>  
    60         /// <param name="offset">The offset value.</param>  
    61         /// <param name="total">The total value.</param>  
    62         /// <returns>The string value</returns>  
    63         private static string GetStatusMessage(int offset, int total)  
    64         {  
    65             if (total <= 0)  
    66             {  
    67                 return "No matches";  
    68             }  
    69  
    70             return String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total);  
    71         }  
    72  
    73         /// <summary>  
    74         /// Gets the data based on a the text entered from the drop down.  
    75         /// </summary>  
    76         /// <param name="text">The text value.</param>  
    77         /// <returns>The data table results</returns>  
    78         private static DataTable GetData(string text)  
    79         {  
    80             SqlDataAdapter adapter = new SqlDataAdapter("SELECT [WidgetID], [WidgetName] FROM [Widget] WHERE [WidgetName] LIKE '%' + @text + '%' ORDER BY [WidgetName] ASC", ConfigurationManager.ConnectionStrings["MyDatabaseConnectionString"].ConnectionString);  
    81             adapter.SelectCommand.Parameters.AddWithValue("@text", text);  
    82  
    83             DataTable data = new DataTable();  
    84             adapter.Fill(data);  
    85  
    86             return data;  
    87         }  
    88     }  
    89 }  
    90  

    Can you please look into this?  For now I will remove the ColumnEditor in version 701 and not use the upgrade because my LoadOnDemand and Autocomplete is most important.  But I am concerned that funcationality that was there is now not there in the upgrade.

    - Randy Bigbie
  8. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 25 Sep 2009 Link to this post

    Hello Randy,

    To my regret we identified the problem in the load on demand of the combobox shortly after the last official release. We created a sticky forum post, please check it here:

    FIX: Load on demand does not work correctly in Q2 2009 SP1

    I really apologize for the caused inconvenience.

    Greetings,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017