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

What is asp.net used for?

1149


What is strong-typing versus weak-typing?

1174


Where viewstate value is stored in asp.net?

1143


What is the difference between system.stringbuilder and system.string

836


What is the benefit of WebAPI over WCF?

1063


Can you set which type of comparison you want to perform by the comparevalidator control?

962


What is the biggest disadvantage of “Other Return Types” in Web API?

1462


Difference between singleton and singlecall.

1039


What is Partial PostBack in ASP.NET?

1093


How do http sessions work?

968


When maintaining session through sql server, what is the impact of read and write operation on session objects?

1042


How does http session work?

1049


Define the steps to set up validation control.

1099


What is the difference between page directive include and action tag include?

994


What is a proxy in web service?

1113