is it possible to persiste customize object in view state?
how it is?
Answers were Sorted based on User's Feedback
Answer / satish v itagi
You have to use <Serializable()> attribute prefixed to the
class declaration before you keep object of this class in
viewstate. However, larger the object, slower will be
performance. There will be risk of viewstate getting
corrupted.
Eg
'' in class definiton:
<serializable()> Public Class Fruit
private sName as string
public sub new(ByVal Name as string)
sName = Name
End Sub
readonly property Name as string
Get
return sName
end get
End Class
''in code behind:
if page.ispostback = false
dim MyApple as new Fruit("Kashmiri Apple")
ViewState("oMyFruit") = MyApple
end if
'' In button click
label1.text = ctype( ViewState("oMyFruit") , Fruit).Name
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / raovarinder singh
Yes it is possible to persiste customize object in view
state, Supposed your are having one variable named x for
which you want to persist the view state.
dim x as integer
ViewState(Value) = x
Which can then be accessed as follows:
x = ViewState(Value)
| Is This Answer Correct ? | 0 Yes | 2 No |
What is the difference between page.registerclientscriptblock and page.registerstartupscript?
How to send data through querystring to another page but it should not be displayed in URL
What are the objects in used in ASP for processing input and outputs?
How can we read a columnised text data in ASP.Net C#? Columnised means my data is stored in a text file and I have numeric data or string data in this file. For ex. If I am searching for the data of gender and I know that gender data is stored at column 32 in text file. How can I get this data in ASP.Net page. Thanks for help in advance.
Disable browser cache for entire ASP.NET website?
what are the events raised in asp.net page life cycle?in which stage view state can be loaded?
What are the various ways to send content from one page to another?
Why SessionID changes in every request in asp.net?
What is difference b/w Data Grid in ASP.Net 1.1 and Gridview in 2.0
I have developed a web application in asp.net 2.0 with Access as back end i am trying to gereate report/export data in excel. After hosting the site i am not getting any error or such exported excel file. but using the source code from my system it works fine. Could any one tell me why it is happening and what is its solution.
What is the relationship(in oops) between codebehind and inline code(.aspx to .aspx.cs)??? explain
Webconfig file is cofiguration of server or browser?
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)