[CLOSED] Server side controls values with DirectEvent calls

  1. #1
    Hi,

    I guess you should wrap
    Me.txtName.Text = mCountry.Name
    in the following condition
    if (!X.IsAjaxRequest)
    In a different way it's executed during DirectEvent.

    Here is the full example.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.TextField1.Text = "Initial";
            }
        }
    
        protected void ShowText(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("DirectEvent", this.TextField1.Text).Show();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:TextField ID="TextField1" runat="server" />
            <ext:Button runat="server" Text="Show Text" OnDirectClick="ShowText" />
        </form>
    </body>
    </html>
  2. #2

    [CLOSED] Server side controls values with DirectEvent calls

    I am facing a problem getting text field value on DirectEvent method for a Update operation.
    I can't get actual field value from server side instance, thus that way I get the last value rendered to the form.

    When I render the form I complete all fields (server side controls) with actual database entity information on Form Load event.
    Let's say, value 'Spain'

    Me.txtName.Text = mCountry.Name

    When firing the DirectEvent for saving changes I do the oposite, filling the entity with client entered data (basic and straightforward). Let's say, value 'France'


    mCountry.Name = Me.txtName.Text
    But I get the old original value ('Spain').

    If I get the posted information, I get actual last modified value ('France')

    mCountry.Name = Request("txtName")

    Is there anyway to get on DirectEvent server side controls to be updated just as if it were a regular form Post operation?

    Thanks
    Regards
    Fernando
    Last edited by Daniil; Feb 14, 2012 at 6:59 PM. Reason: [CLOSED]
  3. #3
    Thanks Daniil.
    I didn't know DirectMethods execute FormLoad.

    ASP.NET PageMethods and AjaxPro library AjaxMethods call do not execute FormLoad.

    I was hitting the database twice every direct Event call!!

    It worked now.

    Thanks
    Regards
    Leonardo
  4. #4
    Quote Originally Posted by FAS View Post
    ASP.NET PageMethods and AjaxPro library AjaxMethods call do not execute FormLoad.
    ASP.NET PageMethods are static and really don't call OnLoad.

    There are static DirectMethods in Ext.NET which works the similar way as native ASP.NET PageMethods, see #4:
    https://examples1.ext.net/#/Events/D...hods/Overview/

    An access to web controls is not possible within a static DirectMethod.

    I'm not sure about AjaxPro library AjaxMethods, how they work.

Similar Threads

  1. [CLOSED] Enable/disable DirectEvent confirmation on server side
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 29, 2012, 4:53 PM
  2. Replies: 1
    Last Post: Mar 11, 2012, 3:03 AM
  3. [CLOSED] Find Combobox store caller and Server-side values.
    By ljcorreia in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: May 04, 2011, 3:42 PM
  4. Replies: 2
    Last Post: Apr 27, 2011, 8:08 AM
  5. [CLOSED] How to get GridFilters Values (server side)
    By VALUELAB in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: May 05, 2009, 1:03 PM

Tags for this Thread

Posting Permissions