Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass the value in to next page 1

Status
Not open for further replies.

yosie2007

Technical User
Jun 23, 2007
46
US
I have a gridview with checkboxes and I would like to take the checked boxes value to the next page. I have a click button and I donot know how to tie RowDataBound event with a click event. thanks for the help



Protected Sub gvPlansProposal_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvPlansProposal.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim cb As New CheckBox
cb = e.Row.FindControl("CheckBox1")

If cb.Checked Then
'add the values you want from e.Row.Cells(index#).Text to some collection
'then add to a session var. which will be available to you on the next page
End If
End If
End Sub


Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click

End Sub
End Class
 
What is your question..? You basically have the idea aleady. Not sure what you are asking.
 
thank you Jbenson001 for your reply. my question is how to pass the values from the first page when the check box is clicked to the page where the user fill the form to order our products. I do not think i can include this gvPlansProposal_RowDataBound

in the btnNext_click event

thank you for the help
 
You will have to loop through each row of the gridview, on a button click, for example, and use the same logic you have posted. eg. Use FindControl to get the checkbox, then check if it is checked and then pass along.
 
I really thank you for the help. I want the value of this column to be passed how can I do that




<asp:BoundField DataField="sp" HeaderText="S.P. Number" SortExpression="sp" >
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>




Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click
Dim row As GridViewRow

For Each row In gvPlansProposal.Rows
Dim cb As CheckBox = CType(row.FindControl("CheckBox1"), CheckBox)

'To check if CheckBox is checked.
If (cb.Checked) Then
dim test as String =
'do something
End If
Next
End Sub
 
Add the checked value to a session variable or add it to a collection that then is added to a session variable.
 
I am still confused...can you show me how I can do this. I really appreciate your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top