Kolags

Kolags

  • NA
  • 6
  • 0

Problem with Sessions

Feb 21 2008 3:44 AM

Hi All,

I have a datagrid with check box in each row at first column; our requirement is looks like hot mail and yahoo mail working system, after selected mail(s) using check box user can delete mail. In the same way, we would also develop functionality for edit, delete buttons only when checked row from the datagrid.

I have started like this, whenever I click on the edit button after I selected check box(s), I need to open a popup window only for the checked rows, for this I have created a session in first page and passing the parameters to second page (Popup).

 

Edit button

Dim rowCount As Integer = 0

Dim mySelection As StringBuilder = New StringBuilder

Dim DemoGridItem As DataGridItem

For Each DemoGridItem In DGWHPkg.Items

Dim myCheckbox As checkbox=CType(DemoGridItem.Cells(0).Controls(1, CheckBox)

If myCheckbox.Checked = True Then

rowCount += 1

mySelection.AppendFormat("'" & "{0}" & "'" & ",", DemoGridItem.Cells(2).Text)

End If

Next           

lblChosen.Text = mySelection.ToString().Substring(0, mySelection. ToString().Length - 1)

Session.Add ("Chosen", lblChosen.Text)

 

Popup window

If Not Page.IsPostBack Then

Dim cScript As String

cScript = "<script language='javascript'> opener.location.href = 'WebForm4.aspx'; </script>"

RegisterStartupScript("parentwindow", cScript)

lblChosen.Text = Session.Item("Chosen")

 

Now the problem is only few times the session is calling from main page to child (popup) page.

How to add the session to next page, whenever the edit button clicked?

But I am unable to do it. Please suggest me how to solve it. Guidance for Delete button too.


Answers (1)