Web Forms Question:
Download Job Interview Questions and Answers PDF
How to use Context?
Answer:
//Page1.aspx stores value in context before transferring
Context.Items("UserName") = txtName.Text;
Server.Transfer("Page2.aspx");
//Page2.aspx retrieves the value from Page1’s context
string sName;
sName = Context.Items("UserName").ToString;
Response.Write("Your name is " + sName);
Context.Items("UserName") = txtName.Text;
Server.Transfer("Page2.aspx");
//Page2.aspx retrieves the value from Page1’s context
string sName;
sName = Context.Items("UserName").ToString;
Response.Write("Your name is " + sName);
Download Microsoft Web Forms Interview Questions And Answers
PDF
Previous Question | Next Question |
How to use Sessions in web forms? | How to use PreviousPage on web forms? |