Search This Blog

Tuesday, July 26, 2011

transfer variable from gridview to another page

Hello all,

I am trying to transfer some variables to another page for editing. I am having troubles with the checkboxes.





GridView1.Rows(e.NewEditIndex).Cells(12).Text & "~/~" & _




is a checkbox and when passed and split it comes up as a empty string. I know there has to be a way to do this.


This is the view side, triggered on a buttonpress.





 Private Sub gridview1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Session("wr_id") = GridView1.Rows(e.NewEditIndex).Cells(2).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(3).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(4).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(5).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(6).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(7).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(8).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(9).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(10).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(11).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(12).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(13).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(14).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(15).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(16).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(17).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(18).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(19).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(20).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(21).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(22).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(23).Text & "~/~" & _
GridView1.Rows(e.NewEditIndex).Cells(24).Text & "~/~"

Response.Redirect("WorkEdit.aspx")
End Sub




Variables transferred page





If Not Page.IsPostBack Then

'Get session info
lblID.Text = "Session Variable Was Lost"
If (Session("wr_id") <> "") Then
Dim strSession As String = Session("wr_id")
Dim sessionArray As Array
'split session into array at ~/~
sessionArray = Split(Session("wr_id"), "~/~")
'assign textbox/dropdowns values passed from split variables
lblID.text = sessionArray(0)
WOName.Text = sessionArray(1)
Location.Text = sessionArray(2)
LegalDesc.Text = sessionArray(3)
TransADDED.Text = sessionArray(4)
TransRETIRED.Text = sessionArray(5)
Description.Text = sessionArray(6)
Started.Text = (CType((sessionArray(7)), DateTime).ToString("MM/dd/yyyy HH:mm tt"))
Completed.Text = (CType((sessionArray(8)), DateTime).ToString("MM/dd/yyyy HH:mm tt"))
StakedBy.SelectedValue = sessionArray(9)
CCode.SelectedValue = sessionArray(10)
ArmsCheck.Text = (CType((sessionArray(12)), DateTime).ToString("MM/dd/yyyy HH:mm tt"))

End If
End If




The sessionArray(11) = “” when rendered and i’m looking for True/False since it is a checkbox. Any help would be appreciated.

http://bit.ly/ofIjTj

No comments:

Post a Comment