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
Is asp.net mvc still used? : Asp.Net MVC
What is viewstate in asp net with example?
If 200 is for all successful operation then why do we have 201 response codes?
Why we are using mvc instead of asp.net? : Asp.Net MVC
What is the postback property in asp.net?
What is the difference between trace and debug in asp.net?
How to register exception filter globally?
Is post back property in asp net?
How do u deploy ur project?
Which protocol is used to call a web service?
What’s the difference between response .redirect and server.transfer?
What is cache in asp net?
What is the displayafter property in updateprogress control?
What is app_code folder in asp net?
What threading model used in asp and asp.net?