is it possible to persiste customize object in view state?
how it is?
Answers were Sorted based on User's Feedback
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 |
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 |
How can you send an email message from an asp.net web page?
How do you add a javascript function for a link button in a datagrid ?
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?
What is distributed system in asp.net?
Define xmlvalidatingreader class.
What does AspCompat="true" mean and when should I use it?
Demonstrate Render and PreRender?
Can anyone please tell me that the question posted on this website are Sufficient for the interview with 2+ year experience in .net
Do you know using sql cache invalidation?
What are the different types of Session state management options available with ASP.NET?
WHAT IS THE SEQUENCE IN WHICH ASP.NET EVENTS IS PROCEED?