gridview中的CheckBox选择 [英] CheckBox selection in gridview

查看:84
本文介绍了gridview中的CheckBox选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个gridview,每个项目都有一个复选框列表,现在我需要一个逻辑,如果我选择一个复选框并单击提交按钮弹出一条消息,如果我再次看到gridview的复选框,我会在点击按钮时收到一些消息,如果我没有选择gridview中的任何复选框,我会在标签中收到一条错误消息,说明请选中复选框下载或我的标签中的其他内容。



Hi ,

I have a gridview having a checkbox list against each item , now i need a logic such that if i select a single checkbox and click on submit button a message pop up and if i all the checkbox of the gridview again i get some message on click of the button and if i did not select any checkbox in the gridview i will get an error message in label stating that please select the checkbox to download or something else in my label.

Dim checkboxSelected As Boolean = Mygridview.SelectedIndexes.Count > 0

Dim mycheckboxvalue As Integer = If(checkboxSelected, Mygridview.SelectedDataRow("column_name"), 0)

Dim myString As String = ""

If ( checkboxSelected = true )  Then

For Each row In Mygridview.SelectedDataRows

mycheckboxvalue = row("column_name")

myString &= "  IIf(checkboxSelected, "0", "1")

Next
    Else

  mycheckboxvalue  =  0

ShowError("here error displayed ")

End If

Return myString

推荐答案

您为此实现的代码似乎足够准确。

如果您遇到一些问题,只需调试它,也许你将能够解决问题。
The code you have implemented for this seems to be accurate enough.
If you are facing some issues, just debug it and perhaps you will be able to solve the problem.


这篇关于gridview中的CheckBox选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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