[CLOSED] Controls not updating from Direct Event

  1. #1

    [CLOSED] Controls not updating from Direct Event

    Hi,

    In a web from, I'm updating some controls (labels , textbox etc) on Direct Event called on combo select event but its not updating the controls.
    Could you please suggest me why its not updating ??
    Thanks ,
    Last edited by Daniil; Sep 10, 2013 at 5:25 AM. Reason: [CLOSED]
  2. #2
    Hello,

    Please see #1 at the following location,

    http://forums.ext.net/showthread.php...ation-Required
    Geoffrey McGill
    Founder
  3. #3
    Here is the code
      <ext:ComboBox ID="cmbLoanNo" runat="server" MatchFieldWidth="False" PageSize="10"
                                    TypeAhead="True" DisplayField="LOAN_NO" ValueField="LOAN_NO" RTL="True" IDMode="Explicit"
                                    IsDynamic="False" Namespace="App" RenderXType="True">
                                    <Store>
                                        <ext:Store runat="server" ID="dsLoan" OnReadData="dsLoan_ReadData" PageSize="10"
                                            ClearOnPageLoad="False">
                                            <Proxy>
                                                <ext:PageProxy>
                                                </ext:PageProxy>
                                            </Proxy>
                                            <Model>
                                                <ext:Model ID="Model2" runat="server" IDProperty="LOAN_NO">
                                                    <Fields>
                                                        <ext:ModelField Name="LOAN_NO" ServerMapping="LOAN_NO" />
                                                        <ext:ModelField Name="LOAN_DESC" ServerMapping="LOAN_DESC" />
                                                        <ext:ModelField Name="LOAN_AMT" ServerMapping="LOAN_AMT" />
                                                        <ext:ModelField Name="LOAN_DATE" ServerMapping="LOAN_DATE" />
                                                    </Fields>
                                                </ext:Model>
                                            </Model>
                                            <Listeners>
                                            </Listeners>
                                        </ext:Store>
                                    </Store>
                                    <DirectEvents AutoDataBind="True">
                                        <Select OnEvent="cmbLoanNo_ValueChanged">
                                        </Select>
                                    </DirectEvents>
                                    <ListConfig Width="260" Height="300" ItemSelector=".x-boundlist-item">
                                        <Tpl ID="Tpl2" runat="server">
                                            <Html>
                                                <tpl for=".">
    						    <tpl if="[xindex] == 1">
    							    <table class="cbStates-list">
    								    <tr>
    									    <th>رقم القروض</th>
    									    <th>وصف قرض</th>
                                            <th>كمية</th>
                                            <th>تاريخ</th>
    								    </tr>
    						    </tpl>
    						    <tr class="x-boundlist-item">
    							    <td>{LOAN_NO}</td>
    							    <td>{LOAN_DESC}</td>
                                    <td>{LOAN_AMT}</td>
                                    <td>{LOAN_DATE}</td>
    						    </tr>
    						    <tpl if="[xcount-xindex]==0">
                    </table>
                    </tpl> </tpl> </Html> </Tpl> </ListConfig> </ext:ComboBox>
    Code Behind
     [DirectMethod]
            public void cmbLoanNo_ValueChanged(object sender, DirectEventArgs e)
            {
                if (cmbLoanNo.SelectedItem.Value != null)
                {
                    DataTable dt = (DataTable)ViewState["LoanPlan"];
    
                    DataTable dt2 = new DataTable();
                    dt2 = dt.Copy();
                    DataTable dtrt = GetLoanNoDetails(dt, cmbLoanNo.SelectedItem.Value == null ? "" : cmbLoanNo.SelectedItem.Value.ToString());
    
                    ViewState["LoanPlan"] = dt2;
                    if (dtrt.Rows.Count > 0)
                    {
                        LoanDate.Text = dtrt.Rows[0]["LOAN_DATE"].ToString();
                        if (dtrt.Rows[0]["CALC_TYPE"].ToString().ToUpper() == "FIXED")
                        {
                            InstallmentType.Text = "ثابت";
                        }
                        else
                        {
                            InstallmentType.Text = "عدد القسط";
                        }
                        EmpName2.Text = dtrt.Rows[0]["EMPLOYEE_NAME"].ToString();
                        LoanCode.Text = dtrt.Rows[0]["LOAN_TYPE"].ToString();
                        LoanAmt.Text = dtrt.Rows[0]["LOAN_AMT"].ToString();
                        InstValue.Text = dtrt.Rows[0]["INSTALL_VALUE"].ToString();
                        Position.Text = dtrt.Rows[0]["POSITION"].ToString();
                        LoanDesc2.Text = dtrt.Rows[0]["LOAN_DESC"].ToString();
                        RecovDate.Text = dtrt.Rows[0]["RECOV_ST_DATE"].ToString();
                    }
                    grvLoanplanDetails.DataSource = dtrt;
                    grvLoanplanDetails.DataBind();
                }
              
    
            }
    Last edited by hidaextnet; Sep 02, 2013 at 7:04 AM.
  4. #4
    Hi @hidaextnet,

    So, are the controls that you mean - LoanDate, EmpName2, etc.?

    What are those controls? Is it Ext.NET controls? I cannot see them in the code snippet.

    Did you check (debug) these code lines are actually executed?
    LoanDate.Text = dtrt.Rows[0]["LOAN_DATE"].ToString();
    EmpName2.Text = dtrt.Rows[0]["EMPLOYEE_NAME"].ToString();
    etc.

    By the way, you don't need a [DirectMethod] attribute for a DirectEvent handler.
  5. #5
    Quote Originally Posted by Daniil View Post
    Hi @hidaextnet,

    So, are the controls that you mean - LoanDate, EmpName2, etc.?

    What are those controls? Is it Ext.NET controls? I cannot see them in the code snippet.
    These are asp controls

    Did you check (debug) these code lines are actually executed?
    LoanDate.Text = dtrt.Rows[0]["LOAN_DATE"].ToString();
    EmpName2.Text = dtrt.Rows[0]["EMPLOYEE_NAME"].ToString();
    etc.

    By the way, you don't need a [DirectMethod] attribute for a DirectEvent handler.
    I've checked , these lines are executing.
  6. #6
    To get an ASP.NET control updated during a DirectEvent/DirectMethod you have to call its Update method.
    LoanDate.Text = dtrt.Rows[0]["LOAN_DATE"].ToString();
    LoanDate.Update();

Similar Threads

  1. [CLOSED] Output Cache issue with Direct Method / Direct Event
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 18
    Last Post: Mar 01, 2013, 5:03 AM
  2. Replies: 8
    Last Post: Sep 10, 2012, 6:38 AM
  3. Replies: 7
    Last Post: Jun 28, 2011, 11:13 AM
  4. Replies: 12
    Last Post: Jan 01, 2011, 1:36 AM
  5. Replies: 3
    Last Post: Apr 20, 2010, 12:21 PM

Posting Permissions