ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  ASP.NET
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 SharePoint interview questions  SharePoint Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
can we transfer data from one page to another page using 
viewstate if so how?if not y?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 1
No.from my knowledge can not.Bcos viewstate life time is in 
single page.So while going to another page first page 
viewstate end already.
 
Is This Answer Correct ?    30 Yes 7 No
Leoiser
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 2
yes.using view state we can pass value of one page to another
 
Is This Answer Correct ?    11 Yes 29 No
Pankaj
 
 
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 3
This is not possible using view state , however we can 
acheive this by using session .View state has only page 
scope.
 
Is This Answer Correct ?    19 Yes 4 No
Gurvinder Singh
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 4
I think its not possible using viewstate.To pass data from 
one page to another we are using session variable.
 
Is This Answer Correct ?    12 Yes 4 No
Jayamala
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 5
By using viewstate it is not possible.sure it is not 
possible.bcoz its comes under the pagelevel state manage 
ment.to maintaning the state in page it self we are using 
the view state.
 
Is This Answer Correct ?    5 Yes 4 No
Tejavishu
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 6
yes we can by sessions, server.transver
 
Is This Answer Correct ?    9 Yes 4 No
Ashutosh Sharma
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 7
no we cant transfer data from one page to another page 
using viewstate.
becouse in viewstate we can store only page level 
information
 
Is This Answer Correct ?    5 Yes 5 No
Guest
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 8
View state is page level Access state managemenet
so viewstate object is available only after page_init() and 
before page_load().

so we cannot pass it from one page to other page as a part 
of request or any more......
 
Is This Answer Correct ?    1 Yes 3 No
Guest
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 9
Yes.
View state is page specific; it contains information about
controls embedded on theparticular page. ASP.NET 2.0
resolves this by embedding a hidden input field
name,__POSTBACK . This field is embedded only when there is
an IButtonControl on thepage and its PostBackUrl property is
set to a non-null value. This field contains the viewstate
information of the poster page. To access the view state of
the poster page, you canuse the new PreviousPage property of
the page

Page poster = this.PreviousPage;

Then you can find any control from the previous page and
read its state

Label posterLabel =(Label)poster.findControl("myLabel");
string lbl = posterLabel.Text;

This cross-page post back feature also solves the problem of
posting a Form to multiplepages, because each control, in
theory, can point to different post back URL.
 
Is This Answer Correct ?    9 Yes 3 No
Vijaykumar
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 10
No, It's not possible even if you are using the server.transfer.


If any one saying yes, ask them how?
 
Is This Answer Correct ?    2 Yes 1 No
Ali Baba
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 11
not possible
 
Is This Answer Correct ?    1 Yes 1 No
Vengatesh
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 12
no we cant transfer data from one page to another page 
using viewstate.
becouse in viewstate we can store only page level 
information
 
Is This Answer Correct ?    1 Yes 3 No
Anish.p.r
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 13
i feel it's possible to pass values from one page to 
another using view state 

Just try this :

Hold the values in viewstate which you want to transfer to 
another page , in the next page where you want to pass the 
values , 

In page_load 
Access the values hold in view state

Just try this once :
 
Is This Answer Correct ?    0 Yes 2 No
Shravankumar
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 14
If someone is not sure about answer then please don't give 
answer blindly. 

Answer is 'NOOOOOOO....'
 
Is This Answer Correct ?    0 Yes 2 No
Guest
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 15
viewstate values stored in present page...once use 
server.transfer the view state values was out....so not 
possible to transfer data from one page to another page...
 
Is This Answer Correct ?    2 Yes 1 No
Shamme
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 16
Yes. We can transfer data one page two an other page 
through View state.  
Server.Transfer("secondpage.aspx view=textbox");

View state is page specific; it contains information about
controls embedded on theparticular page. resolves this by 
embedding a hidden input field

   " KULDEEP KHAWARE "
 
Is This Answer Correct ?    0 Yes 6 No
Kuldeep Khaware
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 17
No, we can't pass the data from one page to another using 
viewstate. Because, view state will be maintained between 
page postbacks only
 
Is This Answer Correct ?    2 Yes 0 No
Radhika Kilaru
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 18
Its right we cannot transfer the value from one page to 
another using viewstate. Viewstate has the limit only on 
one page. For transferring values we can use session or 
querystring and interesting for more value transfer store 
the values in datatable and store the table in a session.
 
Is This Answer Correct ?    0 Yes 0 No
Abhinav Saxena
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 19
This is VERY MUCH POSSIBLE to access viewstate on another
page. This is only possible when you use SERVER.TRANSFER

Try this out.

Create a textbox control on page1.aspx and have a button.

Onclick of button put this code in page load event of
Page2.aspx.

/*****************************************************/
Page Poster = this.PreviousPage;

TextBox txtNewTest = (TextBox)Poster.FindControl("txtTest");

sDisplay = txtNewTest.Text;

Response.Write(sDisplay);
/*****************************************************/
 
Is This Answer Correct ?    5 Yes 1 No
Prasad Bakshi
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 20
http://www.codeproject.com/KB/aspnet/TransferingValues.aspx
try out this link
 
Is This Answer Correct ?    0 Yes 0 No
Guest
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 21
//*http://www.codeproject.com/KB/aspnet/TransferingValues.aspx*//
 in this link they have used Response.redirect("abcd.aspx").
 but by using Server.transfer("abcd.aspx")the case is
different.no page postpack is happening there..so i think by
using  Server.transfer (not by Response.redirect)view state
data can be transfered acros the pages.
 
