How can I access to a parameter of a method from another method in a User Control

  1. #1

    How can I access to a parameter of a method from another method in a User Control

    Hi,

    My user control is like this:

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="popup.ascx.cs" Inherits="popup" %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <ext:Window ID="window1" runat="server" Hidden="true" Height="400" Modal="true">
    
       <Items>   
          <ext:Panel ID="panel1" runat="server" Padding="15" Border="false" />
       </Items>
       
       <Buttons>
       
          <ext:Button ID="btnModify" runat="server" Text="Modify">
          
             <DirectEvents>
                <Click OnEvent="btnModify_Click" />                                 
             </DirectEvents>
          
          </ext:Button>   
       
       </Buttons>
    
    </ext:Window>
    public void Show(User user)
        {           
            window1.Show();
    
            Ext.Net.Label lbl1 = new Ext.Net.Label();            
            lbl1.Text = "Hello1 " + user.Name;
            
            Ext.Net.Label lbl2 = new Ext.Net.Label();            
            lbl2.Text = "Hello2" + user.Name;        
            
            panel1.ContentControls.Add(lbl1);
            panel1.ContentControls.Add(new LiteralControl("<br />"));        
            panel1.ContentControls.Add(lbl2);        
            
            panel1.Render();
        }
    I call user control like this:
    popup.Show(user);

    The issue is that I need to access to User parameter from btnModify_Click
    .
    public void btnModify_Click(object sender, DirectEventArgs e)
    {
          String name = user.Name; ???
          ...    
    }
    How can I refer to User parameter from this method?

    Thanks.
    Last edited by Daniil; Jul 25, 2011 at 9:57 AM. Reason: Please use [CODE] tags for all code
  2. #2
    Hi,

    You can use an <ext:Hidden> control to save a user.

Similar Threads

  1. Replies: 2
    Last Post: Dec 08, 2011, 1:00 PM
  2. Replies: 2
    Last Post: Oct 12, 2011, 7:49 AM
  3. Replies: 8
    Last Post: Jan 25, 2011, 4:21 AM
  4. Passing parameter to Ajax Method
    By shijith in forum 1.x Help
    Replies: 1
    Last Post: Jul 26, 2010, 12:52 PM
  5. Replies: 8
    Last Post: Jun 24, 2010, 9:39 PM

Posting Permissions