将查询字符串中的多个选定复选框值传递给另一个页面 [英] passing multiple selected checkbox values in query string to another page ?

查看:47
本文介绍了将查询字符串中的多个选定复选框值传递给另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了gridview和复选框来选择gridview中的项....我可以轻松选择值...当我一次选择一行然后使用查询字符串我可以很容易地传递id选中的行,但是当我在字段中选择多行时,我不知道如何传递整数数组[即id值到另一个字段]



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
        Next
    End If

< br $> b $ b



然后在另一个gridview rowdatabound事件中我传递查询字符串我正在使用此代码:






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
    Else
        'hyperLink.NavigateUrl = "#"
    End If
End If

推荐答案



我认为你必须把它作为逗号分隔的字符串发送。



祝你好运

Mahmoud Mostafa
Hi,
I think you have to send it as a comma separated string.

Good Luck
Mahmoud Mostafa


这篇关于将查询字符串中的多个选定复选框值传递给另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