[CLOSED] Window with details not updated

  1. #1

    [CLOSED] Window with details not updated

    Hi again, I'm trying to develop a web site in asp.net and I have a page with a GridPanel inside. Every row has a command column which has to open a ext.net.window with the details of the row selected:

    <%@ Register src="~/ControlesSecundarios/FormularioCliente.ascx" tagname="FormularioCliente" tagprefix="uc1" %>
    <uc1:FormularioCliente ID="UcFormularioCliente" runat="server" />
    
    <ext:CommandColumn ID="CommandColumn1" runat="server">
                        <Commands>
                            <ext:GridCommand Icon="UserEdit" CommandName="ModificarCliente">
                                <ToolTip Text="Modificar Cliente" />
                            </ext:GridCommand>
                        </Commands>
                        <DirectEvents>
                            <Command OnEvent="rptClientesCommand">
                                <ExtraParams>
                                    <ext:Parameter Name="idCliente" Value="record.data.ID_CLIENTE" Mode="Raw" />
                                    <ext:Parameter Name="accion" Value="command" Mode="Raw" />
                                </ExtraParams>
                            </Command>
                        </DirectEvents>
                    </ext:CommandColumn>

    Public Sub rptClientesCommand(ByVal sender As Object, ByVal e As Ext.Net.DirectEventArgs)
    
            Dim accion As String = e.ExtraParams.Item("accion")
    
            Dim strPathAndQuery As String = "GestionClientes.aspx"
            Dim strUrl As String = HttpContext.Current.Request.Url.AbsoluteUri.Replace(strPathAndQuery, "")
    
            Select Case accion
                Case "ModificarCliente"
    
                    idCliente = Integer.Parse(e.ExtraParams.Item("idCliente"))
    
                    UcFormularioCliente.CargarDatos() ' Loads the data in the controls: txtNombre,...
                    UcFormularioCliente.Show() ' Shows the window
    
            End Select
    
        End Sub
    UcFormularioCliente is a ascx control which contains a ext.net.window:

    <ext:Window 
        ID="wdwClientes" 
        runat="server" 
        Icon="Group" 
        Title="Cliente"
        Width="1000" 
        Height="600" 
        Collapsible="true"
        Maximizable="true"
        AutoShow="false" 
        Modal="false" 
        Hidden="true"
        Layout="Fit"
        Frame="true" >
        <content>
        <ext:Panel ID="Panel1" runat="server" Title="Datos de cliente">
                <Content>
    <input id="txtNombre" runat="server" type="text" class="input-medium" placeholder="Nombre de cliente..." maxlength="300"/>
    ...and much more controls...
    </Content>
            </ext:Panel>
            </content>
    </ext:Window>
    The problem is that the textboxes are empty when the window is loaded.

    The scenario is like this: https://examples2.ext.net/default.as...Window_Remote/
    but using asp.net controls inside the window.

    Thank you in advance and sorry for my poor english.
    Last edited by Daniil; Jul 16, 2013 at 4:29 AM. Reason: [CLOSED]
  2. #2
    Hi @jamesand,

    Quote Originally Posted by jamesand View Post
    The problem is that the textboxes are empty when the window is loaded.
    Please clarify how do you populate those TextBoxes?
  3. #3
    As simply as:

    Public Sub CargarDatos()
    txtNombre.Text = "Test"
    End Sub
    CargarDatos() is SetEmployee function in https://examples2.ext.net/default.as...Window_Remote/
  4. #4
    If you change an ASP.NET control during a DirectEvent/DirectMethod, you should call that control's Update method to get it updated on client.

    So, please try:
    txtNombre.Text = "Test"
    txtNombre.Update()
  5. #5
    Ok Daniil thank you, it works and the controls show the values.

    The next step would be to modify those values (textboxes and dropdownlist), press modify button and get the modified values.

    And here is the new problem: when I press the button "Save" btnGuardarDatosCliente, dropdownlist miss their values and items:

    <ext:Window 
        ID="wdwClientes" 
        runat="server" 
        Icon="Group" 
        Title="Clientes"
        Width="1000" 
        Height="600" 
        Collapsible="true"
        Maximizable="true"
        AutoShow="false" 
        Modal="false" 
        Hidden="true"
        Layout="Fit"
        Frame="true" >
        <content>
        <ext:Panel ID="Panel1" runat="server" Title="Datos de cliente">
                <Content>
    <button id="btnGuardarDatosCliente" type="button" runat="server" class="btn btn-small btn-success" ValidationGroup="GuardarCliente">Save</button>
    
    <asp:TextBox id="txtNombre" runat="server" class="input-medium" placeholder="Nombre de cliente..." maxlength="300"/>
    
    <asp:DropDownList id="ddlTipo" runat="server" class="input-medium">                      
                        </asp:DropDownList>
    ddlTipo gets the source of its data in codebehind.

    If I press btnGuardarDatosCliente, txtNombre.Text has the modified value, BUT ddlTipo.Value doesn't have value, even it miss all item.
  6. #6
    It works fine if the dropdown gets its values directly:

    <asp:DropDownList id="ddlTipo" runat="server" class="input-medium">          
                <asp:ListItem Value="0">Tipo de cliente...</asp:ListItem>
                            <asp:ListItem Value="1">Empresa</asp:ListItem>
    </asp:DropDownList>
    It doesn't work if the items are set in codebehind:

    Dim lista As List(Of ElementosEnumerados) = Enumerados.RecuperarTipos()
    
                ddlTipo.DataSource = lista
                ddlTipo.DataTextField = "Descripcion"
                ddlTipo.DataValueField = "Valor"
                ddlTipo.DataBind()
  7. #7
    So, are you adding the items during a DirectEvent?
  8. #8
    No, the values of the dropdownlist are added in CargarDatos function (similar function to SetEmployee in https://examples2.ext.net/default.aspx...Window_Remote/)

    Public Sub CargarDatos()
    txtNombre.Text = "Test"
    
    Dim lista As List(Of ElementosEnumerados) = Enumerados.RecuperarTipos()
     
                ddlTipo.DataSource = lista
                ddlTipo.DataTextField = "Descripcion"
                ddlTipo.DataValueField = "Valor"
                ddlTipo.DataBind()
    End Sub
    Then, when I press the button btnGuardarDatosCliente to read the values of txtNombre (textbox) and ddlTipo (dropdownlist), ddlTipo has no items.
  9. #9
    Ok, the items have to be added in Page_Load in order to work properly.

    Thanks for your help.

Similar Threads

  1. Replies: 0
    Last Post: Aug 31, 2012, 11:38 AM
  2. Replies: 0
    Last Post: Feb 10, 2012, 11:44 PM
  3. [CLOSED] [1.0] Previous/Next buttons on Details Window
    By MP in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 29, 2010, 11:46 AM
  4. Replies: 7
    Last Post: Mar 24, 2009, 7:48 AM
  5. [CLOSED] details window variation
    By alexp in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 23, 2009, 7:40 AM

Tags for this Thread

Posting Permissions