Update ASP.net controls via Direct Method

  1. #1

    Update ASP.net controls via Direct Method

    Is it possible to update the ASP.net controls eg. TextBox, Repeater (not Coolite controls) via DirectMethod.

  2. #2
    Geoffrey McGill
    Founder & CEO
  3. #3
    oops... that link above was posted to the wrong thread. Please disregard.
    Geoffrey McGill
    Founder & CEO
  4. #4
    Yes, there are a couple ways to update non-Ext.NET controls during a DirectEvent/DirectMethod.

    The following sample demonstrates both.

    1. Getting a lite-weight "Element" instance of the Control which allows for setting of attributes of the underlying html element. The TextBox renders an <input> element, which has a "value" attribute, so calling .SetValue(...) will set this underlying "value".

    2. Calling the .Update() extension method on the Control which will completely re-render the html for this specific Control. The .Update() Method can be called on any ASP.NET Control.


    <%@ 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.TextBox1.Text = DateTime.Now.ToLongTimeString();
                this.TextBox2.Text = DateTime.Now.ToLongTimeString();
        protected void Button1_Click(object sender, DirectEventArgs e)
        protected void Button2_Click(object sender, DirectEventArgs e)
            this.TextBox1.Text = DateTime.Now.ToLongTimeString();
            this.TextBox2.Text = DateTime.Now.ToLongTimeString();
            // Call .Update()
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <asp:TextBox ID="TextBox1" runat="server" />
            <asp:TextBox ID="TextBox2" runat="server" />
            <ext:Button runat="server" Text="Update TextBox1" OnDirectClick="Button1_Click" />
            <ext:Button runat="server" Text="Update TextBox2" OnDirectClick="Button2_Click" />
    Hope this helps.
    Geoffrey McGill
    Founder & CEO
  5. #5
    In running these tests we did fix a defect with the .Update() Method. The fix has been committed to SVN and will be publicly available with the next v1.0 release.
    Geoffrey McGill
    Founder & CEO

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. [CLOSED] Update ASP.Net Controls during DirectEvent/Method
    By alexkay in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 19, 2011, 6:23 AM
  3. Direct method and direct event over SSL?
    By dimitar in forum 1.x Help
    Replies: 0
    Last Post: Oct 08, 2011, 8:09 PM
  4. [CLOSED] Update a nodes iconcls and cls properties in direct method.
    By Labyrinth in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 02, 2010, 1:29 PM
  5. [CLOSED] Update ASP Update Panel with Direct Event
    By sharif in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 24, 2010, 12:48 AM

Posting Permissions