is it possible to persiste customize object in view state?
how it is?

Answers were Sorted based on User's Feedback



is it possible to persiste customize object in view state? how it is?..

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

is it possible to persiste customize object in view state? how it is?..

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

Post New Answer

More ASP.NET Interview Questions

How can you send an email message from an asp.net web page?

0 Answers  


How do you add a javascript function for a link button in a datagrid ?

4 Answers   Microsoft,


Can we store PROGID information in database and dynamically load the component ?

1 Answers   Digital GlobalSoft, e4e,


What is the difference between application object and session object?

4 Answers   IBS,


What is distributed system in asp.net?

0 Answers  


Define xmlvalidatingreader class.

0 Answers  


What does AspCompat="true" mean and when should I use it?

1 Answers   Infogain,


Demonstrate Render and PreRender?

0 Answers   QuestPond,


Can anyone please tell me that the question posted on this website are Sufficient for the interview with 2+ year experience in .net

0 Answers  


Do you know using sql cache invalidation?

0 Answers  


What are the different types of Session state management options available with ASP.NET?

1 Answers  


WHAT IS THE SEQUENCE IN WHICH ASP.NET EVENTS IS PROCEED?

4 Answers  


Categories