Is there any way to change the value of asp.net control?

  1. #1

    Is there any way to change the value of asp.net control?

    For example, I have a <ext:Button> and a <asp:Label>
    If I click the button, I want to change the value of label
    Is there any way to change the value of asp.net control? Thanks!
  2. #2
    Hi,

    I'm going to assume you're doing this in a DirectEvent handler. If yes, then just call .Render() on the <asp:Label> to re-render the Control.
    Geoffrey McGill
    Founder
  3. #3
    Quote Originally Posted by geoffrey.mcgill View Post
    Hi,

    I'm going to assume you're doing this in a DirectEvent handler. If yes, then just call .Render() on the <asp:Label> to re-render the Control.

    Thanks your reply, But can you tell me how to call .Render() on the <asp:Label>?
  4. #4
    Hi,

    I think Geoffrey meant the Update method.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void SetValue(object sender, DirectEventArgs e)
        {
            this.Label1.Text = "New value";
            this.Label1.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:Label ID="Label1" runat="server" Text="Initial value" />
            <ext:Button runat="server" Text="Set a new value" OnDirectClick="SetValue" />
        </form>
    </body>
    </html>
  5. #5
    Hi!

    I have read the code above, but it seems that there is no such a function named Update in Label:
    http://msdn.microsoft.com/en-us/libr...(v=VS.80).aspx
  6. #6
    That's right.

    But it's our extension method to update non Ext.NET controls during a DirectEvent.
    Last edited by Daniil; Dec 10, 2011 at 4:24 AM.
  7. #7
    Extension Method?
    Oh, I see, thanks very much!

Similar Threads

  1. Replies: 0
    Last Post: Jul 03, 2012, 10:38 AM
  2. [CLOSED] Change Theme Per Control
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 23, 2011, 9:52 AM
  3. How to change ext label control css
    By kashif.qureshic10 in forum 1.x Help
    Replies: 0
    Last Post: Oct 12, 2011, 7:41 AM
  4. [CLOSED] Change Tab Name dynamically in Tab Control
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 19, 2009, 2:45 AM
  5. change status of a control from codebehind
    By supermanwah in forum 1.x Help
    Replies: 4
    Last Post: May 13, 2009, 11:18 AM

Tags for this Thread

Posting Permissions