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

¿Bug in EditForm WebUserControl?

8 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Sánchez
Top achievements
Rank 1
David Sánchez asked on 18 Sep 2008, 10:27 AM
hi,
I have a grid within a WebUserControl, to edit the rows i use a editform the type WebUserControl, I noticed that if within editform use RadTextBox or RadCombobox do not work, RadCombox not deployed and the RadTextBox returns the value of Textbox, I've changed These controls for their homonyms of ASP.NET and everything works.
It may be a limitation or am I doing anything wrong?

8 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 18 Sep 2008, 01:34 PM
Hi David,

Both RadComboBox and RadTextBox should successfully appear in a web user control used for editing items in RadGrid. If you share with us some sample code we can examine, we might be able to advise you better on the problem you are having.

Kind regards,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Sandro
Top achievements
Rank 1
answered on 18 Sep 2008, 01:51 PM
Hello there!

I have the same problem as David Sánchez has.

Basicly I'm rendering a control inside a placeholder on the page. That control renders a Gird and the grid has a webusercontrol for the edit form. The place holder is inside a RadAjaxPanel. I figured that if a remove the RadTextBox the javascript error dissapear...

Am I doing anything wrong?

Tks in advance.

Sandro Martins
0
Veli
Telerik team
answered on 24 Sep 2008, 09:46 PM
Hi,

Please find attached a sample page with two web user controls (one for RadGrid and another for RadGrid's edit form). The page is ajaxified using RadAjaxPanel. Both the textboxes and RadComboBox renders as expected.

Please see how this sample relates to your cases and let me know if it helps.


Sincerely yours,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
David Sánchez
Top achievements
Rank 1
answered on 25 Sep 2008, 03:51 PM
I send you your own example, the diferent is that i load your usercontrol dynamicly, to do it, i use a "loadercontrol" that you sent me in other post, It doesn't work

loadercontrol.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="loaderControls.aspx.cs" Inherits="loaderControls" %> 
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
    </telerik:RadScriptManager> 
    <div> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="Button1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="Panel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <table> 
                <tr> 
                    <td> 
                        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> 
                    </td> 
                    <td> 
                        <asp:Panel ID="Panel1" runat="server">  
                        </asp:Panel> 
                    </td> 
                </tr> 
              
        </table> 
      
    </div> 
    </form> 
</body> 
</html> 
loadercontrol.aspx.cs:
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
 
public partial class loaderControls : System.Web.UI.Page  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (LatestLoadedControlName != null)  
        {  
            LoadUserControl(LatestLoadedControlName);  
        }  
          
          
          
 
    }  
    protected void Button1_Click(object sender, EventArgs e)  
    {  
        this.LoadUserControl("GridControl.ascx");  
    }  
 
    private string LatestLoadedControlName  
    {  
        get 
        {  
            return (string)ViewState["LatestLoadedControlName"];  
        }  
        set 
        {  
            ViewState["LatestLoadedControlName"] = value;  
        }  
    }  
 
    public void LoadUserControl(string controlName)  
    {  
        if (LatestLoadedControlName != null)  
        {  
            Control previousControl = Panel1.FindControl(LatestLoadedControlName);  
            if (previousControl != null)  
            {  
                this.Panel1.Controls.Remove(previousControl);  
            }  
        }  
        string userControlID = controlName;  
        Control targetControl = Panel1.FindControl(userControlID);  
        if (targetControl == null)  
        {  
            UserControl userControl = (UserControl)this.LoadControl("~/ascx/" + controlName + ".ascx");  
            //slashes and tildes are forbidden  
            userControl.ID = userControlID.Replace("/""").Replace("~""");  
            //this.phMain.Controls.Clear();  
            this.Panel1.Controls.Add(userControl);  
            LatestLoadedControlName = controlName;  
        }  
    }  
}  
 

GridControl.ascx:
<%@ Control Language="C#" AutoEventWireup="true" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="AccessDataSource1" AutoGenerateColumns="True" 
    AutoGenerateEditColumn="true" Skin="Office2007" Width="800px" AllowPaging="True" PageSize="20">  
    <MasterTableView CommandItemDisplay="Top" EditMode="EditForms">  
        <EditFormSettings EditFormType="WebUserControl" UserControlName="GridEditControl.ascx">  
        </EditFormSettings> 
    </MasterTableView> 
