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 |
Whats the use of @ Register directives ?
How do you design a website with multilingual support in ASP.NET ?
What is the difference between dispose() and finalize()?
What are Session states available and its Uses?
Explain what is event bubbling?
is gateway for sms continue connected for sending sms.how?
When does the application ONEND event handler fire?
1 Answers C Squared Systems, Verinon Technology Solutions,
if i want to give an alert message like "try after sometime" to a web page which is being seen by other person.if a web page is not seen by anyone then it should display otherwise it show a display a message stating that other person is viewing so try after some time........how can i implement this.
I am using a range validator and want to use dd mm yyyy format for accepting dates. I get a fairly generic "can't do that" type exception when I use this format for setting the minValue or maxValue properties for the range validator. How can I force it to accept my format?
What is server side session?
How ASP and ASP.NET page works.
what is asp.net