is it possible to persiste customize object in view state?
how it is?
Answer Posted / 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 |
Post New Answer View All Answers
How to comment out asp.net tags?
What does aspcompat="true" mean?
Explain the basic functionality of garbage collector?
What are the features of asp net?
What is the procedure to create the environment for asp.net? : asp.net mvc
What is sdlc process?
What does it mean your session has timed out?
Is LINQ performance wise better or using sqlcommand?
What is use of <% %> in asp.net?
What is the difference between session and application?
Contrast oop and soa. What are tenets of each16. How does the xmlserializer work? What acl permissions does a process using it require?
Where the assembly is stored in asp.net?
Explain swagger components.
What does mean by a neutral culture?
What is viewstate? In which event of the page life cycle, is the viewstate available?