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

ExternalCallBackPage

14 Answers 435 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mike Dennis
Top achievements
Rank 1
Mike Dennis asked on 08 Jan 2008, 05:48 PM
Is there a way to get the functionality of the RadComboBox ExternalCallBackPage method with the Prometheus controls?

14 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 09 Jan 2008, 09:10 AM
Hello Mike Dennis,

The ExternalCallBackPage is not present in the RadComboBox Prometheus edition. You can populate the combobox via a WebService instead.

Sincerely yours,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mike Dennis
Top achievements
Rank 1
answered on 11 Jan 2008, 03:38 PM
I ended up using the ItemRequested event, but there is one issue I am having now that I did not have with the RadComboBox before.  I have drop down lists that I am using to filter a RadGrid that has some RadComboBoxes.  In the Init event for the ComboBoxes, I may add the item from a drop down, but I don't want to have everything loaded until the ItemRequested event.  The problem is that if I added the filter item, that event never fires.  When using the ExternalCallBackPage property, it had added the other items, and kept that previous item selected.  Is this an issue with the control or do I just need to use a WebService to get it to work the way I need it to?  If there isn't an item added in the init event, it loads the items fine right now.
0
Martin
Top achievements
Rank 2
answered on 14 Jan 2008, 02:26 PM
I am having a similar problem. I am trying to put a prometheus RadComboBox into a custom web control, and ran into problems with the OnItemsRequested event. The error message that came up told I needed to use the ExternalCallBackPage method. After investigating how to do that, and having no joy, I found my way to this forum post to find that ExternalCallBackPage doesn't work on the prometheus version.

I looked at the 'populate from web service' example, but that only shows you how to specify the service in an aspx page. How would I specify the web service dynamically in a web control?

Thanks,
Martin
0
Martin
Top achievements
Rank 2
answered on 15 Jan 2008, 08:59 AM
Further to my last post I have got a bit further with this, but still can't get it working properly.

Firstly, I realised that my web control was referencing the old version of the rad controls dll (hence the error message about External CallBack Page), so I fixed to to be referencing the prometheus version.

I was then able to declare the combobox in my web control like this:
            Controls.Add(_RadGroupBox); 
            _RadGroupBox.ID = "RadGroupBox"
            _RadGroupBox.Width = 150; 
            _RadGroupBox.Height = 150; 
            _RadGroupBox.ShowMoreResultsBox = false
            _RadGroupBox.MarkFirstMatch = true
            _RadGroupBox.EnableLoadOnDemand = true
            _RadGroupBox.OnClientItemsRequested = "CheckSelectedItem"
            _RadGroupBox.OnClientItemsRequesting = "OnClientItemsRequesting"
            _RadGroupBox.AllowCustomText = true
            _RadGroupBox.WebServiceSettings.Method = "GetPlaces"
            _RadGroupBox.WebServiceSettings.Path = "GroupDataList.asmx"

