DataGrid Won't come back(2)

Discussion in 'ASP .Net' started by Tina, Sep 30, 2005.

  1. Tina

    Tina Guest

    This message refers to the one I left an hour ago. It's another way to ask
    a question that will help me solve my problem.

    Below is a working ASPX program. It has two buttons and a DataGrid named dg
    on it. There is a dataadapter and an associated typed dataset that is the
    source to the datagrid. All a very typical program. When button one is
    pushed the grid gets filled. When button 2 is pushed dg IS STILL
    THERE(thats good of course). Why is it still there? Each time a form is
    used it is destroyed. What restores dg? There is no code in the " web form
    designer generated code" that restores it. How does the dg object get
    rebuilt?

    thanks,
    T

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click
    daCustLogin.Fill(DsCustlogin1)
    dg.DataBind()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button2.Click
    Dim dgItem As DataGridItem

    For Each dgItem In dg.Items
    Dim mystring As String
    mystring = dgItem.Cells(0).Text

    Next
    End Sub
    Tina, Sep 30, 2005
    #1
    1. Advertising

  2. Tina

    Terry Olsen Guest

    I believe that's the work of the VIEWSTATE hidden control. When looking at
    an aspx page, view the source of that page and you'll see

    <input type="hidden" name="__VIEWSTATE" value=

    followed by a bunch of garbage. That isn't really garbage, it's the page's
    format and data. When you click the button, the VIEWSTATE gets posted back
    to the server so that it can be "re-rendered" back to the client with
    whatever changes are made by the button click event.

    Of course, I could be totally wrong, in which I sheepishly apologize. :)

    "Tina" <> wrote in message
    news:...
    > This message refers to the one I left an hour ago. It's another way to
    > ask a question that will help me solve my problem.
    >
    > Below is a working ASPX program. It has two buttons and a DataGrid named
    > dg on it. There is a dataadapter and an associated typed dataset that is
    > the source to the datagrid. All a very typical program. When button one
    > is pushed the grid gets filled. When button 2 is pushed dg IS STILL
    > THERE(thats good of course). Why is it still there? Each time a form is
    > used it is destroyed. What restores dg? There is no code in the " web
    > form designer generated code" that restores it. How does the dg object
    > get rebuilt?
    >
    > thanks,
    > T
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    >
    > End Sub
    >
    > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles Button1.Click
    > daCustLogin.Fill(DsCustlogin1)
    > dg.DataBind()
    > End Sub
    >
    > Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles Button2.Click
    > Dim dgItem As DataGridItem
    >
    > For Each dgItem In dg.Items
    > Dim mystring As String
    > mystring = dgItem.Cells(0).Text
    >
    > Next
    > End Sub
    >
    Terry Olsen, Sep 30, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tina

    DataGrid Won't come back

    Tina, Sep 29, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    393
  2. hiwa

    Come back physci.org !

    hiwa, Jan 11, 2006, in forum: Java
    Replies:
    7
    Views:
    409
  3. JDS

    Luigi come back!

    JDS, Oct 7, 2005, in forum: HTML
    Replies:
    22
    Views:
    890
    Blinky the Shark
    Oct 11, 2005
  4. Kamus of Kadizhar

    "Do this, and come back when you're done"

    Kamus of Kadizhar, Dec 13, 2003, in forum: Python
    Replies:
    11
    Views:
    636
    Nick Vargish
    Dec 15, 2003
  5. Tina

    DataGrid Won't come back

    Tina, Sep 29, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    5
    Views:
    126
Loading...

Share This Page