[CLOSED] Load Textfields in formpanel from Store in Window

  1. #1

    [CLOSED] Load Textfields in formpanel from Store in Window

    Hello,
    I want to load the values of textfields from the database. I tried to follow this example:https://examples4.ext.net/#/Form/Mis...ous/Form_View/
    But it doesnt load them. Here is what I have done:

    DocSearch.ascx

    <ext:Store ID="EditDocStore" runat="server"  OnReadData="EditDocStore_ReadData" >
                         <Model>
                             <ext:Model ID="Model2" runat="server">
                                 <Fields>
                                     <ext:ModelField Name="docFirstName" />
                                 </Fields>
                             </ext:Model>
                         </Model>
                     </ext:Store>
    <ext:Window ID="wndEditDoctor" runat="server"  Title="Edit Doctor" Hidden="true" Layout="FitLayout" Width="500" Height="750">
        <Listeners>
            <AfterRender Handler="#{EditDocStore}.reload();" />
        </Listeners>
        <Tools>
            <ext:Tool Type="Refresh" Handler="#{EditDocStore}.reload();" ToolTip="Refresh edit Doctors" /> 
        </Tools>
        <Items>        
             <ext:FormPanel runat="server" ID="FormPanel1" >            
                <Items>                                
                    <ext:Label ID="Label1" runat="server" Width="470" Height="40"></ext:Label>
                    <ext:TextField runat="server" ID="TextField1" FieldLabel="First Name" MaxLength="100" Width="470" Editable="true" Name="docFirstName" AllowBlank="false">
                    </ext:TextField>
                                
                </Items>
    
            </ext:FormPanel>
        </Items>
    
    </ext:Window>
    DocSearch.ascx.cs

            protected void EditDocStore_ReadData(object sender, StoreReadDataEventArgs e)
            {
                this.EditDocStore.Datasource = new object[]
                {
                    new object[] { "DocName" }
                };
    
                this.EditDocStore.DataBind();
            }
    Last edited by fabricio.murta; Mar 17, 2017 at 3:36 PM.
  2. #2
    Hello @atroul!

    Your code behind code has a syntax error in it! Please use DataSource, not Datasource. You should be getting runtime errors from that code... no?
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello @Fabricio

    That was mistake I did while copying and modifying the code to write it here.
    In my project is DataSource
  4. #4
    Hello @atroul!

    So, if I fix Datasource to DataSource what are the steps to reproduce the issue you are having over there? Was the code you provided supposed to run on my side if I pasted it in a blank page?
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hello @atroul,

    Unfortunately, you are not providing enough details within your support requests, and not taking the time to provide a simplified runnable sample that demonstrates how to reproduce the issue. This is going to delay the timeliness and quality of the support we can provide.

    Please review the Forum Guidelines and accept the policies and recommendations listed before posting in the forums again.

    After reviewing the forum guidelines, if you have any questions, please feel free to ask us.
    Geoffrey McGill
    Founder
  6. #6
    Well in that case the problem solved , I added this:

    [code]
    <Listeners>
    <DataChanged
    Handler="var record = this.getAt(0) || {};#{FormPanel1}.getForm().loadRecord(record);"
    Delay="10"
    />
    </Listeners>

    the problem is that most of the times its not possible to provide a runnable example because the project is big and I will need a lot of time to simplify it. In this particular example I cleaned as much I could and if you put it in a page with the default tags would work
    Last edited by fabricio.murta; Mar 17, 2017 at 3:36 PM. Reason: Wrap [code] tags around code.

Similar Threads

  1. how to Load values to textfields after combobox item selected
    By sunshineenterprises in forum 2.x Help
    Replies: 3
    Last Post: Jul 09, 2014, 5:34 PM
  2. [CLOSED] UserControl TextFields are not firing validation inside FormPanel
    By mohan.bizbites in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Aug 12, 2013, 2:16 PM
  3. Replies: 5
    Last Post: Nov 12, 2012, 7:39 AM
  4. FormPanel load from Store
    By m_bo in forum 1.x Help
    Replies: 0
    Last Post: Mar 23, 2012, 2:38 PM
  5. Replies: 2
    Last Post: Oct 11, 2011, 1:15 PM

Tags for this Thread

Posting Permissions