Results 1 to 2 of 2

Thread: How to retrieve a stored session of datagrid?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    24

    How to retrieve a stored session of datagrid?

    In my asp.net web form [findstores.aspx.vb], I saved a session for the datagrid to Session("StoreListSession") = dvStorelist. After user clicked "Apply this job!" button (a ButtonColumn) in the datagrid item, the user will be redirected to another page(OnlineApp.aspx), where the "Cancel" button on that page should bring the user back to the "findstores.aspx" page, so that user can click other items of the datagrid.

    [In "onlinapp.aspx"]
    Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
    Response.Redirect("FindCrewJobs.aspx")
    End Sub

    ** How can I get the stored datagrid session when the page is redirected to "findstores.aspx", so that user will see the original datagrid in findstores.aspx page ????


    [In "findstores.aspx.vb"]
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    If Not IsPostBack Then
    Dim State As String
    Dim ds As DataSet
    Dim dr As SqlDataReader
    State = Request.QueryString("State")

    'Generate store list from querystrings
    If Request.QueryString("State") <> Nothing Then

    ds = New DataSet
    If Not conDWDb.State = ConnectionState.Open Then
    conDWDb.Open()
    End If
    Dim cmdAddressInfo As New SqlCommand
    Dim dtrAddressInfo As SqlDataReader
    With cmdAddressInfo
    .Connection = conDWDb
    .CommandText = "Select Store_Num ,Store_Address+', '+City+', '+State+' '+Zip_Code AS Address,Store_Fax from store_table where co_code=1 and store_mgr is not null and State=@State"
    .Parameters.Add("@State", SqlDbType.Char).Value = State
    End With
    Dim adpt As SqlDataAdapter = New SqlDataAdapter(cmdAddressInfo)
    adpt.Fill(ds, "StoreList_Table")
    dgcrewstores.DataSource = ds
    Dim dvStorelist As New DataView(ds.Tables("Storelist_Table"))
    Session("StoreListSession") = dvStorelist
    dgcrewstores.DataBind()
    End If
    conDWDb.Close()
    End If
    End Sub

  2. #2
    New Member
    Join Date
    Mar 2005
    Posts
    10

    Re: How to retrieve a stored session of datagrid?

    Could you load the data from the datagrid into a hashtable then call it on load and rebind?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width