Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How can we update records in gridview?Is there any appropriate code for it?

2092


Can we use a static function with a non-static variable?

926


What are the advantages of asp.net?

937


How can you enable impersonation in the web.config file?

1089


Why we use content place holder in asp.net?

975


how to transfer the file from client to server using asp.net

1049


What are cookies in your browser?

938


If you want to write your own dot net language, what steps you will you take care?

989


Which protocol is used to call a web service?

997


How to disable validator control by client side JavaScript?

996


What does session_start () do?

1017


Explain one critical mapping?

947


How do I debug an asp.net application that was not written with visual studio.net and that does not use code-behind?

962


Which namespace is used by ado.net?

940


Difference between .NET and previous version?

2530