[CLOSED] Update ASP.Net Controls during DirectEvent/Method

  1. #1

    [CLOSED] Update ASP.Net Controls during DirectEvent/Method

    I am trying to update an ASP.Net control during a direct event but it is not working. I am trying to use this example below but none of my ASP.Net controls have an "Update()" method.

    
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!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></title>
        
        <script runat="server">
            protected void UpdateTextBox(object sender, DirectEventArgs e)
            {
                TextBox1.Text = string.Empty;
                TextBox1.Update();
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <asp:TextBox ID="TextBox1" runat="server" Text="Text" />
            
            <ext:Button runat="server" Text="Clear">
                <DirectEvents>
                    <Click OnEvent="UpdateTextBox" />
                </DirectEvents>
            </ext:Button>
        </form>
    </body>
    </html>


  2. #2

    RE: [CLOSED] Update ASP.Net Controls during DirectEvent/Method

    Hi alexkay,

    Thanks for the clean sample, although when I test, the <asp:TextBox> appears to be updated correctly during the DirectEvent.

    I modified your sample slightly. Try the following.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void UpdateTextBox(object sender, DirectEventArgs e)
        {
            this.TextBox1.Text = DateTime.Now.ToLongTimeString();
            this.TextBox1.Update();
        }
    </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" />
            <asp:TextBox ID="TextBox1" runat="server" Text="Text" />
            
            <ext:Button runat="server" Text="Clear" OnDirectClick="UpdateTextBox" />
        </form>
    </body>
    </html>
    Hope this helps.

    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] Update ASP.Net Controls during DirectEvent/Method

    Ok, I figured it out, the update method is an extension method, you have to include the namespace Ext.Net in your code to get it to work.
  4. #4

    RE: [CLOSED] Update ASP.Net Controls during DirectEvent/Method

    Thanks, Geoeffrey,

    The main thing i was missing was the namespace, without it the update method did not exist and the code would not compile.
  5. #5
    Hi,

    I was using ASP.NET repeater control to bind data.
    But now I am using Ext.Net GridPanel for the same.
    On Edit I am binding data to different ASP.Net controls which are in a ASP.Net panel which is set to Visible="false" initially.
    But now while editing on CommandColumn, Panel is not getting visible or values are not getting set in ASP.Net control.
    According to above posts we have to use .Update() method to update ASP.Net controls.
    But my issue is I have used namespace like

    using ext = Ext.Net;

    And connot use it as using Ext.Net; because its giving me Ambiguity errors for System.Web.UI.WebControls and Ext.Net controls.

Similar Threads

  1. Update Controls and Content during a DirectEvent
    By HosseinHelali in forum 1.x Help
    Replies: 1
    Last Post: Jul 12, 2011, 10:15 AM
  2. [CLOSED] Adding a button directevent in a directevent method
    By ogokgol in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 31, 2011, 10:29 AM
  3. [CLOSED] update() method for innerHTML change on v1.0
    By ljcorreia in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 19, 2010, 12:54 PM
  4. Update ASP.net controls via Direct Method
    By glenh in forum 1.x Help
    Replies: 4
    Last Post: Sep 14, 2010, 5:38 PM
  5. DirectEvent controls update strategy?
    By lukasw in forum 1.x Help
    Replies: 1
    Last Post: May 27, 2010, 12:04 PM

Posting Permissions