And following an example I found I created a web service to provide the data for the EnableLoadOnDemand (which is basically a list of place names and IDs). It is in this format.
[ScriptService] 
    public class GroupDataList: WebService 
    { 
        [WebMethod] 
        public RadComboBoxItemData[] GetPlaces(RadComboBoxItemData item, object context) 
        { 
            // Code here to return the data.   
        } 

However, although the combobox renders on the page, as soon as you click on it I get an error message popping up saying:

"Invalid web service call, missing value for parameter: 'item'."

Despite looking through some other examples on this site, and cannot work out what I am doing wrong. Any help would be greatly appreciated.

Thanks,
Martin




0
Nikolay
Telerik team
answered on 15 Jan 2008, 09:28 AM
Hi Martin,

Attached, please find a small and running project on the matter. Please download the files and give them a go.

I hope this will get you started.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Martin
Top achievements
Rank 2
answered on 15 Jan 2008, 09:56 AM
Thanks Nick.

Your example project helped me identify the problem. The web sevice method did not need the RadComboBoxItemData item parameter.

Cheers,
Martin
0
Nikolay
Telerik team
answered on 15 Jan 2008, 10:54 AM
Hi Martin,

I am glad I could help.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
The Oracle
Top achievements
Rank 1
answered on 23 Jun 2008, 10:26 PM
How can I use a WebService to populate a r.a.d.ComboBox (AJAX) located in a GridTemplateColumn, using parameters?  I think I need to supply parameters to the web method, but may be able to use the object Context, but not sure how.

...the ASPX...
<!-- ASPX --> 
<radx:GridTemplateColumn UniqueName="DefaultVendorIDCol" HeaderText="Vendor" DataField="DefaultVendorID" 
    SortExpression="DefaultVendorID">  
    <ItemTemplate> 
        <asp:Label ID="VendorLabel" runat="server"></asp:Label></ItemTemplate>  
    <EditItemTemplate> 
        <radx:RadComboBox ID="PartVendorCombo" runat="server"   
            DataTextField="PartVendorName" DataValueField="PartVendorID" Skin="Office2007" 
            Height="240px" AllowCustomText="false" EnableLoadOnDemand="true" 
            ShowMoreResultsBox="false" NoWrap="false" EnableScreenBoundaryDetection="true" 
            MarkFirstMatch="true"   
            HighlightTemplatedItems="true">   
            <HeaderTemplate> 
                <table style="width: 200px">  
                    <tr> 
                        <td style="width: 120px; font-family: Tahoma; font-weight: bold; font-size: 9pt;">  
                            Vendor Name  
                        </td> 
                        <td style="width: 40px; font-family: Tahoma; font-weight: bold; font-size: 9pt;">  
                            UI  
                        </td> 
                        <td style="width: 40px; font-family: Tahoma; font-weight: bold; font-size: 9pt;">  
                            Cost  
                        </td> 
                    </tr> 
                </table> 
            </HeaderTemplate> 
            <ItemTemplate> 
                <table style="width: 200px">  
                    <tr> 
                        <td style="width: 120px; font-family: Tahoma; font-weight: normal; font-size: 9pt;">  
                            <%# DataBinder.Eval(Container.DataItem, "PartVendorName") %> 
                        </td> 
                        <td style="width: 40px; font-family: Tahoma; font-weight: normal; font-size: 9pt;">  
                            <%# DataBinder.Eval(Container.DataItem, "UnitIssue") %> 
                        </td> 
                        <td style="width: 40px; font-family: Tahoma; font-weight: normal; font-size: 9pt;">  
                            <%# DataBinder.Eval(Container.DataItem, "DisplayCost") %> 
                        </td> 
                    </tr> 
                </table> 
            </ItemTemplate> 
        </radx:RadComboBox> 
    </EditItemTemplate> 
</radx:GridTemplateColumn> 

...Grid_ItemDataBound...
protected void PartsToOrderViewRadGrid_ItemDataBound(object sender, GridItemEventArgs e)  
{  
    //Preset the vendor RadComboBox  
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
    {  
        GridEditableItem editItem = e.Item as GridEditableItem;  
        PartsToOrderView view = (PartsToOrderView)editItem.DataItem;    //should only work on the way out  
        RadComboBox combo = editItem.FindControl("PartVendorCombo"as RadComboBox;  
        if (combo != null && view != null)  
        {  
            PartVendor vendor = (this.PartVendors.ItemById(view.DefaultVendorID) as PartVendor);  
            combo.Text = vendor.Name;  
            combo.SelectedValue = vendor.ID.ToString();  
            //combo.ExternalCallBackPage = string.Format("~/helpers/RadComboHelper.aspx?p={0}&v={1}", view.PartID, view.DefaultVendorID);   //no 'cycle'  
            combo.WebServiceSettings.Method = "GetComboData_VendorPartExtendedInfoViews";  
            combo.WebServiceSettings.Path = "~/Services/ComboData_PartVendors.asmx";  
        }  
    }  
}  
 

...and the WebMethod...

[WebMethod]  
public RadComboBoxItemData[] GetComboData_VendorPartExtendedInfoViews(string partID, string currentText)  
{  
    long.TryParse(partID, out this.PartID);  
    this.IsFirstTime = (string.IsNullOrEmpty(currentText) || (currentText != "More..."));  
 
    List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(this.VendorPartExtendedInfoViews.Count);  
    foreach (VendorPartExtendedInfoView view in this.VendorPartExtendedInfoViews)  
    {  
        RadComboBoxItemData itemData = new RadComboBoxItemData();  
        itemData.Text = view.PartVendorName;  
        itemData.Value = view.PartVendorID.ToString();  
        //Add Attributes for Display/binding reference  
        itemData.Attributes.Add("PartVendorID", view.PartVendorID);  
        itemData.Attributes.Add("PartVendorName", view.PartVendorName);  
        itemData.Attributes.Add("UnitIssue", view.UnitIssue);  
        itemData.Attributes.Add("DisplayCost", view.DisplayCost);  
 
        result.Add(itemData);  
    }  
 
    return result.ToArray();  
}  
 

Thanks,
Graeme
0
The Oracle
Top achievements
Rank 1
answered on 25 Jun 2008, 02:41 PM
It seems this might be along the right path.  Please confirm or correct.  THANKS!

function comboItemsRequesting(sender, eventArgs)  
{  
    var context = eventArgs.get_context();  
    context["currentText"] = eventArgs.get_text();  
    context["partID"] = sender["partID"]  
}  
 

public RadComboBoxItemData[] GetComboData_VendorPartExtendedInfoViews(object context)  
{  
    IDictionary<stringobject> contextDictionary = (IDictionary<stringobject>)context;  
 
    string partID = (string)contextDictionary["partID"];  
    if (string.IsNullOrEmpty(partID)) { partID = "0"; }  
    string currentText = (string)contextDictionary["currentText"];  
    long.TryParse(partID, out this.PartID);  
    this.IsFirstTime = (string.IsNullOrEmpty(currentText) || (currentText != "More..."));  
 
... 

Graeme

0
The Oracle
Top achievements
Rank 1
answered on 25 Jun 2008, 02:41 PM
[duplicate post]
0
Veselin Vasilev
Telerik team
answered on 26 Jun 2008, 01:12 PM
Hi The Oracle,

It seems ok, except this line:

context["partID"] = sender["partID"]

sender is the combobox instance and I think that sender["partID"] will always return null.
Am I right?

What information are you trying to send to the web service?

All the best,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
The Oracle
Top achievements
Rank 1
answered on 26 Jun 2008, 02:07 PM
Hey Veskoni--

Thanks for your reply and for all your hard work.  We say in Texas, "All y'all work real hard for us.  Thanks!"

Actually, I should have shared, I assign "partId" as a custom attribute to the combo box:

protected void PartsToOrderViewRadGrid_ItemDataBound(object sender, GridItemEventArgs e)  
{  
    //Preset the vendor RadComboBox  
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
    {  
        GridEditableItem editItem = e.Item as GridEditableItem;  
        PartsToOrderView view = (PartsToOrderView)editItem.DataItem;    //should only work on the way out  
        RadComboBox combo = editItem.FindControl("PartVendorCombo"as RadComboBox;  
        if (combo != null && view != null)  
        {  
            PartVendor vendor = (this.PartVendors.ItemById(view.DefaultVendorID) as PartVendor);  
            combo.Text = vendor.Name;  
            combo.SelectedValue = vendor.ID.ToString();  
            //combo.ExternalCallBackPage = string.Format("~/helpers/RadComboHelper.aspx?p={0}&v={1}", view.PartID, view.DefaultVendorID);   //no 'cycle'  
            combo.WebServiceSettings.Method = "GetComboData_VendorPartExtendedInfoViews";  
            combo.WebServiceSettings.Path = "~/Services/ComboData_PartVendors.asmx";  
            combo.Attributes.Add("partID", view.PartID.ToString());  
        }  
    }  
}  
 

...but then I read somewhere that custom attributes on the r.a.d.ComboBox are volatile.

Does it look like I know what I'm doing?  If so, I sure don't feel like it!!! ;-)

Graeme
0
Veselin Vasilev
Telerik team
answered on 27 Jun 2008, 02:47 PM
Hi The Oracle,

Doesn't it work? It seems correct for me.
What error do you get?



Best wishes,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Cedric Debattista
Top achievements
Rank 1
answered on 26 May 2009, 02:27 PM
Hi I am trying to use the Webservice, replacing the old ExternalCallBackpage method. The problem is that in the old version I was able to access all of the RadComboBoxItemsRequestedEventArgs and i could set properties for say NumberOfItems. How can I do this with the WebService?
Sachita
Top achievements
Rank 1
Iron
Iron
Iron
commented on 21 Feb 2022, 06:43 AM

Hi Team,Can anyone share demo how to use WebServices for RadCombobox after migration to Telerirk.Web.UI.
Sachita
Top achievements
Rank 1
Iron
Iron
Iron
commented on 21 Mar 2022, 12:26 PM

Any Updates?

In previous code we are calling external call backpage to load a .aspx file ,

https://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx?_ga=2.177228773.1107324696.1647843191-379472461.1637567736

We have tried above demo but could not find any sample code for asmx file,Can you please provide any other demo?

Tags
ComboBox
Asked by
Mike Dennis
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Mike Dennis
Top achievements
Rank 1
Martin
Top achievements
Rank 2
The Oracle
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Cedric Debattista
Top achievements
Rank 1
Share this question
or