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 |
How can we inherit a static member?
What is indexing on asp.net?
view state data is stored in which format?
15 Answers Mind Tree, Pratham Software,
What are the 4 tenants of SOA/D.
what is abstract class and method..
What websites use asp.net?
How do u deploy your asp.net application?
code for "For every 5days system has to create 1text file with the corresponding date and it has to store in c-drive" by using web applications
How do you pass session values from one page to another ?
What is the name of the process the browser uses to find the address of a web server? a) DMZ b) DNS c) Active Directory d) Database lookup
What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
What is comparevalidator?
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)