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

User control inside form edit template

1 Answer 896 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Melvin
Top achievements
Rank 1
Melvin asked on 27 May 2016, 09:47 PM

Hi,

I have an issue when I use custom user control and I create a custom control of RadDatePicker. 
When I tried use inside of control RadGrid the code JavaScript that is set in user control is not loaded when I open the edit form of RadGrid.

When I review code HTML the Javascript code is not loaded (Attached image CodeHTML).

I donĀ“t understand what is the problem in my code?

 

Code User Control.

<style>
    .rcInputCell
    {
        padding: 0 !important;
        width: 0 !important;
    }
  
    .HiddenTextBox
    {
        width: 1px !important;
        border: 0 !important;
        margin: 0 !important;
        background: none transparent !important;
        display: none;
    }
</style>
<telerik:RadScriptBlock  runat="server" ID="rsbCtrlFechas">
    <script type="text/javascript">
        function isValidDate(str) {
            var parts = str.split('/');
            if (parts.length < 3)
                return false;
            else {
                var day = parseInt(parts[0]);
                var month = parseInt(parts[1]);
                var year = parseInt(parts[2]);
                if (isNaN(day) || isNaN(month) || isNaN(year)) {
                    return false;
                }
                if (day < 1 || year < 1)
                    return false;
                if (month > 12 || month < 1)
                    return false;
                if ((month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) && day > 31)
                    return false;
                if ((month == 4 || month == 6 || month == 9 || month == 11) && day > 30)
                    return false;
                if (month == 2) {
                    if (((year % 4) == 0 && (year % 100) != 0) || ((year % 400) == 0 && (year % 100) == 0)) {
                        if (day > 29)
                            return false;
                    } else {
                        if (day > 28)
                            return false;
                    }
                }
                return true;
            }
        }
  
        function getPosition(element) {
            var xPosition = 0;
            var yPosition = 0;
            while (element) {
                xPosition += (element.offsetLeft - element.scrollLeft + element.clientLeft);
                yPosition += (element.offsetTop - element.scrollTop + element.clientTop);
                element = element.offsetParent;
            }
            return { x: xPosition, y: yPosition };
        }
    </script>
</telerik:RadScriptBlock>

Code behind User Control

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using Telerik.Web.UI;
 
namespace EsaCloud_GPY.ControlesUsuario
{
    [ValidationProperty("FechaSeleccionada")]
    public partial class ctrlFecha : System.Web.UI.UserControl
    {
 
        /// <summary>
        /// Tipos de usos definidos para el control de usuario fecha
        /// </summary>
        public enum TipoDeUso
        {
            Normal,
            Periodo
        }
 
        #region Propiedades
 
        /// <summary>
        /// Permite asignar Ć³ obtener el valor del control RadMaskedTextBox.
        /// </summary>
        /// <value>
        /// Valor de la fecha seleccionada.
        /// </value>
        [Description("Permite asignar Ć³ obtener el valor del control RadMaskedTextBox"), Category("Personalizado")]
        public DateTime? FechaSeleccionada
        {
            get { return rdpFechaInicial.SelectedDate; }
            set { rdpFechaInicial.SelectedDate = Convert.ToDateTime(value); }
        }
 
        private string _nombreCtrlMascara = "rmtbFechaInicial";
        /// <summary>
        /// Asigna un nombre al campo ID del control RadMaskedTextBox.
        /// </summary>
        /// <value>
        /// Nombre del control RadMaskedTextBox.
        /// </value>
        [Description("Asigna un nombre al campo ID del control RadMaskedTextBox"), Category("Personalizado")]
        [DefaultValue("rmtbFechaInicial")]
        public string NombreCtrlMascara { get { return _nombreCtrlMascara; } set { _nombreCtrlMascara = value; } }
 
        private string _nombreCtrlPicker = "rdpFechaInicial";
        /// <summary>
        /// Asigna un nombre al campo ID del control RadDatePicker.
        /// </summary>
        /// <value>
        /// Nombre del control RadDatePicker.
        /// </value>
        [Description("Asigna un nombre al campo ID del control RadDatePicker"), Category("Personalizado")]
        [DefaultValue("rdpFechaInicial")]
        public string NombreCtrlPicker { get { return _nombreCtrlPicker; } set { _nombreCtrlPicker = value; } }
 
