Hi guys!
I have the following scenario .
[
I use RadControls for ASP.NET AJAX Q1 2012
Visual Studio 2010
C# & Asp
]
1 Aspx
5 User Controls
UserControlCatalogo
UserControlDetalle
UserControlDetalleInterno1
UserControlDetalleInterno2
UserControlDetalleInterno3
The aspx page contains a call to " UserControlCatalogo " contains a RadGrid with this data, choose "edit " or "new " in this open RadGrid PopUp containing at UserControlDetalle .
The UserControlDetalle contains a set of RadTextBox and RadTabStrip ( tab panel ) which contains three tabs .
Tab 1 -> contains UserControlDetalleInterno1
Tab 2 -> contains UserControlDetalleInterno2
Tab 3 -> contains UserControlDetalleInterno3
UserControlDetalleInterno1 contains another RadGrid you want to do the following : By clicking on "new" or "edit " expands to display fields and add new data.
The problem is that when I use the "edit" or "new" function from radgrid, the template is not opened to fill data only "flashes" the popup and the table does nothing * in debuging enters the post back , refresh bd updates, the radgrid datasourse * ... and ends ... * if I remove "ObtenerDatos", the table does not appear *
i cant add or edit my radgrid items :C
UserControlDetalleInterno1 ASPCode (yes, other name)
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrdenServicioCU.ascx.cs" Inherits="Presentation.Web.Catalogos.Cat_Contratos.OrdenServicioCU" %><telerik:RadGrid ID="rgOrdenServicio" runat="server" AllowMultiRowEdit="true" Visible="true" AllowPaging="True" GridLines="None" AllowAutomaticUpdates="true" AutoGenerateColumns="false" AllowAutomaticInserts="true" AllowAutomaticDeletes="true" AllowSorting="true"> <MasterTableView CommandItemDisplay="Top" DataKeyNames="ID" NoMasterRecordsText="No hay datos a mostrar."> <PagerStyle Mode="NumericPages"></PagerStyle> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton"> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="ID" HeaderText="ID" Visible="false"> <HeaderStyle Width="1px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="OrdenServicio" HeaderText="Orden de Servicio" ReadOnly="True"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="FechaInicio" DataType="System.DateTime" HeaderText="Fecha de Inicio" SortExpression="FechaInicio" UniqueName="FechaInicio" DataFormatString="{0:D}"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="FechaTermino" DataType="System.DateTime" HeaderText="Fecha de Termino" SortExpression="FechaTermino" UniqueName="FechaTermino" DataFormatString="{0:D}"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="MontoAsignado" DataType="System.Decimal" HeaderText="Monto Asignado" SortExpression="MontoAsignado" UniqueName="MONTO_ASIGNADO"> </telerik:GridBoundColumn> <telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton"> </telerik:GridButtonColumn> </Columns> <EditFormSettings EditFormType="Template"> <EditColumn UniqueName="EditCommandColumn1"> </EditColumn> <FormTemplate> <table cellspacing="2" cellpadding="1" width="100%" border="0"> <tr style="visibility: hidden"> <td colspan="2"> <b>ID: <%# Eval("ID")%> </b> </td> </tr> <tr> <td> Orden de Servicio: </td> <td> <asp:TextBox Width="200px" ID="TextBox1" runat="server" Text='<%# Bind("OrdenServicio") %>'></asp:TextBox> </td> </tr> <tr> <td> Fecha de Inicio: </td> <td> <asp:TextBox Width="200px" ID="TextBox2" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.FechaInicio" )%>'></asp:TextBox> </td> </tr> <tr> <td> Fecha de Termino: </td> <td> <asp:TextBox Width="200px" ID="TextBox3" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.FechaTermino" )%>'></asp:TextBox> </td> </tr> <tr> <td> Monto Asignado: </td> <td> <asp:TextBox Width="200px" ID="TextBox4" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.MontoAsignado" )%>'></asp:TextBox> </td> </tr> <tr> <td colspan="2"> <asp:Button ID="Button1" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' OnClick="btnInsertOrden_clic"></asp:Button> <asp:Button ID="Button2" runat="server" Text="Cancel" CausesValidation="false" CommandName="Cancel"> </asp:Button> </td> </tr> </table> </FormTemplate> </EditFormSettings> </MasterTableView></telerik:RadGrid>UserControlDetalleInterno1.cs CodeBehind (yes, other name)
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using ServicesReferencesCore.CatalogoService;using Telerik.Web.UI;namespace Presentation.Web.Catalogos.Cat_Contratos{ public partial class OrdenServicioCU : System.Web.UI.UserControl { CatalogoServiceClient CatClient = new CatalogoServiceClient(); public ContratoDTO Contrato = new ContratoDTO(); List<OrdenServicioDTO> lstOrdenServicio; protected void Page_Load(object sender, EventArgs e) { if (Contrato.Id > 0) { ObtenerDatos(); Session["contrato"] = Contrato; } else { if (Session["contrato"] != null) Contrato = Session["contrato"] as ContratoDTO; } } private void ObtenerDatos() { if (Contrato != null) { if (Contrato.Id > 0) { CatClient = new CatalogoServiceClient(); lstOrdenServicio = new List<OrdenServicioDTO>(); lstOrdenServicio = CatClient.ObtenerOrdenServicioContrato(Contrato.Id); rgOrdenServicio.DataSource = lstOrdenServicio; rgOrdenServicio.DataBind(); } else { lstOrdenServicio = new List<OrdenServicioDTO>(); rgOrdenServicio.DataSource = lstOrdenServicio; rgOrdenServicio.DataBind(); } } else { lstOrdenServicio = new List<OrdenServicioDTO>(); rgOrdenServicio.DataSource = lstOrdenServicio; rgOrdenServicio.DataBind(); } } #region Eventos protected void btnInsertOrden_clic(object sender, EventArgs e) { //codigo para guardar los datos en la bd } #endregion }}Thanks All!
PD: im bad on english, but i try it n.nU