473,378 Members | 1,410 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to get viewstate from codebehind?

I have class file. How can I get viewstate from it? for session or
request I use for ex. HttpContext.Current.Session. How can I do it for
viewstate in c#?

Sebastian
Nov 18 '05 #1
7 9941
I want to retrive simple string value which I put, not object property. Just
simple string.

Sebastian
Nov 18 '05 #2
Cast the object in view state to the type that you need it to be.

string strColor;
strColor =(string)ViewState["color"];

Or

Dim strColor as String
strColor = CStr(ViewState("color"))

Dmitri

"Sebastian" <xl***@poczta.onet.pl> wrote in message
news:a5*************************@posting.google.co m...
I have class file. How can I get viewstate from it? for session or
request I use for ex. HttpContext.Current.Session. How can I do it for
viewstate in c#?

Sebastian

Nov 18 '05 #3
Page.ViewState["itemName"].ToString() should do the trick.

Jay Nathan, MCP .NET
Senior Consultant
MARINER
"Sebastian" <po*****@mail.com> wrote in message news:<uO**************@tk2msftngp13.phx.gbl>...
I want to retrive simple string value which I put, not object property. Just
simple string.

Sebastian

Nov 18 '05 #4
Page.ViewState["itemName"].ToString() should do the trick.

Jay Nathan, MCP .NET
Senior Consultant
MARINER
"Sebastian" <po*****@mail.com> wrote in message news:<uO**************@tk2msftngp13.phx.gbl>...
I want to retrive simple string value which I put, not object property. Just
simple string.

Sebastian

Nov 18 '05 #5
"JNathan" <ja********@mariner-usa.com> wrote in message
news:bb**************************@posting.google.c om...
Page.ViewState["itemName"].ToString() should do the trick.


Thx, but...
In login.aspx.cs I create object from class which is in other namespace and
other file.

I create object in "login.aspx.cs"file from class that is
in"components/login.cs" file.
Now, the question is: how can I get to viewstate from file login.cs in
components folder?

--
Sebastian
Nov 18 '05 #6
"JNathan" <ja********@mariner-usa.com> wrote in message
news:bb**************************@posting.google.c om...
Page.ViewState["itemName"].ToString() should do the trick.


Thx, but...
In login.aspx.cs I create object from class which is in other namespace and
other file.

I create object in "login.aspx.cs"file from class that is
in"components/login.cs" file.
Now, the question is: how can I get to viewstate from file login.cs in
components folder?

--
Sebastian
Nov 18 '05 #7
"Demyanik Dmitri" <aa*@bbbzxcvbn.com> wrote in message
news:uM**************@TK2MSFTNGP12.phx.gbl...
Cast the object in view state to the type that you need it to be.

string strColor;
strColor =(string)ViewState["color"];


Thx, but...
In login.aspx.cs I create object from class which is in other namespace and
other file.

I create object in "login.aspx.cs"file from class that is
in"components/login.cs" file.
Now, the question is: how can I get to viewstate from file login.cs in
components folder?

--
Sebastian W.
Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
3
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event...
2
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid...
2
by: Sebastian | last post by:
I have class file. How can I get viewstate from it? for session or request I use for ex. HttpContext.Current.Session. How can I do it for viewstate in c#? Sebastian
0
by: seven | last post by:
I have a base page with an HTMLForm object (added to the base page control heiarchy during Init). In the design of pages derived from this base page, I can choose to create controls and add them...
2
by: darrel | last post by:
I have a page that hits a database, and then builds a table on the codebehind size using a string builder. It's a hefty, complex table. As such, it's a bit large...however, I was a bit shocked...
10
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
5
by: AlexC | last post by:
Hi, i have just read some threads about viewstate and wanted to test myself. But there must be something i don't undertstand, because when i submit the form with EnableViewState="false", i get...
6
by: kucheravy | last post by:
Hi, everybody. I have this problem. When I put a <asp:ListBox on a web page and populate the data in the page Page_Load event the ViewState for the control is saved and loaded (after postback)...
2
by: qwedster | last post by:
Folks! The following is a "Hello World" kind of code for ViewState. I just want to know how to retain the ViewState 1) while Page Refresh when using UpdatePanel and also 2) While I reverting back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.