        private TipoDeUso _tipoDeUso = TipoDeUso.Normal;
        /// <summary>
        /// Permite definir el tipo de uso que tendra el control.
        /// </summary>
        /// <value>
        /// Tipo de uso.
        /// </value>
        [Description("Permite definir el tipo de uso que tendra el control"), Category("Personalizado")]
        [DefaultValue(TipoDeUso.Normal)]
        public TipoDeUso TipoUso { get { return _tipoDeUso; } set { _tipoDeUso = value; } }
 
        private string _mascaraUsar = "##/##/####";
        /// <summary>
        /// Permite definir la mascara a usar para el control RadMaskedTextBox.
        /// </summary>
        /// <value>
        /// Mascara usar.
        /// </value>
        [Description("Permite definir la mascara a usar para el control RadMaskedTextBox"), Category("Personalizado")]
        [DefaultValue("##/##/####")]
        public string MascaraUsar { get { return _mascaraUsar; } set { _mascaraUsar = value; } }
 
        private bool _usarValidacionJS = false;
        /// <summary>
        /// Permite definir si se usar la valiciĆ³n JavaScript.
        /// </summary>
        /// <value>
        ///   Si el valor es True. Se usar la validaciĆ³n JavaScript.
        /// </value>
        [Description("Permite definir si se usar la valiciĆ³n JavaScript"), Category("Personalizado")]
        [DefaultValue(false)]
        public bool UsarValidacionJS { get { return _usarValidacionJS; } set { _usarValidacionJS = value; } }
         
        /// <summary>
        /// Permite manipular las propiedades globales del control de tipo MaskedTextBox
        /// </summary>
        /// <value>
        /// The ctrol masked text box.
        /// </value>
        public RadMaskedTextBox CtrolMaskedTextBox { get { return rmtbFechaInicial; } set { rmtbFechaInicial = value; } }
         
        /// <summary>
        /// Permite manipular las propiedades globales del control de tipo DatePicker.
        /// </summary>
        /// <value>
        /// The ctrol date picker.
        /// </value>
        public RadDatePicker CtrolDatePicker { get { return rdpFechaInicial; } set { rdpFechaInicial = value; } }
        #endregion
 
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
            rmtbFechaInicial.ID = NombreCtrlMascara;
            rmtbFechaInicial.Mask = MascaraUsar;
            rmtbFechaInicial.ClientEvents.OnBlur = "UpdateCalendar_" + NombreCtrlPicker;
 
            rdpFechaInicial.DateInput.DateFormat = TipoUso == TipoDeUso.Normal ? "dd/MM/yyyy" : "MM/yyyy";
            rdpFechaInicial.ID = NombreCtrlPicker;
            rdpFechaInicial.DatePopupButton.Attributes["OnClick"] = "Popup_" + NombreCtrlPicker + "(); return false;";
            rdpFechaInicial.ClientEvents.OnDateSelected = "UpdateTextBox_" + NombreCtrlPicker;
            if (FechaSeleccionada != null)
                rmtbFechaInicial.TextWithLiterals = Convert.ToDateTime(FechaSeleccionada).ToString(rdpFechaInicial.DateInput.DateFormat);
 
            //rdpFechaInicial.SelectedDate = FechaSeleccionada;
            rdpFechaInicial.Calendar.FastNavigationSettings.TodayButtonCaption = "Hoy";
            rdpFechaInicial.Calendar.FastNavigationSettings.OkButtonCaption = "Aceptar";
            rdpFechaInicial.Calendar.FastNavigationSettings.CancelButtonCaption = "Cancelar";
            rdpFechaInicial.DatePopupButton.ToolTip = "Abrir calendario";
 
