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
What are sessions used for?
Which Is Faster MVC or ASP.net ?
Does web services support data reader like pom project?
How to do state management in ASP.NET?
What does asp.net stand for?
What is the server of asp.net?
If you want to bind the columns manually within the asp:datagrid tags what kind of tags you have to add.
Define repository pattern in mvc.net? : asp.net mvc
Differentiate between namespace and assembly.
What is the compiled object?
Why is an object pool required?
Is it possible to develop a single web application using ASP.NET webforms and ASP.MVC?
Explain about asp.net 2.0 themes?
Can a .net web application consume java web service?
Using code explain Configuration Management