ExternalCallBackPage

15 posts, 0 answers
  1. Mike Dennis
    Mike Dennis avatar
    51 posts
    Member since:
    Mar 2006

    Posted 08 Jan 2008 Link to this post

    Is there a way to get the functionality of the RadComboBox ExternalCallBackPage method with the Prometheus controls?
  2. Nikolay
    Admin
    Nikolay avatar
    3997 posts

    Posted 09 Jan 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mike Dennis
    Mike Dennis avatar
    51 posts
    Member since:
    Mar 2006

    Posted 11 Jan 2008 Link to this post

    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.
  5. Martin
    Martin avatar
    22 posts
    Member since:
    Aug 2007

    Posted 14 Jan 2008 Link to this post

    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
  6. Martin
    Martin avatar
    22 posts
    Member since:
    Aug 2007

    Posted 15 Jan 2008 Link to this post

    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




  7. Nikolay
    Admin
    Nikolay avatar
    3997 posts

    Posted 15 Jan 2008 Link to this post

    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
  8. Martin
    Martin avatar
    22 posts
    Member since:
    Aug 2007

    Posted 15 Jan 2008 Link to this post

    Thanks Nick.

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

    Cheers,
    Martin
  9. Nikolay
    Admin
    Nikolay avatar
    3997 posts

    Posted 15 Jan 2008 Link to this post

    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
  10. The Oracle
    The Oracle avatar
    46 posts
    Member since:
    Aug 2012

    Posted 23 Jun 2008 Link to this post

    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...
    1 <!-- ASPX --> 
    2 <radx:GridTemplateColumn UniqueName="DefaultVendorIDCol" HeaderText="Vendor" DataField="DefaultVendorID" 
    3     SortExpression="DefaultVendorID">  
    4     <ItemTemplate> 
    5         <asp:Label ID="VendorLabel" runat="server"></asp:Label></ItemTemplate>  
    6     <EditItemTemplate> 
    7         <radx:RadComboBox ID="PartVendorCombo" runat="server"   
    8             DataTextField="PartVendorName" DataValueField="PartVendorID" Skin="Office2007" 
    9             Height="240px" AllowCustomText="false" EnableLoadOnDemand="true" 
    10             ShowMoreResultsBox="false" NoWrap="false" EnableScreenBoundaryDetection="true" 
    11             MarkFirstMatch="true"   
    12             HighlightTemplatedItems="true">   
    13             <HeaderTemplate> 
    14                 <table style="width: 200px">  
    15                     <tr> 
    16                         <td style="width: 120px; font-family: Tahoma; font-weight: bold; font-size: 9pt;">  
    17                             Vendor Name  
    18                         </td> 
    19                         <td style="width: 40px; font-family: Tahoma; font-weight: bold; font-size: 9pt;">  
    20                             UI  
    21                         </td> 
    22                         <td style="width: 40px; font-family: Tahoma; font-weight: bold; font-size: 9pt;">  
    23                             Cost  
    24                         </td> 
    25                     </tr> 
    26                 </table> 
    27             </HeaderTemplate> 
    28             <ItemTemplate> 
    29                 <table style="width: 200px">  
    30                     <tr> 
    31                         <td style="width: 120px; font-family: Tahoma; font-weight: normal; font-size: 9pt;">  
    32                             <%# DataBinder.Eval(Container.DataItem, "PartVendorName") %> 
    33                         </td> 
    34                         <td style="width: 40px; font-family: Tahoma; font-weight: normal; font-size: 9pt;">  
    35                             <%# DataBinder.Eval(Container.DataItem, "UnitIssue") %> 
    36                         </td> 
    37                         <td style="width: 40px; font-family: Tahoma; font-weight: normal; font-size: 9pt;">  
    38                             <%# DataBinder.Eval(Container.DataItem, "DisplayCost") %> 
    39                         </td> 
    40                     </tr> 
    41                 </table> 
    42             </ItemTemplate> 
    43         </radx:RadComboBox> 
    44     </EditItemTemplate> 
    45 </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...

    1 [WebMethod]  
    2 public RadComboBoxItemData[] GetComboData_VendorPartExtendedInfoViews(string partID, string currentText)  
    3 {  
    4     long.TryParse(partID, out this.PartID);  
    5     this.IsFirstTime = (string.IsNullOrEmpty(currentText) || (currentText != "More..."));  
    6  
    7     List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(this.VendorPartExtendedInfoViews.Count);  
    8     foreach (VendorPartExtendedInfoView view in this.VendorPartExtendedInfoViews)  
    9     {  
    10         RadComboBoxItemData itemData = new RadComboBoxItemData();  
    11         itemData.Text = view.PartVendorName;  
    12         itemData.Value = view.PartVendorID.ToString();  
    13         //Add Attributes for Display/binding reference  
    14         itemData.Attributes.Add("PartVendorID", view.PartVendorID);  
    15         itemData.Attributes.Add("PartVendorName", view.PartVendorName);  
    16         itemData.Attributes.Add("UnitIssue", view.UnitIssue);  
    17         itemData.Attributes.Add("DisplayCost", view.DisplayCost);  
    18  
    19         result.Add(itemData);  
    20     }  
    21  
    22     return result.ToArray();  
    23 }  
    24  

    Thanks,
    Graeme
  11. The Oracle
    The Oracle avatar
    46 posts
    Member since:
    Aug 2012

    Posted 25 Jun 2008 Link to this post

    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

  12. The Oracle
    The Oracle avatar
    46 posts
    Member since:
    Aug 2012

    Posted 25 Jun 2008 Link to this post

    [duplicate post]
  13. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 26 Jun 2008 Link to this post

    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
  14. The Oracle
    The Oracle avatar
    46 posts
    Member since:
    Aug 2012

    Posted 26 Jun 2008 Link to this post

    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:

    1 protected void PartsToOrderViewRadGrid_ItemDataBound(object sender, GridItemEventArgs e)  
    2 {  
    3     //Preset the vendor RadComboBox  
    4     if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
    5     {  
    6         GridEditableItem editItem = e.Item as GridEditableItem;  
    7         PartsToOrderView view = (PartsToOrderView)editItem.DataItem;    //should only work on the way out  
    8         RadComboBox combo = editItem.FindControl("PartVendorCombo"as RadComboBox;  
    9         if (combo != null && view != null)  
    10         {  
    11             PartVendor vendor = (this.PartVendors.ItemById(view.DefaultVendorID) as PartVendor);  
    12             combo.Text = vendor.Name;  
    13             combo.SelectedValue = vendor.ID.ToString();  
    14             //combo.ExternalCallBackPage = string.Format("~/helpers/RadComboHelper.aspx?p={0}&v={1}", view.PartID, view.DefaultVendorID);   //no 'cycle'  
    15             combo.WebServiceSettings.Method = "GetComboData_VendorPartExtendedInfoViews";  
    16             combo.WebServiceSettings.Path = "~/Services/ComboData_PartVendors.asmx";  
    17             combo.Attributes.Add("partID", view.PartID.ToString());  
    18         }  
    19     }  
    20 }  
    21  

    ...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
  15. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 27 Jun 2008 Link to this post

    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
  16. Cedric Debattista
    Cedric Debattista avatar
    17 posts
    Member since:
    Mar 2007

    Posted 26 May 2009 Link to this post

    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?
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017