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

RadComboBox within GridTemplateColumn unable to get ID and bind edit data.

1 Answer 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tryingfor48
Top achievements
Rank 1
Tryingfor48 asked on 15 May 2014, 02:01 AM
Hi I am using RadComboBox under GridTemplateColumn,
Whenever i click on edit the value unable to bind. the update radcombobox it shows blank and have to reselect the data.
How do i insert data into RadComboBox once press on edit?

here is my source code please help urgently I've been trying for 48 hours....

<telerik:RadGrid ID="RadGridYieldConfig" runat="server" AllowFilteringByColumn="True"
            AllowPaging="True" PageSize="12" AllowSorting="True" CellSpacing="0" GridLines="None"
            OnNeedDataSource="RadGridYieldConfig_NeedDataSource" OnItemCommand="RadGridYieldConfig_ItemCommand" EnableLoadOnDemand="True">
            <GroupingSettings CaseSensitive="false" />
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
            <MasterTableView Width="100%" CommandItemDisplay="Top" AutoGenerateColumns="false"
                EditMode="InPlace">
                <Columns>
                    <telerik:GridEditCommandColumn>
                    </telerik:GridEditCommandColumn>
                    <telerik:GridTemplateColumn
                        HeaderText="Customer Name" DataField="CUSTOMER_NAME" UniqueName="CUSTOMER_NAME">
                        <ItemTemplate>
                        <asp:Label ID="lblCustomerName" runat="server"
                Text='<%# DataBinder.Eval(Container.DataItem, "CUSTOMER_NAME")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadComboBox runat="server" ID="RCBCustomer" DataTextField="catg010"
                                DataValueField="catg010" OnItemsRequested="RCBCustomer_OnItemsRequested"
                                OnSelectedIndexChanged="RCBCustomer_OnSelectedIndexChangedHandler" Width="100%">
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn> 



Protected Sub RadGridYieldConfig_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs)
        m_eInf = New YieldInfo
        m_DB = New Database
        Dim item As GridEditableItem = TryCast(e.Item, GridEditableItem)


        If e.CommandName = RadGrid.EditCommandName Then

            Dim DataItem As GridDataItem = CType(e.Item, GridDataItem)
            If e.Item.IsDataBound Then

                RCBEditValue = CType(item.FindControl("lblCustomerName"), Label).Text

                Dim box As RadComboBox = DirectCast(item.FindControl("RCBCustomer"), RadComboBox)
                box.Text = RCBEditValue
            End If



















1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 May 2014, 03:55 AM
Hi,

Please take a look at this article which describes how to bind RadComboBox in RadGrid.
Please try and let me know if any concern.

Thanks,
Princy
Tags
Grid
Asked by
Tryingfor48
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or