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

Finding RadComboBox in Hierarchical Grid Edit Template

3 Answers 146 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 20 Oct 2011, 02:12 PM
Hi,

I have a hierarchical grid. The 2nd level grid contains a column with an editItemTemplate, that editItemTemplate contains a RadComboBox. The DataSource of the RadComboBox returns over 30,000 rows, I am therefore using an additional parameter to pass in the first letter of the name which is entered into the RadComboBox.

I'm tring to do this on the OnSelecting event for the SqlDataSource:
protected void names_selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
RadComboBox rcb = (RadComboBox)editItem.FindControl("rcb_name");
                        e.Command.Parameters["@starts_with"].Value = rcb.Text;
}

Can you tell me how I can find the RadComboBox within the edit template of the 2nd level grid and also if this is the right place to alter the parameter value?


Thanks in Advance,
Ryan

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Oct 2011, 07:56 AM
Hello Ryan,

You can access the ComboBox in ItemDataBound event as shown below.

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
   if (e.Item is GridEditableItem && e.Item.IsInEditMode && e.Item.OwnerTableView.Name == "DetailTable")
    {
       GridEditableItem edititem = (GridEditableItem)e.Item;
       RadComboBox combo = (RadComboBox)edititem.FindControl("RadComboBox1");
    }
}

Thanks,
Shinu.
0
Mark
Top achievements
Rank 1
answered on 24 Oct 2011, 09:56 AM
Hi Shinu,

Thank you for your reply!

The following code allows me to find the ComboBox on itemDataBound:

if (e.Item is GridEditableItem && e.Item.IsInEditMode && e.Item.OwnerTableView.Name == "Detail")
        {
            GridEditableItem edititem = (GridEditableItem)e.Item;
            RadComboBox combo = (RadComboBox)edititem.FindControl("rcb_name");
            sds_names.SelectParameters["starts_with"].DefaultValue = combo.SelectedValue;
        }

However I need to update the select parameters of the stored procedure as the user enters text into the ComboBox.

I'm trying to achieve this functionality but within a 2nd level grid:
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/autocompleteclientside/defaultcs.aspx


Thanks,
Ryan
0
Veli
Telerik team
answered on 26 Oct 2011, 08:08 AM
Hello Matt,

It seems like you need Load-on-Demand for RadComboBox. Please refer to this demo to see how RadComboBox can be setup to fetch data based on entered text. Let me know how this works for you.

Veli
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
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mark
Top achievements
Rank 1
Veli
Telerik team
Share this question
or