Hello,
I have a problem with Radcombox that is inside form template, I need that the first radcombo
This is the code aspx
<telerik:RadGrid runat="server" Id="rgDirecciones" AutoGenerateColumns="False" OnDeleteCommand="rgDirecciones_DeleteCommand" OnInsertCommand="rgDirecciones_InsertCommand" OnItemDataBound="rgDirecciones_ItemDataBound" OnUpdateCommand="rgDirecciones_UpdateCommand" CellSpacing="-1" GroupPanelPosition="Top" > <mastertableview datakeynames="IdDireccion,IdSucursal,IdEmpresa"> <rowindicatorcolumn visible="False"> </rowindicatorcolumn> <expandcollapsecolumn created="True"> </expandcollapsecolumn> <Columns> <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" EditImageUrl="../imagenes/Edit.png" InsertImageUrl="../imagenes/Edit.png" Exportable="False"> <HeaderStyle Width="30px" /> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="IdDireccion" UniqueName="IdDireccion" HeaderText="No Dirección"> <HeaderStyle Width="80px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="TipoDireccion" UniqueName="TipoDireccion" HeaderText="Tipo"> <HeaderStyle Width="80px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Direccion" UniqueName="Direccion" HeaderText="Dirección"> <HeaderStyle Width="200px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Referencia" UniqueName="Referencia" HeaderText="Referencia"> <HeaderStyle Width="200px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Organizacion" UniqueName="Organizacion" HeaderText="Organización"> <HeaderStyle Width="200px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="NombreContacto" UniqueName="NombreContacto" HeaderText="Nombre de Contacto"> <HeaderStyle Width="200px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CodigoPostal" UniqueName="CodigoPostal" HeaderText="Código Postal"> <HeaderStyle Width="130px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="RowVersion" UniqueName="RowVersion" Display="False"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="IdSucursal" UniqueName="IdSucursal" HeaderText="Sucursal" Display="False"> <HeaderStyle Width="150px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Pais" UniqueName="Pais" Display="False"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="DivisionTerritorial" UniqueName="DivisionTerritorial" 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" FilterControlAltText="Filter DeleteColumn column" Exportable="False"> <HeaderStyle Width="30px" /> </telerik:GridButtonColumn> </Columns> <editformsettings editformtype="Template"> <editcolumn filtercontrolalttext="Filter EditCommandColumn1 column" uniquename="EditCommandColumn1"> </editcolumn> <formtemplate> <table class="table table-condensed"> <tr> <td style="width: 150px"> <asp:Label ID="lbIdDireccion" runat="server" Text="No Dirección"></asp:Label> </td> <td> <telerik:RadNumericTextBox ID="txtIdDireccion" runat="server" Enabled="<%# (Container is GridEditFormInsertItem) ? true : false %>" MaxLength="2" MaxValue="99" MinValue="0" Text='<%# Bind("IdDireccion") %>' Width="80px"> <numberformat decimaldigits="0" groupseparator="" /> </telerik:RadNumericTextBox> <asp:RequiredFieldValidator ID="rfvIdDireccion" runat="server" ControlToValidate="txtIdDireccion" Display="Dynamic" ErrorMessage="Campo Obligatorio" ForeColor="Red"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td style="width: 150px"> <asp:Label ID="lbPaisDire" runat="server" Text="PaÃs"></asp:Label> </td> <td> <telerik:RadComboBox ID="cmbPais" Runat="server" Width="350px" Height="150px" AutoPostBack="True" OnSelectedIndexChanged="combo_SelectedIndexChanged"> </telerik:RadComboBox> <asp:RequiredFieldValidator ID="rfvcmbPais" runat="server" Display="Dynamic" ForeColor="Red" ControlToValidate="cmbPais" ErrorMessage="Campo Obligatorio"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td style="width: 150px"> <asp:Label ID="lbDivisionTerritorial" runat="server" Text="División Territorial"></asp:Label> </td> <td> <telerik:RadComboBox ID="cmbDivisionTerritorial" Runat="server" Width="350px"> </telerik:RadComboBox> </td> </tr> <tr> <td style="width: 150px"> <asp:Label ID="lbDireccion" runat="server" Text="Direccion"></asp:Label> </td> <td> <telerik:RadTextBox ID="txtDireccion" Runat="server" MaxLength="200" Text='<%# Bind("Direccion") %>' TextMode="MultiLine" Width="350px"> <ClientEvents OnValueChanging="removerMasDeUnEspacio" /> </telerik:RadTextBox> <asp:RequiredFieldValidator ID="rfvtxtDireccion" runat="server" Display="Dynamic" ForeColor="Red" ControlToValidate="txtDireccion" ErrorMessage="Campo Obligatorio"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td style="width: 150px"> <asp:Label ID="lbNombreContacto" runat="server" Text="NombreContacto"></asp:Label> </td> <td> <telerik:RadTextBox ID="txtNombreContacto" Runat="server" Text='<%# Bind("NombreContacto") %>' MaxLength="100" Width="350px"> <ClientEvents OnValueChanging="removerMasDeUnEspacio" /> </telerik:RadTextBox> <asp:RequiredFieldValidator ID="rfvtxtNombreContacto" runat="server" Display="Dynamic" ForeColor="Red" ControlToValidate="txtNombreContacto" ErrorMessage="Campo Obligatorio"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td style="width: 150px"> <asp:Label ID="lbOrganizacion" runat="server" CssClass="opcionales" Text="Organización"></asp:Label> </td> <td> <telerik:RadTextBox ID="txtOrganizacion" Runat="server" Text='<%# Bind("Organizacion") %>' MaxLength="100" Width="350px"> <ClientEvents OnValueChanging="removerMasDeUnEspacio" /> </telerik:RadTextBox> </td> </tr> <tr> <td style="width: 150px"> <asp:Label ID="lbReferencia" runat="server" CssClass="opcionales" Text="Referencia"></asp:Label> </td> <td> <telerik:RadTextBox ID="txtReferencia" Runat="server" Text='<%# Bind("Referencia") %>' MaxLength="100" Width="350px"> <ClientEvents OnValueChanging="removerMasDeUnEspacio" /> </telerik:RadTextBox> </td> </tr> <tr> <td style="width: 150px"> <asp:Label ID="lbCodigoPostal" runat="server" CssClass="opcionales" Text="CodigoPostal"></asp:Label> </td> <td> <telerik:RadTextBox ID="txtCodigoPostal" Runat="server" Text='<%# Bind("CodigoPostal") %>' MaxLength="10" Width="80px"> <ClientEvents OnValueChanging="removerMasDeUnEspacio" /> </telerik:RadTextBox> </td> </tr> <tr> <td colspan="2"> <telerik:RadButton ID="RadButton1" runat="server" causesvalidation="true" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' Text='<%# (Container is GridEditFormInsertItem) ? "Agregar" : "Guardar" %>' validationgroup="Textbox"> <icon primaryiconurl="../imagenes/save_16x16.png" /> </telerik:RadButton> <telerik:RadButton ID="RadButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancelar"> <icon primaryiconurl="../imagenes/cancel.png" /> </telerik:RadButton> <asp:Label ID="Label2" runat="server" CssClass="opcionales" Text="* Opcionales"></asp:Label> </td> </tr> </table> </formtemplate> </EditFormSettings> <CommandItemTemplate> <div class="col-xs-6"> <asp:LinkButton ID="lbAgregarDirecciones" runat="server" CommandName="InitInsert" Visible='<%# !rgDirecciones.MasterTableView.IsItemInserted %>'><img style="border:2px;vertical-align:middle;" alt="" src="../imagenes/AddRecord.png"/> Agregar</asp:LinkButton> <asp:LinkButton ID="lbRefrescarDirecciones" runat="server"> <img style="border:2px;vertical-align:middle;" alt="" src="../imagenes/Refresh.png"/> Refrescar </asp:LinkButton> </div> <uc1:opcionesimportaciongrid runat="server" id="OpcionesImportacionGrid3" Grid="rgDirecciones" WebForm='<%# Page.Request.RawUrl.Substring(Page.Request.RawUrl.LastIndexOf("/") + 1) %>' NombreArchivo="Direcciones"/> </CommandItemTemplate> </mastertableview> </telerik:RadGrid>Code
protected void rgDirecciones_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormItem && e.Item.IsInEditMode)//editform { GridEditableItem item = (GridEditableItem)e.Item; GridEditFormItem editItem = (GridEditFormItem)e.Item; if (!(e.Item is IGridInsertItem)) { RadComboBox comboTipoDirecciones = (RadComboBox)editItem.FindControl("cmbTipoDireccion"); comboTipoDirecciones.SelectedValue = editItem["TipoDireccion"].Text; RadComboBox comboPais = (RadComboBox)editItem.FindControl("cmbPais"); comboPais.SelectedValue = editItem["Pais"].Text; } } }protected void combo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { GridEditableItem editedItem = (sender as RadComboBox).NamingContainer as GridEditableItem; GridEditFormItem item = (sender as RadComboBox).NamingContainer as GridEditFormItem; RadComboBox comboPaises = sender as RadComboBox; RadComboBox comboDivisionTerritorial = (RadComboBox)editedItem.FindControl("cmbDivisionTerritorial"); var parametrosSQL = new string[] { null, e.Value }; DataSet ds = Clases.MetodosGlobales.ObtenerInformacionObjeto("ADMMDivisionesTerritoriales_get", parametrosSQL); comboDivisionTerritorial.Text = null; comboDivisionTerritorial.EmptyMessage = "- Seleccione un valor -"; comboDivisionTerritorial.Filter = RadComboBoxFilter.StartsWith; comboDivisionTerritorial.DataSource = ds.Tables[0]; comboDivisionTerritorial.DataTextField = "Descripcion"; comboDivisionTerritorial.DataValueField = "Divisionterritorial"; comboDivisionTerritorial.DataBind(); }The problem is that when I choose value of first radcombo. I fill the second radcombo but all the page load again and I lost the value of first combo and the second combo does not show the information. All the form is blank as if I did nothing
I do not understand what is the problem.
Regards,
