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

UserControl in RadGrid

6 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 05 Oct 2012, 09:43 AM
hi i have usercontrol(cascading dropdown) in radgrid edit template
if i use
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">

 <AjaxSettings>

 <telerik:AjaxSetting AjaxControlID="RadGrid1">

 <UpdatedControls>

 <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />

 </UpdatedControls>

 </telerik:AjaxSetting>

 </AjaxSettings>

 </telerik:RadAjaxManagerProxy>
works fine, but does not work RadAjaxLoadingPanel1
if i use

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 <AjaxSettings>

 <telerik:AjaxSetting AjaxControlID="RadGrid1">

 <UpdatedControls>

 <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />

 </UpdatedControls>

 </telerik:AjaxSetting>

 </AjaxSettings>

 </telerik:RadAjaxManager>
does not work and gives me a javascript error.
is there a solution? thanks

 

 

 

 

 

6 Answers, 1 is accepted

Sort by
0
Michele
Top achievements
Rank 2
answered on 09 Oct 2012, 07:47 AM
no one has ever had this problem?
:(
0
Eyup
Telerik team
answered on 09 Oct 2012, 11:15 AM
Hi Michele,

Please check out the following demo which resembles your scenario and try to distinguish the crucial differences between the demo and your own projects:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx

In addition, you could also refer to the topic below:
http://www.telerik.com/help/aspnet-ajax/ajax-user-controls.html

I hope this will prove helpful.

Kind regards,
Eyup
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.
0
Michele
Top achievements
Rank 2
answered on 09 Oct 2012, 11:38 AM
Thanks for the reply, the difference between the demo and my plan is to use a user control within EditFormSettings only two combobox.
Below I write my example:
<EditFormSettings EditFormType="Template">
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
    <FormTemplate>
        <fieldset>
            <legend>xxxxxxxxxxxxxxxxxxxx</legend>
        <table style="padding: 5px; margin: 2px; width:900px;" border="0">
            <tr>
                <td style="width:150px;"><asp:Label ID="Label10" runat="server" Text="xxxxxxxxxxxxxxxx: " /></td>
                <td>
                    <telerik:RadTextBox ID="RadTextBox2" runat="server"
                        EmptyMessage="xxxxxxxxxxxxx..." Text='<%# Eval("Cod")%>' Enabled="false">
                    </telerik:RadTextBox>
                </td>
                <td style="width:150px; text-align: right;"><asp:Label ID="Label11" runat="server" Text="xxxxxxxxx: " /></td>
                <td><telerik:RadTextBox ID="RadTextBox3" runat="server"  ShowButton="True" Width="90%"
                        EnableSingleInputRendering="true" EmptyMessage="type here..." Text='<%# Bind("ModelName")%>'>
                    </telerik:RadTextBox>
                </td>
            </tr>
 
                    <uc2:ComboCatArt runat="server" ID="ComboCatArt" />
 
            <tr>
                <td colspan="4"><asp:Label ID="Label3" runat="server" Text="xxxxxxxxxxxxx " /></td>
            </tr>

the <uc2:ComboCatArt... not work in RadAjaxManager, work only 

RadAjaxManagerProxy

0
Eyup
Telerik team
answered on 11 Oct 2012, 01:57 PM
Hello Michele,

I have created a sample RadGrid web site using the provided code snippet. On my side everything works as expected and the grid is being successfully ajaxified. Please check out the attached application and let me know if I am missing something out to reproduce the issue.

Kind regards,
Eyup
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.
0
Michele
Top achievements
Rank 2
answered on 11 Oct 2012, 03:55 PM
your example works fine, but the problem is in the usercontrol.
I've modified your example putting my usercontrol, so you can see the problem.
Thank you for your interest.
I wanted to add that the project error but the forum will not let me attach a file. rar
I am attaching the code of my usercontrol I would ask you to replace the one you put in the example



<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComboCatArt.ascx.cs" Inherits="ComboCatArt" %>
 
        <tr>
            <td style="width:150px;"><asp:Label ID="Label1" runat="server" AssociatedControlID="RadComboBox1" Text="xxxxxxxxxxxxxxx:"></asp:Label></td>
            <td style="width:300px;">
                <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="90%" CssClass="ComboBox_Continents"
                    OnClientSelectedIndexChanging="LoadCountries" OnItemsRequested="RadComboBox1_ItemsRequested" EmptyMessage="... xxxxxxxxxxxxx ...">
                </telerik:RadComboBox>
            </td>
            <td style="width:150px; text-align: right;">
                <asp:Label ID="Label2" runat="server" AssociatedControlID="RadComboBox2" Text="xxxxxxxxxxxxxxxxxx:"></asp:Label>
            </td>
            <td style="width:300px;">
                <telerik:RadComboBox ID="RadComboBox2" runat="server" Width="90%" CssClass="ComboBox_Countries"
                OnItemsRequested="RadComboBox2_ItemsRequested" OnClientItemsRequested="ItemsLoaded" EmptyMessage="... xxxxxxxxxxxxxxxx ...">
                </telerik:RadComboBox>
            </td>
        </tr>
 
 
<script type="text/javascript">
    //global variables for the countries and cities comboboxes
    var countriesCombo;
    var citiesCombo;
 
    function pageLoad() {
        // initialize the global variables
        // in this event all client objects
        // are already created and initialized
        countriesCombo = $find("<%= RadComboBox2.ClientID %>");
 
    }
 
    function LoadCountries(combo, eventArqs) {
        var item = eventArqs.get_item();
        countriesCombo.set_text("Loading...");
        //citiesCombo.clearSelection();
 
        // if a continent is selected
        if (item.get_index() > 0) {
            // this will fire the ItemsRequested event of the
            // countries combobox passing the continentID as a parameter
            countriesCombo.requestItems(item.get_value(), false);
        }
        else {
            // the -Select a continent- item was chosen
            countriesCombo.set_text(" ");
            countriesCombo.clearItems();
 
            //citiesCombo.set_text(" ");
            //citiesCombo.clearItems();
        }
    }
 
    function LoadCities(combo, eventArqs) {
        var item = eventArqs.get_item();
 
        citiesCombo.set_text("Loading...");
        // this will fire the ItemsRequested event of the
        // cities combobox passing the countryID as a parameter
        citiesCombo.requestItems(item.get_value(), false);
    }
 
    function ItemsLoaded(combo, eventArqs) {
        if (combo.get_items().get_count() > 0) {
            // pre-select the first item
            combo.set_text(combo.get_items().getItem(0).get_text());
            combo.get_items().getItem(0).highlight();
        }
        combo.showDropDown();
    }
 
</script>
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Telerik.Web.UI;
public partial class ComboCatArt : System.Web.UI.UserControl
{
    public string CityID
    {
        get { return RadComboBox2.SelectedValue; }
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
 
    }
 
 
 
 
    protected void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        //LoadContinents();
    }
 
    protected void RadComboBox2_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        // e.Text is the first parameter of the requestItems method
        // invoked in LoadCountries method
        //LoadCountries(e.Text);
    }
 
  
 
}
public class ContinentArt
{
    public string ID
    {
        get { return m_ID; }
        set { m_ID = value; }
    }
    private string m_ID;
    public string Name
    {
        get { return m_Name; }
        set { m_Name = value; }
    }
    private string m_Name;
}
 
