can we transfer data from one page to another page using
viewstate if so how?if not y?
Answers were Sorted based on User's Feedback
Answer / guest
http://www.codeproject.com/KB/aspnet/TransferingValues.aspx
try out this link
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / bikramjit singh
No we cannot tranfer data from pne page to another using
viewstate. Viewsatate is a atate management technique which
allows to preserve controls property values and class level
variables values for a specific page between postbacks.
We can tranfer data from one page to another using session
object or query string.Session object is a collection
object which can store large amount of data whereas query
string is used to transfer small amount of information from
one page to another.
Bikramjit Singh.
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sandeep shah
yes its possible , use Server.transfer and you can use the
view state in the destination page only . not that you can
use the view state to some other page.
check this below link for more clarification
http://forums.asp.net/t/1137668.aspx/1
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / jack
TRY THIS it Will WORK
public void Button1_Click(object sender, EventArgs e)
{
ViewState["name"] = TextBox1.Text;
Context.Items.Add("variable", ViewState["name"].ToString());
Server.Transfer("Default2.aspx");
}
//next page
public void Page_Load(object sender, EventArgs e)
{
string myValue = Context.Items["variable"].ToString();
TextBox2.Text = myValue;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / pranit
Yes, we can access the viewstate variables across pages.
This is only possible if Cross Page Posting or
Server.transfer is used to redirect the user to other page.
If Response.redirect is used, then ViewState cannot be
accessed across pages.
StateBag class: This class is the primary storage mechanism
for all HTML and Web server controls. It stores
attribute/value pairs as strings associated with the
control. It tracks changes to these attributes only after
the OnInit method is executed for a page request, and saves
the changes to the page's or control's viewstate.
For
Detail:http://www.codeproject.com/Articles/37753/Access-ViewState-Across-Pages
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / gautam
Conceptually Viewstates are intended for only at page level.They cannot be used to transport data from one page to other as such.Yet there are several workarounds like what we do using Context collection or using previouspage object to obtain public members of previous webpage.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / senthil kumar
Yes, we can access the viewstate variables across pages. This is only possible if Cross Page Posting or Server.transfer is used to redirect the user to other page.
Refs Urls: http://www.codeproject.com/Articles/37753/Access-ViewState-Across-Pages
Note :
If Response.redirect is used, then ViewState cannot be accessed across pages.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / shyam
//*http://www.codeproject.com/KB/aspnet/TransferingValues.aspx*//
in this link they have used Response.redirect("abcd.aspx").
but by using Server.transfer("abcd.aspx")the case is
different.no page postpack is happening there..so i think by
using Server.transfer (not by Response.redirect)view state
data can be transfered acros the pages.
| Is This Answer Correct ? | 3 Yes | 4 No |
Answer / pradip
No, We Cant.......
Even we use Server.Transfer it's not possible because it's
only at page level.
| Is This Answer Correct ? | 0 Yes | 1 No |
what is the difference between response.write() and response.output.write()?
1. What is Connection Pooling…? 2. Maintaining Sessions in ASP.NET 3. ASP.NET page lifecycle. 4. Can we store objects in sessions. 5. What is AJAX..? 6. Serialization/Deserialization. Why we use serialization and Deserialization…? 7. What are Arrays and Arraylist..? 8. Difference between Authentication and Authorization…? 9. Difference between abstract class and Interfaces 10. What is a view..? Does a view contain data..? 11. What are triggers..? 12. What are transactions..? 13. What is Metaview (oracle)..? 14. What is Inheritance..? How can we call a method from the base class..? 15. Can an abstract class have zero abstract methods..? 16. How to read from Message Queue..? 17. What is Metadata..? 18. You would prefer to have business logic in c# or DB Side..? Why…?
1 Answers Franklin Templeton, Sky InfoTech,
Name and describe some HTTP Status Codes and what they express to the requesting client ?
Difference between Response.Expires and Expires.Absolute ?
1 Answers Accenture, BirlaSoft,
What is the difference between globalization and localization?
Which class is used to send an email message from an ASP.NET Web page?
0 Answers Sans Pareil IT Services,
Let's say I have an existing application written using vb6 and this application utilizes windows 2000 com+ transaction services. How would you approach migrating this application to.net?
What is validationsummary server control? where it is used ?
How do you pass session values from one page to another ?
What is a query string in a url?
By default, Web API sends HTTP response with which of the following status code for all uncaught exception?
When we are requesting a new URL through Response.Redirect() the new page wil open on the new browser window or it wil open in the same window? If we use Server.Transfer() what wil happen?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)