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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to work with check box and select multiple items

Status
Not open for further replies.

taree

Technical User
May 31, 2008
316
US
How can I do somthing similar to this in asp.net. I master detail page and the users have to click each link inorder to see the detail of each jobs and they have been complaining that it is taking a lot of time to go through each clik to see the detail. I am thinking to create something similar to this one and when the users select more than one check box i would like to display the infor. in one page.

here is the link:

thank you for the help
 
What's the question? It's easy enough to display a checkbox next to each item.
 
thank you jbenson001 for reply. I know it is easy to display the text box next to each item. My question is how can I pass the value from the selected check boxes to the detail page and display the information in one page. User can select one or multiple check boxes at the same time.
 
I am using gridview and working with asp.net 2.0
 
OK, you can add a checkbox column or a template column with a checkbox in it. (The template column may be eaiser to work with.)
Then have a button, link button or whatever you want that redirects them to the detail page. IN the click event of your button, loop through the rows and if the check box is checked, place the id of the row(you need an identifier of the row) to a string. Pass that list of IDs to the details page and query the data based on the ids.
 
Thank you and I will use your helpful advice and come up with some code. thank you again
 
no problem. Post back if you have more questions. IT's really not as difficult as it sounds.
 
using your advice I come up with this code and my next question is how do I pass this value(s) to the next (detail page). thank you

Protected Sub btnJobs_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnJobs.Click

Dim names As ArrayList = New ArrayList()

For Each gvRows As GridViewRow In gvItemDetail.Rows
Dim chkSelect As CheckBox = CType(gvRows.FindControl("chkSelect"), CheckBox)
If chkSelect.Checked Then
Dim ContractID As String = (gvItemDetail.DataKeys(gvRows.RowIndex)("contid"))
names.Add(ContractID)
End If
Next

End Sub
 
You can do it a few ways, in this situation, I would use a session variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top