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

Problem with GridDropDownColumn

2 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tiago
Top achievements
Rank 1
Tiago asked on 10 Jan 2011, 03:21 PM
Hi, everybody.
Here in my company we have found a trouble with GridDropDownCollum, after we upgraded to Microsoft Dot Net Framework 4.0, this collumns only show the first value of the DataSource for each item of the DataSource, we have the same page running under the Dot Net Framework 2.0 and it works well.
This is the code that is used to populate the GridDropDownCollum:
protected void grd_list_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            GridEditManager editMan = editedItem.EditManager;
            GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)(editMan.GetColumnEditor("StatusUniqueName"));
            //Ativo' WHEN STATUS = 'P' THEN 'Pausado' WHEN STATUS = 'F' THEN 'Finalizado
 
            ArrayList ds = new ArrayList();
            ds.Add(new status("A", "Ativar"));
            ds.Add(new status("P", "Pausar"));
            ds.Add(new status("F", "Finalizar"));
 
            //string val = oMonitor.ExecuteScalarString("select STATUS from MAILING WHERE ID = " + editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Id"]);
 
            string s = DataBinder.Eval(editedItem.DataItem, "StatusValue").ToString(); //the field should point to the ListValueField of the dropdown editor
 
 
            editor.DataSource = ds;
            editor.DataTextField = "Status";
             
            editor.DataBind();
            
            editor.SelectedValue = s;
}

This is the aspx code of the collun:

<telerik:GridDropDownColumn UniqueName="StatusUniqueName" ListDataMember="Status" ListTextField = "Status"
              ListValueField="StatusValue" DataField="StatusValue" HeaderText="Status">
            </telerik:GridDropDownColumn>

This is the class Status that you see in grd_list_ItemDataBound:
public class status
   {
       private string _value;
       private string _text;
       public status(string value, string text)
       {
           _value = value;
           _text = text;
       }
       public string Status
       {
           get { return _text; }
           set { _text = value; }
       }
       public string StatusValue
       {
           get { return _value; }
           set { _value = value; }
       }
   };

I have tried the examples describeds in this page: http://www.telerik.com/help/aspnet-ajax/grdcustomizeconfiguregriddropdowncolumn.html,
but I had the same problem.
As I Sad I am using Microsoft Dot Net Framework 4.0 , and Rad Controls Q3 2010.
Is there a easy way to fix this problem?



2 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 10 Jan 2011, 04:49 PM
Hi Tiago,

There are no functional differences between a GridDropDownColumn in a RadGrid running under .NET 2.0 and 4.0. Your code seems OK as far as databinding the dropdowns in the GridDropDownColumn is concerned. If the problem persists, consider opening a regular support ticket where you can send us some stripped down runnable project we can debug locally. This will help us identify what might be the problem with your particular scenario.

Greetings,
Veli
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Tiago
Top achievements
Rank 1
answered on 10 Jan 2011, 05:01 PM
Thanks for your answer, unfortunatelly there is no way to send the whole project because its to big, i will try to do another short project with the same code to reproduce this scenario , so i will send it to you. I don't know if it will help, but if you want I can send the aspx and aspx.cs pages to you.
Tags
Grid
Asked by
Tiago
Top achievements
Rank 1
Answers by
Veli
Telerik team
Tiago
Top achievements
Rank 1
Share this question
or