            StringBuilder sbJS = new StringBuilder();
            sbJS.AppendLine("");
            sbJS.AppendLine("function UpdateTextBox_" + rdpFechaInicial.ID + "(sender, args) { ");
            sbJS.AppendLine("   var maskedInput = $find('" + rmtbFechaInicial.ClientID + "');");
            //sbJS.AppendLine("   maskedInput.set_value(\"\");");
            sbJS.AppendLine("   var fecha = args.get_newDate();");
            sbJS.AppendLine("   var datePicker = $find('" + rdpFechaInicial.ClientID + "');");
            sbJS.AppendLine("   var date = datePicker.get_dateInput().parseDate(args.get_newDate());");
            sbJS.AppendLine("   var dateInput = datePicker.get_dateInput();");
            sbJS.AppendLine("   var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat());");
            sbJS.AppendLine("   if (formattedDate ==\"\") { return; }");
            sbJS.AppendLine("   maskedInput.set_value(formattedDate);");
            sbJS.AppendLine("}");
            sbJS.AppendLine("");
            sbJS.AppendLine("function UpdateCalendar_" + rdpFechaInicial.ID + "() {");
            sbJS.AppendLine("   var maskedInput = $find('" + rmtbFechaInicial.ClientID + "');");
            sbJS.AppendLine("   var datePicker = $find(\'" + rdpFechaInicial.ClientID + "');");
            sbJS.AppendLine("   //Determinando si viene vacio");
            sbJS.AppendLine("   if (maskedInput.get_value()==\"\") { datePicker.set_selectedDate(null); return; }");
            sbJS.AppendLine("   //Determinando si es una fecha vĆ”lida");
            if (TipoUso == TipoDeUso.Periodo)
            {
                sbJS.AppendLine("   var dateValid = isValidDate(\"01/\" + maskedInput.get_valueWithLiterals());");
            }
            else if (TipoUso == TipoDeUso.Normal)
            {
                sbJS.AppendLine("   var dateValid = isValidDate(maskedInput.get_valueWithLiterals());");
            }
            sbJS.AppendLine("   if (!dateValid) {");
            if (UsarValidacionJS)
            {
                sbJS.AppendLine("       var oAlert = radalert(\"Debe de ingresar una fecha vĆ”lida.\", 256, 47, \"Campo requerido\", null, \"../imagenes/error1.jpg\");");
                sbJS.AppendLine("       oAlert.show();");
            }
            //sbJS.AppendLine("       maskedInput.set_value(\"\");");
            sbJS.AppendLine("       datePicker.set_selectedDate(null);");
            sbJS.AppendLine("       return;");
            sbJS.AppendLine("   }");
            if (TipoUso == TipoDeUso.Periodo)
            {
                sbJS.AppendLine("   var fecha = \"01\" + maskedInput.get_value()");
                sbJS.AppendLine("   var date = datePicker.get_dateInput().parseDate(fecha);");
            }
            else if (TipoUso == TipoDeUso.Normal)
            {
                sbJS.AppendLine("   var date = datePicker.get_dateInput().parseDate(maskedInput.get_value());");
            }
            sbJS.AppendLine("   var dateInput = datePicker.get_dateInput();");
            sbJS.AppendLine("   if (date == null) {");
            sbJS.AppendLine("       date = datePicker.get_selectedDate();");
            sbJS.AppendLine("   }");
            sbJS.AppendLine("   var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat()); ");
            sbJS.AppendLine("   datePicker.set_selectedDate(date);");
            sbJS.AppendLine("   if (!isNaN(date) && date > datePicker.get_minDate() && date < datePicker.get_maxDate()) {");
            sbJS.AppendLine("       datePicker.set_selectedDate(date);");
            sbJS.AppendLine("   }");
            sbJS.AppendLine("   else {");
            sbJS.AppendLine("       var oldSelectedDate = datePicker.get_selectedDate();");
            sbJS.AppendLine("       if (oldSelectedDate == null) return;");
            sbJS.AppendLine("       if (oldSelectedDate.toString() == datePicker.get_minDate().toString()) {");
            sbJS.AppendLine("           maskedInput.set_value(\"\");");
            sbJS.AppendLine("       }");
            sbJS.AppendLine("       else {");
            sbJS.AppendLine("           maskedInput.set_value(DateToString(oldSelectedDate));");
            sbJS.AppendLine("          }");
            sbJS.AppendLine("   }");
            sbJS.AppendLine("}");
            sbJS.AppendLine("");
            sbJS.AppendLine("function Popup_" + rdpFechaInicial.ID + "() {");
            sbJS.AppendLine("   var datePicker = $find('" + rdpFechaInicial.ClientID + "');");
            sbJS.AppendLine("   var maskedInput = $find('" + rmtbFechaInicial.ClientID + "');");
            sbJS.AppendLine("   var textBox = datePicker.get_textBox();");
            //sbJS.AppendLine("   var position = getPosition(maskedInput._textBoxElement);");
            sbJS.AppendLine("   var popupElement = datePicker.get_popupContainer();");
            sbJS.AppendLine("   var position = Telerik.Web.CommonScripts.getLocation(maskedInput._textBoxElement);");
            sbJS.AppendLine("   var dimensions = Telerik.Web.UI.Calendar.Utils.GetElementDimensions(popupElement); ");
            sbJS.AppendLine("   datePicker.showPopup(position.x, position.y + maskedInput._textBoxElement.offsetHeight);");
            //sbJS.AppendLine("   datePicker.showPopup(position.x, position.y - (dimensions.height + 10)); ");
            sbJS.AppendLine("}");
 
