473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

selecting multiple records in checkbox

34
hey all..

i have a gridview with a checkbox in ItemTemplate..
what i have already done is when i select any checkbox, it will direct me to another page.
That other page contains a reminder letter in which i can just print it..

But now i want to be able to select several checkbox and just print those letters..

How can i achieve this?
using VB.NET
Aug 6 '08 #1
3 1071
Curtis Rutland
3,256 Expert 2GB
Perhaps you can add the link or whatever key value each entry is based off of to an array or list. Then add that list to a session variable. Then redirect to another page that loops through the array, and renders each of the "reminders" or whatever on a single page for you to print.

That's probably what I'd do. Considering I haven't seen your code. It's kind of a vague question.
Aug 6 '08 #2
mirainc
34
Perhaps you can add the link or whatever key value each entry is based off of to an array or list. Then add that list to a session variable. Then redirect to another page that loops through the array, and renders each of the "reminders" or whatever on a single page for you to print.

That's probably what I'd do. Considering I haven't seen your code. It's kind of a vague question.
Expand|Select|Wrap|Line Numbers
  1. //Destination page
  2. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  3.         'AddressEcc labels
  4.         Label10.Text = Request.QueryString("Name")
  5.         Label11.Text = "Admission No: " + Request.QueryString("Adm_No")
  6.         'Display the value of Hidden column in a label control
  7.         Label12.Text = Request.QueryString("TermAdd1")
  8.         Label13.Text = Request.QueryString("TermAdd2")
  9.         Label14.Text = Request.QueryString("TermCountry") + " " + Request.QueryString("TermPostCo")
  10.         Label27.Text = Request.QueryString("TermAdd3")
Expand|Select|Wrap|Line Numbers
  1. //Source page
  2. Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
  3.         Dim gvr As GridViewRow = DirectCast(DirectCast(sender, CheckBox).Parent.Parent, GridViewRow)
  4.         Dim cb As CheckBox = DirectCast(sender, CheckBox)
  5.         Dim row As GridViewRow = DirectCast(cb.NamingContainer, GridViewRow)
  6.         If row IsNot Nothing Then
  7.             Dim key As String = AddressGridView.DataKeyNames(0)
  8.             Dim TermAdd1 As String = DirectCast(AddressGridView.DataKeys(row.RowIndex).Values("TermAdd1"), String)
  9.             Dim TermAdd2 As String = DirectCast(AddressGridView.DataKeys(row.RowIndex).Values("TermAdd2"), String)
  10.             Dim TermAdd3 As String = DirectCast(AddressGridView.DataKeys(row.RowIndex).Values("TermAdd3"), String)
  11.             Dim TermCountry As String = DirectCast(AddressGridView.DataKeys(row.RowIndex).Values("TermCountry"), String)
  12.             Dim TermPostCo As String = DirectCast(AddressGridView.DataKeys(row.RowIndex).Values("TermPostCo"), String)
  13.  
  14.             Dim Adm_No As String = gvr.Cells(2).Text
  15.             Dim Name As String = gvr.Cells(3).Text
  16.             Response.Redirect("~\Reminder letter\ReminderLetter(ECC-BULK).aspx?Adm_No=" + Adm_No + "&Name=" + Name + "&TermAdd1=" + TermAdd1 + "&TermAdd2=" + TermAdd2 + "&TermCountry=" + TermCountry + "&TermPostCo=" + TermPostCo + "&TermAdd3=" + TermAdd3)
  17.         End If
  18.  
  19.     End Sub
can guide on using the array in VB.NET?
Aug 6 '08 #3
Curtis Rutland
3,256 Expert 2GB
Well, you might have to write another destination page. Can you get all the data again from a key value in the gridview? If you can, that makes this pretty easy. If not, it will be a little bit more work.

It's going to take some changing. You can't do auto post back on your checkboxes. You need to add a button to click when you've selected the check boxes you want.

Then, in that button's event:
If you have some key data, like an id number or something, just use a List. Make sure you put
Expand|Select|Wrap|Line Numbers
  1. Imports System.Collections.Generic
  2.  
at the very top of the code. Then use a List:
Expand|Select|Wrap|Line Numbers
  1. Dim lst as List(of Int32)
  2.  
and loop through your gridveiw, adding the key value to the list each time.

Then add the list to a session variable, and on your destination page, loop through it to build a sql statement to select the rows you need. You can use a repeater to display each row.
Aug 6 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Ralph Freshour | last post by:
I'm using MySQL to display data on a web page - fitting about 10 records of data per screen - I'm including a checkbox with each record so that I can check it and when the submit button is clicked...
8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
1
by: mellie | last post by:
Hi there, SQL 2000 database with ASP I've found many things "out there" regarding updating and deleting multiple records with checkboxes but I can't seem to find anything about adding them. ...
1
by: Eric | last post by:
Hi all, I have a form that generates a dynamic number of rows from a value passed in via querystring. I have a one static row in my form with a "master" checkbox that I have deemed "Select...
4
by: Dave Parrin-Bull | last post by:
Hi all, I have been asked (nay told!) to do a quiz for a webpage at work, now I can do the basic things like getting the radio boxes up there and assign values to them but here is what they...
1
by: sneha123 | last post by:
There will be some 20 questions and for each question there will be 4 choices.what i want to do is to select multiple answers by clicking the checkbox. i m using asp.net,vb.net pls help me we...
1
by: Bob Loveshade | last post by:
I am looking for an example that shows how to select and highlight multiple rows in a DataGrid. My DataGrid is part of a Web User Control which is contained in an ASPX page. I haven't been...
10
by: chimambo | last post by:
Hi All, I have a little problem. I am retrieving records from a table and I want to update the records using checkboxes. I am able to display the database record quite alright and I have created...
8
by: jmarcrum | last post by:
Hello all, i have a continuous form that displays about 1000 records and opens when I click a button. When the form opens, the user has the option of checking a checkbox that is located beside...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.