Click here to Skip to main content
14,971,553 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have used a gridview and checkbox to select the items in the gridview....I can select the values easily...when i am selecting one row at a time then using query string i can easily pass the id of the selected row but when i am selecting multiple rows in the field,i dont know how to pass the array of integers[i.e id value to another field]

Protected Sub Gridparent_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles Gridparent.SelectedIndexChanged
    If Gridparent.Rows.Count > 0 Then

        For Each gvrow As GridViewRow In Gridparent.Rows
            Dim chk As CheckBox = DirectCast(row.FindControl("CheckBox2"), CheckBox)
            If chk.Checked = True Then
                Dim gid As String = DirectCast(gvrow.FindControl("lbtrans"), Label).Text
                HiddenField1.Value = gid
            End If
    End If

then at another gridview rowdatabound event where i am passing the query string i am using this code :

Dim transid As String = HiddenField1.Value
Dim wempid As String = HiddenField3.Value
Dim hyperLink = TryCast(e.Row.FindControl("HyperLink1"), HyperLink)
If hyperLink IsNot Nothing Then
    If HiddenField7.Value = 0 Then
        hyperLink.NavigateUrl = "Leaveauth.aspx?wempno=" & Request.QueryString("wempno") & "&transid=" & transid & "&wempid=" & wempid & "&keyd=" & keyd & ""
        hyperLink.Attributes.Add("class", "fancybox")
        HiddenField7.Value = 1
        'hyperLink.NavigateUrl = "#"
    End If
End If
Updated 23-Jul-13 16:56pm
_Damian S_ 23-Jul-13 22:14pm
What's your question?

1 solution

I think you have to send it as a comma separated string.

Good Luck
Mahmoud Mostafa

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900