            ScriptManager.RegisterStartupScript(Page, typeof(Page), rdpFechaInicial.ID.ToString(), sbJS.ToString(), true);
            //}
        }
    }
}

Code page .aspx

<%@ Register Src="~/ControlesUsuario/ctrlFecha.ascx" TagPrefix="uc1" TagName="ctrlFecha" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 
    <telerik:radajaxmanager ID="ramPCR" runat="server">
        <ClientEvents OnRequestStart="onRequestStart" />
        <ajaxsettings>
            <telerik:AjaxSetting AjaxControlID="cmbProyectos">
                <updatedcontrols>
                    <telerik:AjaxUpdatedControl ControlID="rgPCR" LoadingPanelID="ralpPCR" />
                </updatedcontrols>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgPCR">
                <updatedcontrols>
                    <telerik:AjaxUpdatedControl ControlID="cmbProyectos" />
                    <telerik:AjaxUpdatedControl ControlID="rgPCR" LoadingPanelID="ralpPCR" />
                </updatedcontrols>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="lbProcesoCrearCaso">
                <updatedcontrols>
                    <telerik:AjaxUpdatedControl ControlID="rgPCR" LoadingPanelID="ralpPCR" />
                </updatedcontrols>
            </telerik:AjaxSetting>
        </ajaxsettings>
    </telerik:radajaxmanager>
    <telerik:radajaxloadingpanel ID="ralpPCR" runat="server"></telerik:radajaxloadingpanel>
    <telerik:radwindowmanager ID="rwmPCR" runat="server"></telerik:radwindowmanager>
    <telerik:radwindowmanager id="rwm" runat="server" enableshadow="True" />
        <telerik:radcodeblock ID="rcbPCR" runat="server">  
            <script type="text/javascript">
                function confirmCallbackFn(arg) {
                    if (arg)
                    {
                        __doPostBack("<%=lbProcesoCrearCaso.UniqueID %>", "");
                    }
                }
 
                function RowSelecting(sender, eventArgs) {
                    var grid = sender;
                    var MasterTable = grid.get_masterTableView();
                    var gridItemElement = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()].findElement("cbChecked");
                     
                    if (gridItemElement.checked == false) {
                        gridItemElement.checked = true;
                    }
                    else {
                        gridItemElement.checked = false;
                    }
                }
            </script>
        </telerik:radcodeblock>
    <div class="box">
        <div class="box-header">
            <h3 class="box-title">
                <b>
                    <asp:Label runat="server" ID="lblTitulo" Text="Casos periĆ³dicos"></asp:Label>
                </b>
            </h3>
        </div>
        <div class="container">
            <div runat="server" id="divComboProyectos" class="panel panel-info">
                <div class="panel-body">
                    <div class="row">
                        <div class="col-md-12 text-center">
                            <telerik:radcombobox id="cmbProyectos" autopostback="true"
                                height="150px" width="350px" label="Seleccione un Proyecto"
                                runat="server"
                                onselectedindexchanged="cmbProyectos_SelectedIndexChanged">                  
                            </telerik:radcombobox>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-body no-padding">
            <asp:LinkButton ID="lbProcesoCrearCaso"
                Style="display: none;"
                runat="server"
                OnClick="lblbProcesoCrearCaso_Click">
            </asp:LinkButton>
            <telerik:radgrid ID="rgPCR" runat="server"
                AutoGenerateColumns="False"
                OnDeleteCommand="rgPCR_DeleteCommand"
                OnInsertCommand="rgPCR_InsertCommand"
                OnNeedDataSource="rgPCR_NeedDataSource"
                OnSelectedIndexChanged="rgPCR_SelectedIndexChanged"
                OnUpdateCommand="rgPCR_UpdateCommand" OnItemDataBound="rgPCR_ItemDataBound"
                ClientSettings-Selecting-AllowRowSelect="true" Culture="es-ES" GroupPanelPosition="Top" OnItemCommand="rgPCR_ItemCommand">
                <mastertableview datakeynames="IdCasoRec, TipoCaso, IdEmpresa">
                    <CommandItemTemplate>
                        <div class="col-xs-6">
                            <asp:LinkButton ID="lbAgregar"
                                runat="server"
                                CommandName="InitInsert"
                                Visible='<%# !rgPCR.MasterTableView.IsItemInserted %>'>
                                <img style="border:0px;vertical-align:middle;" src="../imagenes/AddRecord.png"/> Agregar
                            </asp:LinkButton>  
                            <asp:LinkButton ID="lbRefrescar" runat="server" OnClick="lbRefrescar_Click">
                                <img style="border:2px;vertical-align:middle;" src="../imagenes/Refresh.png"/> Refrescar
                            </asp:LinkButton>  
                            <asp:LinkButton ID="lbCrearCaso" runat="server"
                                OnClick="lbCrearCaso_Click" ClientIDMode="Static">
                                <img style="border:2px;vertical-align:middle;" src="../imagenes/CrearCaso.jpg"/> Crear Caso
                            </asp:LinkButton>  
                        </div>                    
                    </CommandItemTemplate>
                    <Columns>
                        <telerik:GridTemplateColumn UniqueName="chkSeleccionar" Exportable="False">
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemTemplate>
                              <asp:CheckBox ID="cbChecked" runat="server"
                                  AutoPostBack="True" OnCheckedChanged="CheckChanged">
                              </asp:CheckBox>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridEditCommandColumn
                            UniqueName="EditCommandColumn"
                            ButtonType="ImageButton"
                            EditText="Editar"
                            EditImageUrl="../imagenes/Edit.png"
                            InsertImageUrl="../imagenes/Edit.png"
                            Exportable="False">
                            <HeaderStyle Width="30px" />
                        </telerik:GridEditCommandColumn>
                        <telerik:GridBoundColumn DataField="IdCasoRec" UniqueName="IdCasoRec" HeaderText="CĆ³digo">
                            <HeaderStyle Width="60px" HorizontalAlign="Right"/>
                                        <ItemStyle HorizontalAlign="Right" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="NomTipoCaso" UniqueName="NomTipoCaso" HeaderText="Tipo de Caso">
                        </telerik:GridBoundColumn>         
                        <telerik:GridBoundColumn DataField="NomIdProyecto" UniqueName="NomIdProyecto" HeaderText="Proyecto">
                        </telerik:GridBoundColumn>             
                        <telerik:GridBoundColumn DataField="NomIdPrioridad" UniqueName="NomIdPrioridad" HeaderText="Prioridad">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Titulo" UniqueName="Titulo" HeaderText="TĆ­tulo">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Descripcion" UniqueName="Descripcion" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="NomSolicitante" UniqueName="NomSolicitante" HeaderText="Solicitante">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="FechaInicial" UniqueName="FechaInicial" HeaderText="Fecha Inicial" DataFormatString="{0:dd/MM/yyyy}">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="FechaFinal" UniqueName="FechaFinal" HeaderText="Fecha Vencimiento" DataFormatString="{0:dd/MM/yyyy}">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="NomEstado" UniqueName="NomEstado" HeaderText="Estado">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="IdEmpresa" UniqueName="IdEmpresa" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="IdProyecto" UniqueName="IdProyecto" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="IdPrioridad" UniqueName="IdPrioridad" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="SubProyecto" UniqueName="SubProyecto" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Linea" UniqueName="Linea" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="IdFrecuencia" UniqueName="IdFrecuencia" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="RowVersion" UniqueName="RowVersion" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Estado" UniqueName="Estado" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="TipoCaso" UniqueName="TipoCaso" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridButtonColumn ConfirmText="Desea eliminar este registro?" ConfirmDialogType="RadWindow"
                            ConfirmTitle="Eliminar" ButtonType="ImageButton"
                            CommandName="Delete" ImageUrl="../imagenes/Delete.png"
                            UniqueName="DeleteColumn" Text="Eliminar"
                            Exportable="False">
                            <HeaderStyle Width="30px" />
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings editformtype="Template">
                        <FormTemplate>
                            <table class="table table-condensed" style="font-size: 14px; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;">
                                <tr>
                                    <td style="width: 150px">Tipo de Caso</td>
                                    <td>
                                        <telerik:RadComboBox ID="rcbTipoCaso" Runat="server" Width="350px" Enabled='<%# rgPCR.MasterTableView.IsItemInserted %>'>
                                        </telerik:RadComboBox>
                                        <asp:RequiredFieldValidator
                                            ID="rfv_rcbTipoCaso" runat="server"
                                            ControlToValidate="rcbTipoCaso" ForeColor="Red"
                                            ErrorMessage="Campo Obligatorio">
                                        </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px">Prioridad</td>
                                    <td>
                                        <telerik:RadComboBox ID="rcbIdPrioridad" Runat="server" Width="350px">
                                        </telerik:RadComboBox>
                                        <asp:RequiredFieldValidator
                                            ID="rfv_rcbIdPrioridad" runat="server"
                                            ControlToValidate="rcbIdPrioridad" ForeColor="Red"
                                            ErrorMessage="Campo Obligatorio">
                                        </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px">TĆ­tulo</td>
                                    <td>
                                        <telerik:RadTextBox ID="rtbTitulo" Runat="server" Width="350px" MaxLength="200" Text='<%# Bind("Titulo") %>'>
                                        </telerik:RadTextBox>
                                        <asp:RegularExpressionValidator runat="server" ID="revTitulo"
                                            ValidationGroup="Textbox" ForeColor="Red"
                                            ControlToValidate="rtbTitulo" Display="Dynamic"
                                            ValidationExpression="<%$ Resources: RegularExpression, SoloCaracteresYAcentos %>"
                                            ErrorMessage="SĆ³lo se aceptan caracteres!" />
                                        <asp:RequiredFieldValidator
                                            ID="rfv_rtbTitulo" runat="server"
                                            ControlToValidate="rtbTitulo" ForeColor="Red"
                                            ErrorMessage="Campo Obligatorio">
                                        </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px">DescripciĆ³n</td>
                                    <td>
                                        <telerik:RadTextBox ID="rtbDescripcion" Runat="server" Width="350px" MaxLength="400" Text='<%# Bind("Descripcion") %>' TextMode="MultiLine" Rows="3">
                                        </telerik:RadTextBox>
                                        <asp:RequiredFieldValidator
                                            ID="rfv_rtbDescripcion" runat="server"
                                            ControlToValidate="rtbDescripcion" ForeColor="Red"
                                            ErrorMessage="Campo Obligatorio">
                                        </asp:RequiredFieldValidator>
                                        <asp:RegularExpressionValidator runat="server" ID="rex_rtbDescripcion"
                                            ValidationGroup="Textbox" ForeColor="Red"
                                            ControlToValidate="rtbDescripcion" Display="Dynamic"
                                            ValidationExpression="<%$ Resources: RegularExpression, SoloCaracteresAcentosYNumeros %>"
                                            ErrorMessage=" SĆ³lo se aceptan caracteres y nĆŗmeros!" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px">Fecha Inicial</td>
                                    <td>
                                        <uc1:ctrlFecha runat="server" ID="ctrlFechaInicial" NombreCtrlPicker="rdpFINI" NombreCtrlMascara="rmtbFINI" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px">
                                        <asp:Label ID="lbFechaVencimiento"
                                            runat="server"
                                            Text="Feha de Vencimiento"
                                            CssClass="opcionales">
                                        </asp:Label>
                                    </td>
                                    <td>
                                        <telerik:RadDatePicker ID="rdpFechaFinal" Runat="server"
                                            dateformat="dd/MM/yyyy" displaydateformat="dd/MM/yyyy" EnableTyping="false">
                                        </telerik:RadDatePicker>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px">Estado</td>
                                    <td>
                                        <telerik:RadComboBox ID="rcbEstado" Runat="server" Width="350px">
                                        </telerik:RadComboBox>
                                        <asp:RequiredFieldValidator
                                            ID="rfv_rcbEstado" runat="server"
                                            ControlToValidate="rcbEstado" ForeColor="Red"
                                            ErrorMessage="Campo Obligatorio">
                                        </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px">Frecuencia
                                        <%--<asp:Label ID="lbIdFrecuencia" runat="server" Text="Frecuencia" CssClass="opcionales"></asp:Label>--%>
                                    </td>
                                    <td>
                                        <telerik:RadComboBox ID="rcbIdFrecuencia" Runat="server" Width="350px"></telerik:RadComboBox>
                                        <asp:RequiredFieldValidator
                                            ID="rfv_rcbIdFrecuencia" runat="server"
                                            ControlToValidate="rcbIdFrecuencia" ForeColor="Red"
                                            ErrorMessage="Campo Obligatorio">
                                        </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px">
                                        <asp:Label runat="server" ID="lbEmpresas" Text="Proyectos" >
                                        </asp:Label>
                                    </td>
                                    <td>
                                        <telerik:RadComboBox ID="rcbProyecto" Runat="server" MaxHeight="330"
                                            Width="350px" CheckBoxes="true"
                                            EnableCheckAllItemsCheckBox="true">
                                        </telerik:RadComboBox>
                                        <asp:RequiredFieldValidator
                                            ID="rfv_rcbProyecto" runat="server"
                                            ControlToValidate="rcbProyecto" ForeColor="Red"
                                            ErrorMessage="Campo Obligatorio">
                                        </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <!--Campos Opcionales-->
                                <tr >
                                    <td style="width: 150px">
                                        <asp:Label ID="lbSubProyecto" runat="server" Text="Sub Proyecto" CssClass="opcionales"></asp:Label>
                                    </td>
                                    <td>
                                        <telerik:RadComboBox ID="rcbSubProyecto" Runat="server" Width="350px"></telerik:RadComboBox>
                                        <%--<asp:RequiredFieldValidator
                                            ID="rfv_rcbSubProyecto" runat="server"
                                            ControlToValidate="rcbSubProyecto" ForeColor="Red"
                                            ErrorMessage="Campo Obligatorio">
                                        </asp:RequiredFieldValidator>--%>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px">
                                        <asp:Label ID="lbLinea" runat="server" Text="LĆ­nea" CssClass="opcionales"></asp:Label>
                                    </td>
                                    <td>
                                        <telerik:RadComboBox ID="rcbLinea" Runat="server" Width="350px"></telerik:RadComboBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <telerik:RadButton ID="rbGuardar"
                                            runat="server"
                                            CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'
                                            Text='<%# (Container is GridEditFormInsertItem) ? "Agregar" : "Guardar" %>'  >
                                                <Icon PrimaryIconUrl="../imagenes/save_16x16.png" />
                                        </telerik:RadButton>   
                                        <telerik:RadButton ID="rbCancelar"
                                            runat="server"
                                            CausesValidation="False"
                                            CommandName="Cancel"
                                            Text="Cancelar" OnClick="CancelarAccion_Click">
                                            <Icon PrimaryIconUrl="../imagenes/cancel.png" />
                                        </telerik:RadButton>
                                               
                                        <asp:Label ID="Label1"
                                            CssClass="opcionales"
                                            runat="server" Text="* Opcionales">
                                        </asp:Label>
                                        <%--CausesValidation="true" validationgroup="Textbox"--%>
                                    </td>
                                </tr>
                            </table>
                        </FormTemplate>
                    </EditFormSettings>
                </mastertableview>
            </telerik:radgrid>
        </div>    
    </div>   
</asp:Content>

 

Regards,

 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 01 Jun 2016, 02:33 PM
Hi Melvin,

Please use RadCodeBlock instead of the RadScriptBlock in your UserControl. I have tested this scenario locally and the scripts display correctly when the RadCodeBlock is used:
Hope this helps.


Regards,
Konstantin Dikov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Melvin
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or