TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sthitaprajnya Debasis Nayak
NA
716
558.8k
How To Increase a View State Value on page load
Feb 1 2016 12:47 PM
Hi Friends ,
I want to increment a variable by 1 inside the page load, that means whenever i reload the page the value of the variable should increase by one.
i have wrote the following lines of code, but alaways getting the result as 1. i am not understanding how to increment the value....
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
ViewState["View"] = 1;
int count = (int)ViewState["View"];
count += 1;
ViewState["View"] = count;
lblView.Text = ViewState["View"].ToString();
}
}
Reply
Answers (
2
)
new technology mvc,silverlight etc
session timeout automatically