public class CountryArt
{
    public string ID
    {
        get { return m_ID; }
        set { m_ID = value; }
    }
    private string m_ID;
    public string Name
    {
        get { return m_Name; }
        set { m_Name = value; }
    }
    private string m_Name;
    public string CountinentID
    {
        get { return m_CountinentID; }
        set { m_CountinentID = value; }
    }
    private string m_CountinentID;
}
 
public class CityArt
{
    public string ID
    {
        get { return m_ID; }
        set { m_ID = value; }
    }
    private string m_ID;
    public string Name
    {
        get { return m_Name; }
        set { m_Name = value; }
    }
    private string m_Name;
    public string CounryID
    {
        get { return m_CounryID; }
        set { m_CounryID = value; }
    }
    private string m_AppGruppo;
    public string AppGruppo
    {
        get { return m_AppGruppo; }
        set { m_AppGruppo = value; }
    }
    private string m_CounryID;
}

0
Eyup
Telerik team
answered on 15 Oct 2012, 02:01 PM
Hello Michele,

Please note that when you are using RadAjax, you will need to wrap any JavaScript code in RadScriptBlock as suggested in the following article?
http://www.telerik.com/help/aspnet-ajax/ajax-radscriptblock-radcodeblock.html

I have tried the suggested solution and it works as expected on my side.

Greetings,
Eyup
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
Michele
Top achievements
Rank 2
Answers by
Michele
Top achievements
Rank 2
Eyup
Telerik team
Share this question
or