</telerik:RadGrid> 
 
<asp:AccessDataSource ID="AccessDataSource1" runat="Server" DataFile="~/App_Data/Nwind.mdb"   
    SelectCommand="SELECT [ProductID], [ProductName], [CategoryName], [UnitPrice], [UnitsInStock] FROM [Alphabetical List of Products]">  
</asp:AccessDataSource> 
 

GridEditControl.ascx.cs:
<%@ Control Language="C#" AutoEventWireup="true" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<table> 
    <tr> 
        <td> 
            ProductID:  
        </td> 
        <td> 
            <telerik:RadTextBox ID="RadTextBox1" runat="Server" Text='<%# Bind("ProductID") %>' 
                Skin="Office2007">  
            </telerik:RadTextBox> 
        </td> 
    </tr> 
    <tr> 
        <td> 
            ProductName:  
        </td> 
        <td> 
            <telerik:RadTextBox ID="ProductNameTextBox" runat="Server" Text='<%# Bind("ProductName") %>' 
                Skin="Office2007">  
            </telerik:RadTextBox> 
        </td> 
    </tr> 
    <tr> 
        <td> 
            CategoryName:  
        </td> 
        <td> 
            <telerik:RadComboBox ID="CategoryNameCombo" runat="server" Skin="Office2007" DataSourceID="AccessDataSource2" 
                DataTextField="CategoryName" DataValueField="CategoryID" Text='<%# Bind("CategoryName") %>'>  
            </telerik:RadComboBox> 
        </td> 
    </tr> 
    <tr> 
        <td> 
            UnitPrice:  
        </td> 
        <td> 
            <telerik:RadTextBox ID="RadTextBox2" runat="Server" Text='<%# Bind("UnitPrice") %>' 
                Skin="Office2007">  
            </telerik:RadTextBox> 
        </td> 
    </tr> 
    <tr> 
        <td> 
            UnitsInStock:  
        </td> 
        <td> 
            <telerik:RadTextBox ID="RadTextBox3" runat="Server" Text='<%# Bind("UnitsInStock") %>' 
                Skin="Office2007">  
            </telerik:RadTextBox> 
        </td> 
    </tr> 
</table> 
 
<asp:LinkButton ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>  
</asp:LinkButton>&nbsp;  
 
<asp:LinkButton ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" 
    CommandName="Cancel">  
</asp:LinkButton> 
 
<asp:AccessDataSource ID="AccessDataSource2" runat="Server" DataFile="~/App_Data/Nwind.mdb" 
    SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories]">  
</asp:AccessDataSource> 
 

TA.
0
David Sánchez
Top achievements
Rank 1
answered on 25 Sep 2008, 04:14 PM
Sorry Veri, After having read my first post, i notice that my english is very very bad (i'm from Spain) so, sorry.
I will explain better the problem.The issue is that the radcontrol (i have tried several of them) that  i use in a custom EditForm  of a Radgrid that was dynamic loaded inside webusercontrol seems like don't reponse to any event.
I hope that with this explanation and the code previous posted you can find the problem.
Thank you very much.
0
Vlad
Telerik team
answered on 26 Sep 2008, 06:06 AM
Hello David,

Can you please replace temporary RadScriptManager with standard ScriptManager and let me know about the result.

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
David Sánchez
Top achievements
Rank 1
answered on 26 Sep 2008, 08:26 AM
Works fine!, what's the problem?
0
Accepted
Sebastian
Telerik team
answered on 26 Sep 2008, 08:28 AM
Hi David,

The issue is discussed in the following public forum thread. The fix for it will be included in the Q2 2008 SP2 version of RadControls for ASP.NET AJAX, expected at the end of this month. If this is something urgent for you, request the latest internal dev build via our support system.

Kind regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
David Sánchez
Top achievements
Rank 1
Answers by
Veli
Telerik team
Sandro
Top achievements
Rank 1
David Sánchez
Top achievements
Rank 1
Vlad
Telerik team
Sebastian
Telerik team
Share this question
or