Load On Demand RadComboBox inside an EditItemTemplate of RadGrid

17 posts, 1 answers
  1. Answer
    Telerik Admin
    Telerik Admin avatar
    1679 posts
    Member since:
    Oct 2004

    Posted 18 Aug 2010 Link to this post

    Requirements

    RadControls version RadComboBox for ASP.NET AJAX
    .NET version 2.0+
    Visual Studio version VS 2005/2008/2010
    programming language C#/VB.NET
    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    This sample project demonstrates how to preselect an item in RadComboBox with Load-On-Demand enabled and nested within the EditItemTemplate of RadGrid (or other parent databound control).

    THE ISSUE
    RadComboBox with Load-On-Demand enabled is often nested in EditItemTemplate of RadGrid or another data-bound control. 
    However preselecting a RadComboBoxItem at EditItemTemplate of the parent control in such scenario is a tricky task. Sometimes developers try to set the SelectedValue property of the RadComboBox via declarative databinding and receive this error: “Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.” 

    Please note that when the RadComboBox with Load-On-Demand feature initially loads - it is empty and it has no items. Load-On-Demand fires and populates the control with data when user types in the input area or clicks on the drop-down toggle image (if there are no items in the RadComboBox).  
    That is why when the parent control enters “Edit” mode – there are no items at the RadComboBox and trying to preselect an item raises an error.

    THE SOLUTION
    We can overcome this issue by handling the RadGrid.OnItemDatabound event and creating an initial RadComboBoxItem to be displayed at the control input. 

    [C#]
    protected void OnItemDataBoundHandler(object sender, GridItemEventArgs e)
    {
        if (e.Item.IsInEditMode)
        {
            GridEditableItem item = (GridEditableItem)e.Item;
            if (!(e.Item is IGridInsertItem))
            {
                RadComboBox combo =
                      (RadComboBox)item.FindControl("RadComboBox1");
                RadComboBoxItem preselectedItem = new RadComboBoxItem();
                preselectedItem.Text = item["CategoryName"].Text;
                preselectedItem.Value = item["CategoryID"].Text;
                combo.Items.Insert(0, preselectedItem);
                combo.SelectedIndex = 0;
     
            }
        }
    }

    [VB.NET]
    Protected Sub OnItemDataBoundHandler(ByVal sender As Object, ByVal e As GridItemEventArgs)
     
            If e.Item.IsInEditMode Then
                Dim item As GridEditableItem =
                    DirectCast(e.Item, GridEditableItem)
     
                If Not (TypeOf e.Item Is IGridInsertItem) Then
     
                    Dim combo As RadComboBox =
                   DirectCast(item.FindControl("RadComboBox1"), RadComboBox)
     
                    Dim preselectedItem As New RadComboBoxItem()
                    preselectedItem.Text = item("CategoryName").Text
                    preselectedItem.Value = item("CategoryID").Text
                    combo.Items.Insert(0, preselectedItem)
                    combo.SelectedIndex = 0
                End If
     
            End If
        End Sub

    When we delete the text initially displayed at RadComboBox input - Load-On-Demand will fire and will populate the control dropdown with items.

    In order to perform Add, Edit and Delete operation handle RadGrid.OnInsertCommandRadGrid.OnUpdateCommand and RadGrid.OnDeleteCommand events and obtain the RadComboBox selected value:
    [C#]
    protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
      
        GridEditableItem editedItem = e.Item as GridEditableItem;
        RadComboBox comboBox = (RadComboBox)editedItem.FindControl("RadComboBox1");
      
        SqlDataSource1.UpdateParameters.Add(
            new Parameter("CategoryID", DbType.Int32, comboBox.SelectedValue));
      
        SqlDataSource1.UpdateParameters.Add(
            new Parameter("UnitPrice", DbType.Double,
                (e.Item.FindControl("UnitPriceTextBox") as TextBox).Text));
      
        SqlDataSource1.UpdateParameters.Add(
            new Parameter("ProductName", DbType.String,
                (e.Item.FindControl("ProductNameBox") as TextBox).Text));
      
        SqlDataSource1.UpdateParameters.Add(
            new Parameter("ProductID", DbType.Int32,
                (e.Item.FindControl("ProductIDBox") as TextBox).Text));
      
        SqlDataSource1.Update();
      
    }
    protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        RadComboBox comboBox = (RadComboBox)editedItem.FindControl("RadComboBox1");
      
        SqlDataSource1.InsertParameters.Add(
            new Parameter("CategoryID", DbType.Int32, comboBox.SelectedValue));
              
          ...
          ...
                ...

        SqlDataSource1.Insert();
    }
      
    protected void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e)
    {
        GridDataItem item = (GridDataItem)e.Item;
        string ProductID = item.OwnerTableView.DataKeyValues[item.ItemIndex]["ProductID"].ToString();
      
        SqlDataSource1.DeleteParameters.Add(
            new Parameter("ProductID", DbType.Int32, ProductID));
        SqlDataSource1.Delete();
      
    }

    [VB.NET]
    Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
      
        Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
        Dim comboBox As RadComboBox = DirectCast(editedItem.FindControl("RadComboBox1"), RadComboBox)
      
        SqlDataSource1.UpdateParameters.Add(New Parameter("CategoryID", DbType.Int32, comboBox.SelectedValue))
      
        SqlDataSource1.UpdateParameters.Add(New Parameter("UnitPrice", DbType.[Double], TryCast(e.Item.FindControl("UnitPriceTextBox"), TextBox).Text))
      
        SqlDataSource1.UpdateParameters.Add(New Parameter("ProductName", DbType.[String], TryCast(e.Item.FindControl("ProductNameBox"), TextBox).Text))
      
        SqlDataSource1.UpdateParameters.Add(New Parameter("ProductID", DbType.Int32, TryCast(e.Item.FindControl("ProductIDBox"), TextBox).Text))
      
        SqlDataSource1.Update()
      
    End Sub
    Protected Sub RadGrid1_InsertCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs)
        Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
        Dim comboBox As RadComboBox = DirectCast(editedItem.FindControl("RadComboBox1"), RadComboBox)
      
        SqlDataSource1.InsertParameters.Add(New Parameter("CategoryID", DbType.Int32, comboBox.SelectedValue))

          ...
          ...
                ...

        SqlDataSource1.Insert()
      
    End Sub
      
    Protected Sub RadGrid1_DeleteCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
        Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
        Dim ProductID As String = item.OwnerTableView.DataKeyValues(item.ItemIndex)("ProductID").ToString()
        SqlDataSource1.DeleteParameters.Add(New Parameter("ProductID", DbType.Int32, ProductID))
        SqlDataSource1.Delete()
      
    End Sub


    The same approach can be used to nest Load-On-Demand RadComboBox in EditItemTemplate of FormView or GridView – please find more details at the sample project attached. Passing the update parameters is implemented using ControlParameters (at the FormView example) and SessionParameter(GridView example).
  2. Phil Avella
    Phil Avella avatar
    2 posts
    Member since:
    Oct 2009

    Posted 16 Nov 2010 Link to this post

    how to acheive this in RadListView instead of grid?
  3. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 23 Nov 2010 Link to this post

    Hi Phil Avella,

    I prepared a sample for you in order to demonstrate how to preselect an item in RadComboBox with Load-On-Demand enabled and nested within the EditItemTemplate of RadListView.
    In fact the approach is basically the same as the one used in the Code Library project published above.
    You simply have to handle the OnItemDataBound event of the RadListView and set the RadComboBox preselected item within the event handler.
    Additionally please handle the OnItemInserting, OnItemUpdating and OnItemDeleting events in order to pass the parameters necessary for performing insert/update and delete operations.

    All the best,
    Kalina
    the Telerik team
    Browse the vast support resources we have to jumpstart 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.
  4. Marcus
    Marcus avatar
    20 posts
    Member since:
    Jan 2009

    Posted 01 Jul 2011 Link to this post

    Hi There I think this is a great article and am using it in my latest project. But I have a problem.

    I am using the 

    Protected Sub rcb_vehicleModel_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
     
            Dim comboBox As RadComboBox = DirectCast(sender, RadComboBox)
     
            Dim dv As DataView = DirectCast(sqlds_vehicleModel.Select(DataSourceSelectArguments.Empty), DataView)
     
            comboBox.DataSource = dv
            comboBox.DataBind()

    'NOW I NEED TO CLEAR THE BELOW COMBO

     Dim cmdItem As GridItem = RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)(0)
            Dim ddl As DropDownList = TryCast(cmdItem.FindControl("rcb_vehicleModel"), DropDownList)
            ddl.Items.Clear()

    *****DOES NOT WORK????
     
     End Sub


    event to load my combo and everything works fine. 
    
    But I need to clear some combos below as the selection, if altered in the to box, needs to be re-selected.
    
    Sounds simple but from the above Items Requested I cannot find the other combos in the edit template.
    
    Any suggestions...
    
    Marcus
  5. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 14 Jul 2011 Link to this post

    Hello Marcus,


    I am not sure that I understand the issue.
    Why do you cast the RadComboBox "rcb_vehicleModel" to ASP.NET DropDownList(these two controls are absolutely different)?

    Greetings,
    Kalina
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  6. License Developer
    License Developer avatar
    12 posts
    Member since:
    Jul 2012

    Posted 28 Sep 2011 Link to this post

    Could you please show a sample project using a LoadOnDemand RadComboBox in a EditItemTemplate of a DetailsView control?
    Thank you. 
  7. License Developer
    License Developer avatar
    12 posts
    Member since:
    Jul 2012

    Posted 29 Sep 2011 Link to this post

    Could you please show how to achieve this in a DetailsView instead of RadGrid?

    Thank you. 
  8. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 03 Oct 2011 Link to this post

    Hello License Developer,

    The approach that you need to follow has been already implemented in the "FormView" sample page of the CodeLibrary project attached above.

    At first you have to handle the DetailsView.DataBound event and create an initial RadComboBoxItem to be displayed at the control input:
    protected void DetailsView1_DataBound(object sender, EventArgs e)
    {
        if(((DetailsView)sender).CurrentMode== DetailsViewMode.Edit)
        {
            DataRowView rowView =
                (DataRowView)((System.Web.UI.WebControls.DetailsView)(sender)).DataItem;
     
            RadComboBox combo =
                (RadComboBox)((System.Web.UI.WebControls.DetailsView)(sender)).FindControl("RadComboBox1");
            RadComboBoxItem preselectedItem = new RadComboBoxItem();
            preselectedItem.Text = rowView["CategoryName"].ToString();
            preselectedItem.Value = rowView["CategoryID"].ToString();
            combo.Items.Insert(0, preselectedItem);
            combo.SelectedIndex = 0;
        }
    }

    Then you can pass the update parameters to the SQLDataSource  in this way:
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Northwind %>"
        SelectCommand="SELECT  P.ProductID,  P.ProductName, P.CategoryID, P.UnitPrice, C.CategoryName FROM Categories C INNER JOIN Products P  ON C.CategoryID = P.CategoryID ORDER BY  P.ProductID ASC "
        UpdateCommand="UPDATE [Products] SET [ProductName] = @ProductName, [CategoryID] = @CategoryID, [UnitPrice] = @UnitPrice WHERE [ProductID] = @ProductID">
        <UpdateParameters>
            <asp:ControlParameter ControlID="DetailsView1" Name="ProductID" PropertyName="DataKey.Values['ProductID']"
                Type="String" />
            <asp:ControlParameter ControlID="DetailsView1" Name="ProductName" PropertyName="DataKey.Values['ProductName']"
                Type="String" />
            <asp:ControlParameter ControlID="DetailsView1$RadComboBox1" Name="CategoryID" PropertyName="SelectedValue"
                Type="String" />
            <asp:ControlParameter ControlID="DetailsView1" Name="CategoryName" PropertyName="DataKey.Values['CategoryName']"
                Type="String" />
            <asp:ControlParameter ControlID="DetailsView1" Name="UnitPrice" PropertyName="DataKey.Values['UnitPrice']"
                Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>

    Please find the sample attached for further details.

    Greetings,
    Kalina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  9. Frederick
    Frederick avatar
    1 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2012 Link to this post

    Hello,

    I am having issues with the RadComboBox as well.  I implemented this sample using the webservice example:

    http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx 

    My issue is that the selected value after the first selection never changes.  It seems to cache the first selection.  Its in an update panel there is a script manager.  Any help would be appreciated?


    Below are the code snippets for setup:

    <asp:scriptmanagerproxy runat="server" id="proxy">
            <services>
                <asp:servicereference path="~/Services/FacilityService.asmx" />
            </services>
        </asp:scriptmanagerproxy>


        <asp:updatepanel runat="server" id="upd">
            <triggers>
                <asp:AsyncPostBackTrigger controlid="radClinics" />
            </triggers>
            <contenttemplate>
                <div id="toolbox_container">
                    <div id="toolbox">
                        <div class="page_title">
                            Please provide us information specific to your location:
                        </div>
                        <div id="contentwrapper">
                            <div id="contentcolumn">
                                <div class="innertube">
                                    <div id="form_table">
                                        <div class="form_segment_item">
                                            <div class="form_label_container">
                                                Facility:</div>
                                            <div class="form_label_container">
                                                <telerik:radcombobox id="radClinics" runat="server" emptymessage="type here" width="300px"
                                                    dropdownwidth="450px" height="200px" 
                                                    onselectedindexchanged="radClinics_SelectedIndexChanged" autopostback="true" OnItemsRequested="radClinics_OnItemsRequested"
                                                    enableloadondemand="true" showmoreresultsbox="true" enablevirtualscrolling="true" >
                                                    <webservicesettings method="GetFacilities" path="~/Services/FacilityService.asmx" />
                                                </telerik:radcombobox>
                                                <a class="tooltip">
                                                    <img src="../../Assets/Images/icon-help.png" /><em></em><b>Your Facility can be found in the list to the left. Select the list and begin typing and we'll find the right one for you.</b></a>
                                            </div>
                                        </div>



  10. Cat Cheshire
    Cat Cheshire avatar
    128 posts
    Member since:
    Jun 2010

    Posted 24 Jul 2012 Link to this post

    You should check your page for java script errors.
    Then make sure your Ajax settings are correct.
  11. Henry
    Henry avatar
    2 posts
    Member since:
    Jan 2013

    Posted 24 Jan 2013 Link to this post

    I am using 2 RadComboBoxes(ddlProductCategory and ddlProductCriterion) inside a RadGrid which is inside a RadPanelItem. The second combo box is filled manually when the user selects any option from the first combo box. The first one is bounded to a sqlDataSource; the second one is filled using a data reader. There is no problem inserting data and displaying it in the Rad Grid. However, I keep having errors when I try to Edit any existing record. I have read several forums and have tried to apply the logic but I still have the following error:

    “Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Selection out of range. Parameter name: value”

    I have tried already to use the ItemDataBound event to pre-populate the radComboBox:

    if (e.Item.IsInEditMode)

    {

    GridEditableItem item = (GridEditableItem)e.Item;

    if (!(e.Item is IGridInsertItem))

    {

    RadComboBox combo =(RadComboBox)item.FindControl("ddlProductCriterion");

    RadComboBoxItem preselectedItem = new RadComboBoxItem();

    preselectedItem.Text = item["Criterion"].Text;

    preselectedItem.Value = item["ProductCriterionId"].Text;

    combo.Items.Insert(0, preselectedItem);

    combo.SelectedIndex = 0;

    }

    }



    //These are my combo boxes

    <telerik:GridTemplateColumn HeaderText="Product Category" UniqueName="TemplateColumnProductCategoryId" SortExpression="ProductCategoryId">

    <ItemTemplate>

    <asp:Label runat="server" ID="ProductCategoryId" Text='<%#  Eval("Category")%>'></asp:Label>

    </ItemTemplate>

    <EditItemTemplate>

    <br />

    <telerik:RadComboBox ID="ddlProductCategory" runat="server" Skin="Web20" SelectedValue='<%# Bind("ProductCategoryId") %>' DataSourceID="dsProductCategoriesJanitorial" DataTextField="Category" DataValueField="Id" AutoPostBack="true" onselectedindexchanged="ddlProductCategory_SelectedIndexChanged1">

    </telerik:RadComboBox>

    </EditItemTemplate>

    </telerik:GridTemplateColumn>

     

    <telerik:GridTemplateColumn HeaderText="Product Criterion" UniqueName="TemplateColumnProductCriterionId" SortExpression="ProductCriterionId">

    <ItemTemplate>

    <asp:Label runat="server" ID="ProductCriterionId" Text='<%# Eval("Criterion")%>'> </asp:Label>&#160;

    </ItemTemplate>

    <EditItemTemplate>

    <telerik:RadComboBox ID="ddlProductCriterion" runat="server" Skin="Web20"

    SelectedValue='<%# Bind("ProductCriterionId") %>' ></telerik:RadComboBox>

    </EditItemTemplate>

    </telerik:GridTemplateColumn>

     

     

    //This is my sqlDatasource located outside any objects (at the bottom of the page)

    asp:SqlDataSource ID="dsJanitorialEq" runat="server" ConnectionString="<%$ ConnectionStrings:connLeed %>"

            DeleteCommand="DELETE FROM [JanitorialEquipment] WHERE [Id] = @Id" InsertCommand="INSERT INTO JanitorialEquipment(ProjectId, ProductName, PurchaseDate, CostPerItem, QuantityPurchased, ProductCategoryID, ProductCriterionId) VALUES (@ProjectId, @ProductName, @PurchaseDate, @CostPerItem, @QuantityPurchased, @ProductCategoryId, @ProductCriterionId)"

            SelectCommand="SELECT JanitorialEquipment.Id, JanitorialEquipment.ProjectId, JanitorialEquipment.ProductName, JanitorialEquipment.PurchaseDate, JanitorialEquipment.CostPerItem, JanitorialEquipment.QuantityPurchased, JanitorialEquipment.ProductCategoryID, JanitorialEquipment.ProductCriterionId, ProductCriterion.Criterion, ProductCategories.Category, ProductSections.Section FROM ProductSections RIGHT OUTER JOIN ProductCategories ON ProductSections.Id = ProductCategories.SectionId RIGHT OUTER JOIN JanitorialEquipment LEFT OUTER JOIN ProductCriterion ON JanitorialEquipment.ProductCriterionId = ProductCriterion.Id ON ProductCategories.Id = JanitorialEquipment.ProductCategoryID WHERE (JanitorialEquipment.ProjectId = @ProjectId)"

           

            UpdateCommand="UPDATE JanitorialEquipment SET ProductName = @ProductName, PurchaseDate = @PurchaseDate, CostPerItem = @CostPerItem, QuantityPurchased = @QuantityPurchased, ProductCategoryID = @ProductCategoryId, ProductCriterionId = @ProductCriterionId WHERE (Id = @Id)">

            <DeleteParameters>

                <asp:Parameter Name="Id" Type="Int32" />

            </DeleteParameters>

            <InsertParameters>

                <asp:QueryStringParameter Name="ProjectId" QueryStringField="projectid" />

                <asp:Parameter Name="ProductName" Type="String" />

                <asp:Parameter Name="PurchaseDate" Type="DateTime" />

                <asp:Parameter Name="CostPerItem" Type="Decimal" />

                <asp:Parameter Name="QuantityPurchased" Type="Int64" />

                <asp:Parameter Name="ProductCategoryId" Type="Int32" />

                <asp:Parameter Name="ProductCriterionId" Type="Int32" />

            </InsertParameters>

            <SelectParameters>

                <asp:QueryStringParameter Name="ProjectId" QueryStringField="projectid" />

            </SelectParameters>

            <UpdateParameters>

                <asp:Parameter Name="ProductName" Type="String" />

                <asp:Parameter Name="PurchaseDate" Type="DateTime" />

                <asp:Parameter Name="CostPerItem" Type="Decimal" />

                <asp:Parameter Name="QuantityPurchased" Type="Int64" />

                <asp:Parameter Name="ProductCategoryId" Type="Int32" />

                <asp:Parameter Name="ProductCriterionId" Type="Int32" />

                <asp:Parameter Name="Id" Type="Int32" />

            </UpdateParameters>

        </asp:SqlDataSource>

     

    I have tried debugging this and have placed a break point inside the “If” statement above. The error comes before even reaching the breakpoint.
    I have tried adding the code above in other events with no success. Do you recommend to use this code in other events? Any suggestions on how to solve this problem would be greatly appreciated. Thanks in advance!

  12. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 29 Jan 2013 Link to this post

    Hello Henry,

    Could you open a new support ticket for this issue? If possible, please attach an isolated sample demonstrating the faced problem? This will allow us to investigate it locally and provide you the proper solution.


    All the best,
    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  13. Manar
    Manar avatar
    12 posts
    Member since:
    Mar 2012

    Posted 15 Jul 2013 Link to this post

    Hello.

    I'm trying to add RadComboBox inside an EditItemTemplate of RadGrid, I'm using a WebService to load the data in the combobox  dynamically (EnableLoadOnDemand="True" )

    when I press any key in the keyboard the webservice is working correctly, then I select a specific data.
    then the data disappear!!!

    how to let the selected data stay in the combobox in the "grid DataBound" event ?? when I try to find the combobox control in the grid databound the selected data is "" ??


    any help please???


    Thanks,
    Manar
  14. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 18 Jul 2013 Link to this post

    Hi Manar,

    Please read this help article. It explains in details how to keep the selected data. Same approach is used in this online demo.

    Regards,
    Hristo Valyavicharski
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  15. Kim
    Kim avatar
    23 posts
    Member since:
    Dec 2012

    Posted 28 Jun Link to this post

    I have tried everything in here and I still get the error.  What a frustrating effort this is. 
  16. Kim
    Kim avatar
    23 posts
    Member since:
    Dec 2012

    Posted 28 Jun Link to this post

    I have tried everything in here and I still get the error.  What a frustrating effort this is. 

            If e.Item.IsInEditMode Then  ''''''' THIS IS ALWAYS FALSE SO THE CODE NEVER RUNS
                Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem)

                If Not (TypeOf e.Item Is IGridInsertItem) Then

                    Dim combo As RadComboBox = DirectCast(item.FindControl("RadComboBox1"), RadComboBox)

                    Dim preselectedItem As New RadComboBoxItem()
                    preselectedItem.Text = item("Status").Text
                    preselectedItem.Value = item("StatusID").Text
                    combo.Items.Insert(0, preselectedItem)
                    combo.SelectedIndex = 0
                End If

            End If
        End Sub

  17. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    283 posts

    Posted 30 Jun Link to this post

    Hello Kim,

    Attached you will find an updated version of the Code library discussed. The only thing I have done was to change the .NET version of the project to 4.5. I have tested this project with our latest official release (R2 2016 607.45) and it works as expected - "If e.Item.IsInEditMode" returns true, when entering edit mode for one of the grids entries.

    Regards,
    Veselin Tsvetanov
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top