Hi !!
This is a very common question that how to pass value across pages in asp.net ?
So Let me share knowledge on this topic.
ASP.NET is very flexible and provides a lots of choice for this.
Please find the list below:
- QueryString
- Session
- Form
- ViewState
Lets discuss them one by one ::
QueryString :: This must be a obvious choice unless security is an issue or you want to pass object. You can use this to pass values like string, int etc. If security is an issue you can encrypt and then pass the values using querystring.
Use form name/value pairs for example in your code behind use:
Response.Redirect("mypageurl?value=" + myVariable)
Then in your receiving page code behind use
Dim myNewVariable As String = Request.QueryString("value")
to read the content of posted name/value
Session :: My first advise is do not use this unless required. You can use this to store any kind of value as key-pair value irrespective of value or reference type.
No comments:
Post a Comment