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

Binding DropDownList inside RadGrid using Batch edit mode in code behind

0 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Diego
Top achievements
Rank 1
Diego asked on 17 Feb 2017, 06:18 PM

I'm having trouble binding values to a DropDownList inside an ItemTemplate in Batch Edit Mode, I tried looking for the control in RadGrid1_PreRender but it returns a null value, I can't use an SQL Data Source because I'm getting the values for the DDL from a WebService, I'd really appreciate some help with this problem, you can find my code below:

<p>public partial class Transform : System.Web.UI.Page     {
        public static CDEC.Interfaz.Instalacion.Contexto.ExcelInfo interfaz = new CDEC.Interfaz.Instalacion.Contexto.ExcelInfo();
        public static object[,] lista = interfaz.Contexto_EmpresaGrupo(179);
  
        protected void Page_Load(object sender, EventArgs e)
        {
  
        }
  
        protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            var lista2D = new ExcelInfo(0, 0).OBT_Transformadores_2D();
            this.RadGrid1.DataSource = lista2D;
        }
  
        protected void cbxPropietarioID_PreRender(object sender, EventArgs e)
        {
            //Doesn't seem to work             RadComboBox dropDownList = (RadComboBox)RadGrid1.FindControl("cbxPropietarioID");
        }
  
        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            GridTableView masterTable = (sender as RadGrid).MasterTableView;
  
            //This returns a null             RadDropDownList categoryEditor = masterTable.GetBatchColumnEditor("ID_Propietario") as RadDropDownList;
        }
  
  
    }</p><p></p>
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Transform.aspx.cs" Inherits="InfoTec.Instalacion.Transform" %><%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %><asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">     <br />     
    <link href="styles.css" rel="stylesheet" />     <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" 
        onneeddatasource="RadGrid1_NeedDataSource" PageSize="15" Skin="Simple" 
        onitemdatabound="RadGrid1_ItemDataBound" AllowMultiRowEdit="True" 
        RenderMode="Lightweight" ShowFooter="True" 
        onprerender="RadGrid1_PreRender">         <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>         <ExportSettings>             <Pdf PageWidth="">             </Pdf>         </ExportSettings>         <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ID_Trafo_2D" EditMode="Batch">             <CommandItemSettings ShowExportToExcelButton="True" 
                ShowExportToWordButton="True" ShowCancelChangesButton="True" 
                ShowSaveChangesButton="True" />             <Columns>                 <telerik:GridBoundColumn DataField="ID_2D" 
                    FilterControlAltText="Filter column column" HeaderText="2D ID" 
                    UniqueName="column" ReadOnly="True">                     <ItemStyle Width="60px" Wrap="True" />                 </telerik:GridBoundColumn>                 <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" 
                    HeaderText="Propietario ID" UniqueName="ID_Propietario" DataField="ID_Propietario">                     <EditItemTemplate>                         <telerik:RadDropDownList ID="ddlPropietarioID" runat="server" 
                            DataTextField="NombrePropietario" DataValueField="ID_Propietario">                         </telerik:RadDropDownList>                     </EditItemTemplate>                     <ItemTemplate>                         <%# Eval("NombrePropietario")%>                     </ItemTemplate>                     <HeaderStyle BackColor="Yellow" />                     <ItemStyle Wrap="False" />                 </telerik:GridTemplateColumn>             </Columns>         </MasterTableView>         <PagerStyle PageSizes="15;30;90" /> 
        <FilterMenu RenderMode="Lightweight"></FilterMenu
        <HeaderContextMenu RenderMode="Lightweight"></HeaderContextMenu>     </telerik:RadGrid>     <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">     </telerik:RadScriptManager></asp:Content>

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Diego
Top achievements
Rank 1
Share this question
or