Is This Answer Correct ?    1 Yes 1 No
Shyam
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 22
No ,surely it is not possible.we can solve this problem b 
using session
 
Is This Answer Correct ?    0 Yes 1 No
Jince P George
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 23
Yes, you can get the PreviousPage ViewSate.

I have created two pages (Default.aspx and LandingPage.aspx)

Default.aspx has a LinkButton with a PostBackUrl pointing 
to LandingPage.aspx.

Code Behind for Default.aspx:

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e 
As System.EventArgs) Handles Me.Load
        ViewState("MyValue") = "I am a test value"
    End Sub

    Public Function GetViewState() As System.Web.UI.StateBag
        Return ViewState
    End Function

End Class

Code Behind for LandingPage.aspx:

Partial Class LandingPage
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e 
As System.EventArgs) Handles Me.Load
        If PreviousPageViewState IsNot Nothing Then
            If PreviousPageViewState("MyValue") IsNot 
Nothing Then
                'Value is retrieved from the PreviousPage 
ViewState
                MyBase.Controls.Add(New LiteralControl
(PreviousPageViewState("MyValue")))
            End If
        End If
    End Sub

    Private ReadOnly Property PreviousPageViewState() As 
StateBag
        Get
            Dim ReturnValue As System.Web.UI.StateBag = 
Nothing
            If PreviousPage IsNot Nothing Then
                Dim MyTypeObj As Object = DirectCast
(PreviousPage, Object)
                For Each MethodObj As Reflection.MethodInfo 
In PreviousPage.GetType.GetMethods()
                    If MethodObj.Name = "GetViewState" Then
                        ReturnValue = MethodObj.Invoke
(MyTypeObj, Nothing)
                        Exit For
                    End If
                Next
            End If
            Return ReturnValue
        End Get
    End Property

End Class
 
Is This Answer Correct ?    1 Yes 1 No
William Niver
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 24
Yes, We can transfer one page data to another page using
viewstate,

The Way :-

The whole page data is stored in viewstate when you do a
page submit, at this point if you do server.transfer to
another page, it is like a postback on same page, you can
access both page data in view state.

To access the previous page data you have to use 

System.Web.UI.Page prevPage = this.PreviousPage;

now all your controls are available with the same state they
were posted.
 
Is This Answer Correct ?    0 Yes 1 No
Anil Pandya
 
  Re: can we transfer data from one page to another page using viewstate if so how?if not y?
Answer
# 25
yes we can do it by cross page posting (cross page 
viewstate)

here is the code:

Source page code:
----------------
public partial class ViewStateContainer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ViewState["Page1"] = "Page1 ViewState";
        Server.Transfer("AccessViewState.aspx");
    }

    /*StateBag class: This class is the primary storage 
mechanism for all HTML and Web server controls.
    It stores attribute/value pairs as strings associated 
with the control. It tracks changes to these
    attributes only after the OnInit method is executed for 
a page request, and saves the changes 
    to the page's or control's viewstate.*/
    public StateBag ReturnViewState()
    {
        return ViewState;
    }

}

Target page code:
----------------

public partial class AccessViewState : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (PreviousPage != null)
        {
            if (PreviousPageViewState != null)
            {
                Label1.Text = PreviousPageViewState
["Page1"].ToString();
            }
        }
        Response.Write(((Label)PreviousPage.FindControl
("Label1")).Text);

    }

    private StateBag PreviousPageViewState
    {
        get
        {
            StateBag returnValue = null;
            if (PreviousPage != null)
            {
                Object objPreviousPage = (Object)
PreviousPage;
                MethodInfo objMethod = 
objPreviousPage.GetType().GetMethod
                        ("ReturnViewState");
                return (StateBag)objMethod.Invoke
(objPreviousPage, null);
            }
            return returnValue;
        }
    }

}
 
Is This Answer Correct ?    0 Yes 0 No
Vipin Agrawal
 

 
 
 
Other ASP.NET Interview Questions
 
  Question Asked @ Answers
 
What is the main difference between a static page and a dynamic page?  1
what is .net Net-Solution11
What methods are fired during the page load? Visual-Soft6
What is wrong with a line like this? DateTime.Parse(myString) Metasys4
What is the Web.config file used for? a) To store the global information and variable definition for the application. b) Configures the time that the server-side codebehind module is called c) To Configure the Web Server. d) To Configure the Web browser. Syntax-Softtech3
Can you explain the difference between an ADO.NET Dataset and an ADO Recordset? HCL3
Various types of Page Load functions Net-Solution3
After building the custom control, you test it by adding an ASP.Net web application to the solution. You add a correct <%@ Register %> directive and a proper declaration of the control in the <asp:Form> tag to the Web Form, but when you execute the application you get an error. What is the most likely reason for the problem? a) The custom control must be compiled first. b) The web application must have a reference to the control c) The custom control must be registered with windows first. d) The assembly from the custom control is not in the application?s bin directory. Syntax-Softtech1
Caching techniques in .NET ? Microsoft1
What is three major points in WCF?  4
Which method do you invoke on the DataAdapter control to load your generated dataset with data?  2
what is diffrence between debug class and trace class in asp.net ?  2
relacement of websevices in .net 3.0? Mind-Tree1
What are the different ways you would consider sending data across pages in ASP (i.e between 1.asp to 2.asp)? Net-Solution1
If you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?  1
what is the difference between console.writeline &console.output.writeline?  2
Security types in ASP/ASP.NET? Different Authentication modes?  3
how can we maintain security in soted procedure?  1
Which method do you invoke on the DataAdapter control to load your generated dataset with data?  1
how to update data using store procedure  1
 
For more ASP.NET Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com