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
Types of instancing properties and explain each. Tell the difference between multiuse,singleuse and globalmultiuse and which is default ?
Write a code for sending an email from asp.net application.
What types of data validation events are commonly seen in the client-side form validation?
What are themes and skins in 2.0, explain usage scenario?
1.how to encrpt query string in asp.net? 2.there are 10000 records then i wnat display 5000 records one gridview and 5000 records another grid view what is the process?
What is gridview in asp.net?
What are the different kinds of assemblies?
How can you enable impersonation in the web.config file?
Can we override the enablepartialrendering property of the scriptmanager class?
Why mvc is faster than asp.net? : Asp.Net MVC
Can any body provide me the sample web application in asp.net
What is jade template engine?
What is repository pattern in mvc.net? : asp.net mvc
What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
What are the ways of preserving data on a Web Form in ASP.NET?