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

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

6 Answers 229 Views
Grid
This is a migrated thread and some comments may be shown as answers.
T. Stanley
Top achievements
Rank 1
T. Stanley asked on 04 Sep 2009, 08:31 PM

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" /> 
  
 

6 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 2
answered on 07 Sep 2009, 08:03 AM
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
0
Accepted
Rosen
Telerik team
answered on 08 Sep 2009, 06:19 AM
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.
0
Chris
Top achievements
Rank 2
answered on 08 Sep 2009, 08:21 AM
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
0
T. Stanley
Top achievements
Rank 1
answered on 09 Sep 2009, 07:56 PM
Hi.  I updated my DLLs to Build 826 from 701 and all is well.  Thanks very much.

Tom Stanley
0
Randy
Top achievements
Rank 1
answered on 22 Sep 2009, 04:54 PM
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:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="_826BugWebApp._Default" %> 
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>826 Telerik Bug Example (701 Corrects this)</title> 
      
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptBlock runat="server">  
        <script language="javascript" type="text/javascript">  
            function HandleKeyPress(sender, eventArgs) {  
                alert('key was pressed');  
                var ddl = $find("<%= RadComboBox1.ClientID %>");  
                var ddlddlInput = ddl.get_inputDomElement();  
 
                // If BACKSPACE was pressed  
                if (eventArgs.get_domEvent().keyCode == 8) {  
                    // Clear the user dropdown selection  
                    ddl.clearSelection();  
 
                    // Make sure focus is set back onto the dropdown since we cleared it.  
                    ddlInput.focus();  
                }  
            }  
        </script> 
    </telerik:RadScriptBlock> 
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">  
    </telerik:RadScriptManager> 
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">  
    <div> 
      
        Type more than 3 chars:  
        <telerik:RadComboBox ID="RadComboBox1" runat="server" 
            AutoPostBack="false" 
            Width="318px" Height="150px" 
            EmptyMessage="Select an Item" 
            EnableLoadOnDemand="true" 
            ShowMoreResultsBox="true" 
            AllowCustomText="true" 
            EnableVirtualScrolling="true" 
            CloseDropDownOnBlur="true" 
            DropDownWidth="640px" 
            HighlightTemplatedItems="true" 
            DataValueField="WidgetID" DataTextField="WidgetName" 
            OnClientKeyPressing="HandleKeyPress" 
            OnItemsRequested="RadComboBox1_ItemsRequested">  
        </telerik:RadComboBox> 
      
    </div> 
    </telerik:RadAjaxPanel> 
      
    </form> 
</body> 
</html> 
 
NOTE: Remove line 17, that was just there as a test....please remove alert('key was pressed'); from the javascript.


The code behind:
using System;  
using System.Collections.Generic;  
using System.Configuration;  
using System.Data;  
using System.Data.SqlClient;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using Telerik.Web.UI;  
 
namespace _826BugWebApp  
{  
    public partial class _Default : System.Web.UI.Page  
    {  
        /// <summary>  
        /// Gets or sets the value of the ItemsPerRequest.  
        /// </summary>  
        private const int ItemsPerRequest = 20;  
 
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!this.IsPostBack)  
            {  
                // Set the Initial Focus on the page.  
                Page.SetFocus(this.RadComboBox1);  
            }  
        }  
 
        /// <summary>  
        /// As text changes in the drop down, a request is made to filter the result  
        /// in the drop down (like intellisense).  
        /// </summary>  
        /// <param name="sender">The object raising the event.</param>  
        /// <param name="e">The event arguments.</param>  
        protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)  
        {  
            DataTable data = GetData(e.Text);  
 
            int itemOffset = e.NumberOfItems;  
            int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);  
            e.EndOfItems = endOffset == data.Rows.Count;  
 
            for (int i = itemOffset; i < endOffset; i++)  
            {  
                this.RadComboBox1.Items.Add(new RadComboBoxItem(data.Rows[i]["WidgetName"].ToString(), data.Rows[i]["WidgetID"].ToString()));  
            }  
 
            for (int i = 0; i < RadComboBox1.Items.Count; i++)  
            {  
                RadComboBox1.Items[i].DataBind();  
            }  
 
            e.Message = GetStatusMessage(endOffset, data.Rows.Count);  
        }  
 
        /// <summary>  
        /// Sets the status message for drop down  
        /// </summary>  
        /// <param name="offset">The offset value.</param>  
        /// <param name="total">The total value.</param>  
        /// <returns>The string value</returns>  
        private static string GetStatusMessage(int offset, int total)  
        {  
            if (total <= 0)  
            {  
                return "No matches";  
            }  
 
            return String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total);  
        }  
 
        /// <summary>  
        /// Gets the data based on a the text entered from the drop down.  
        /// </summary>  
        /// <param name="text">The text value.</param>  
        /// <returns>The data table results</returns>  
        private static DataTable GetData(string text)  
        {  
            SqlDataAdapter adapter = new SqlDataAdapter("SELECT [WidgetID], [WidgetName] FROM [Widget] WHERE [WidgetName] LIKE '%' + @text + '%' ORDER BY [WidgetName] ASC", ConfigurationManager.ConnectionStrings["MyDatabaseConnectionString"].ConnectionString);  
            adapter.SelectCommand.Parameters.AddWithValue("@text", text);  
 
            DataTable data = new DataTable();  
            adapter.Fill(data);  
 
            return data;  
        }  
    }  
}  
 

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
0
Veselin Vasilev
Telerik team
answered on 25 Sep 2009, 07:48 AM
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.
Tags
Grid
Asked by
T. Stanley
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 2
Rosen
Telerik team
T. Stanley
Top achievements
Rank 1
Randy
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or