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

GridDropDownColumn Cells Are Blank

5 Answers 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 29 Jan 2012, 02:52 AM
I have a webform that contains a RadGrid and the grid is configured for in-place editing. The RadGrid has 5 columns, where the first 4 columns are data columns, and the 5th column is an edit button column. More specifically, the first 3 columns of the grid are GridBoundColumn column types, the fourth column is a GridDropDownColumn, and the last (or fifth) column is a GridEditCommandColumn.

When the web form is viewed, the RadGrid displays multiple rows of data; let's hypothetically say that the grid displays 10 rows of data. All the data cells within the grid display data, expect the cells under the 4th column. The cells in the 4th column are always blank. If I switch the 4th column from a GridDropDownColumn to a GridBoundColumn, the problem does not occur. When column 4 is based on a GridBoundColumn, all the cells under column 4 are populated. But when column 4 is a GridDropDownColumn, the cells are always blank.

In addition, if I randomly click the edit button on one of the rows; let's say row 5, the cell in column 4 of row 5 suddenly becomes populated, and all the cells of column 4 below row 5 become populated. But the cells of column 4 that are above row 5 are still blank. IOWs, whichever row that you click the edit button, the cell of column 4, and all the cells under column 4, become populated. But all the cells of column 4 that are above the row where you clicked edit remain blank. Again, if I use a GridBoundColumn for in-place edits, instead of a GridDropDownColumn, this problem does not occur.

Has anybody seen this and can you explain how to fix this problem?

5 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 29 Jan 2012, 05:35 PM
Hello steven,

if possible then please update your version with latest one.
Let me know if any concern.

Thanks,
Jayesh Goyani
0
Brian
Top achievements
Rank 1
answered on 30 Jan 2012, 02:18 PM
Jayesh,

Thank you for your reply.

I think I may be already running the latest version of the Telerik AJAX controls; 2011.3.1305.40. Can you verify that I have the latest version?

Thank you.
0
Elliott
Top achievements
Rank 2
answered on 30 Jan 2012, 03:52 PM
I would be curious as to how you are populating your grid with data-both in Edit Mode and not
0
Brian
Top achievements
Rank 1
answered on 30 Jan 2012, 10:41 PM
When I populate gridVPO (my RadGrid), I do so as follows:
protected void gridVPO_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) {
    string strSQL = "SELECT tblVPOs.PO AS PO#, tblVend.company AS Vendor, " +
                             "tblVPOs.SO AS SO#, tblVPOs.Notes AS Comments " +
                    "FROM Projects AS tblVPOs " +
                    "INNER JOIN Vendors AS tblVend " +
                    "ON tblVend.VendID = tblVPOs.VendorID ";
 
    if (this.gridProjs.SelectedValue != String.Empty) {
        strSQL += "WHERE tblVPOs.SO LIKE '" + this.gridProjs.SelectedValue + "' ";
    }
 
    strSQL += "ORDER BY tblVPOs.PO ASC";
 
    this.gridVPO.DataSource = getSource(strSQL);
    this.gridVPO.MasterTableView.DataKeyNames = new string[] { "PO#" };
} //End protected void gridVPO_NeedDataSource()

The getSource() is my user-defined method that returns a DataTable. Note that the SQL statement that is passed to getSource may or may not be filtered, depending on whether a value is selected in another RadGrid called gridProjs. This all works very well and always has, until I decided to add a GridDropDownColumn to my in-place edits.

I don't utilize the event radVPOGrid_EditCommand(). When I click edit, the data to be modified automatically appears on the various grid cells. However, I do have the following:
protected void gridVPO_ItemDataBound(object sender, GridItemEventArgs e) {
    if (e.Item is GridEditableItem && e.Item.IsInEditMode) {
        string strSQL = "SELECT DISTINCT SO " +
                        "FROM Projects " +
                        "WHERE SO NOT LIKE '' " +
                        "ORDER BY SO ASC";
 
        GridEditableItem geItem = e.Item as GridEditableItem;
        GridEditManager geMgr = geItem.EditManager;
        GridDropDownListColumnEditor gddlcEditor = geMgr.GetColumnEditor("SOnum") as GridDropDownListColumnEditor;
 
        string strSOnum = DataBinder.Eval(geItem.DataItem, "SO#").ToString();
         
        gddlcEditor.DataSource = getSource(strSQL);
        gddlcEditor.DataBind();
        gddlcEditor.SelectedValue = strSOnum;
    }
} //End protected void gridVPO_ItemDataBound()

The above event was added after I replaced a GridBoundColumn within the grid with a GridDropDownColumn.
0
Elliott
Top achievements
Rank 2
answered on 02 Feb 2012, 03:46 PM
sorry to take so long to respond
I'm just a developer, and a mid-level one at that
I looked through my code which used a GridDropDownColumn - and I manually filled it
you might be better off using a templated column with a label bound to the dataitem and a dropdown filled on the item databound
if you want to use the GridDropDown column
<telerik:GridDropDownColumn UniqueName="RepGroup" DropDownControlType="RadComboBox" EnableEmptyListItem="True" EmptyListItemValue="0" EmptyListItemText="Select One" ListValueField="RepGroupID" ListTextField="RepGroups" HeaderText="Rep Group" />

if the item is not in edit mode
Protected Sub gvVendor_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles gvVendor.ItemDataBound
 Dim gdItem As GridDataItem = Nothing
 gdItem = CType(e.Item, GridDataItem)
 If TypeOf e.Item Is IGridInsertItem Then
 ElseIf TypeOf e.Item Is GridDataItem Then
 If TypeOf gdItem("RepGroup").Controls(0) Is Literal Then
     litRepGroup = CType(gdItem("RepGroup").Controls(0), Literal)
     litRepGroup.Text = drView("RepGroup").ToString
 End If
 End If
if the item is in edit mode
Protected Sub gvVendor_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles gvVendor.ItemDataBound
    Dim geItem As GridEditableItem = Nothing       
    If TypeOf e.Item Is GridEditableItem Then
        geItem = CType(e.Item, GridEditableItem)
        FillInRepGroups(geItem)
    End If
Private Sub FillInRepGroups(ByVal geItem As GridEditableItem)
    Dim geManager As GridEditManager = Nothing
    Dim gddlEditor As GridDropDownListColumnEditor = Nothing
    Dim rcbRepGroup As RadComboBox
    Dim rcbItem As RadComboBoxItem = Nothing
    Dim ds As DataSet = Nothing
    Dim ws As CommonFunctions
    If geItem.IsInEditMode Then
    Else
        Exit Sub
    End If
    geManager = geItem.EditManager
    gddlEditor = CType(geManager.GetColumnEditor("RepGroup"), GridDropDownColumnEditor)
    rcbRepGroup = gddlEditor.ComboBoxControl
    ws = New CommonFunctions
    ds = ws.GetRepGroups
    rcbRepGroup.DataSource = ds.Tables(0)
    rcbRepGroup.DataValueField = "RepGroupsID"
    rcbRepGroup.DataTextField = "RepGroups"
    rcbRepGroup.DataBind()
    rcbItem = New RadComboBoxItem("Select One", 0)
    rcbRepGroup.Items.Insert(0, rcbItem)
End Sub
kinda defeats the purpose, though
Tags
Grid
Asked by
Brian
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Brian
Top achievements
Rank 1
Elliott
Top achievements
Rank 2
Share this question
or