1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Example of Server.Transfer and Context Handler

Discussion in 'ASP.NET' started by hanusoft, Sep 3, 2007.

  1. hanusoft

    hanusoft New Member

    Joined:
    Sep 3, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    This is an example of Server.Transfer and Context Handler. Through this we can get the multiple values of previous form.

    In this page we are displaying data from previous form. We can use this technique for multiple form registration form.

    Code (ContextParent.aspx.cs): -
    Code:
    private void Button1_Click(object sender,System.EventArgs e)
    {
    	Server.Transfer("ContextChild.aspx");
    }
    
    internal Hashtable Value
    {
    	get
    	{
    		Hashtable objHT = new Hashtable();
    		objHT["Name"]=TextBox1.Text;
    		objHT["FathersName"]= TextBox2.Text;
    		objHT["Address"] = TextBox3.Text;
    		return objHT;
    	}
    }
    Code (ContextChild.aspx.cs) :-
    Code:
    private void Page_Load(object sender, System.EventArgs e)
    {
    	// Put user code to initialize the page here
    	Hashtable objHT = new Hashtable(); 
    	if(!IsPostBack)
    	{
    		ContextParent ParentPage;
    		ParentPage = (ContextParent)Context.Handler;
    		objHT = ParentPage.Value;
    		Response.Write("<br><br>");
    		foreach(DictionaryEntry di in objHT)
    		{
    			Response.Write(di.Key +" : "+di.Value);
    			Response.Write("<br>");
    		}
    	}
    }
     
  2. adithespeedy

    adithespeedy New Member

    Joined:
    Jun 16, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    [/PHP]it was too good
    PHP:
     
  3. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    What exactly does Server.Transfer do?
     
  4. narayan

    narayan New Member

    Joined:
    Apr 9, 2008
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    I think server.transfer will avoid a round trip from client to server
     

Share This Page