Click here to Skip to main content
14,735,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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")


  mycheckboxvalue  =  0

ShowError("here error displayed ")

End If

Return myString
Updated 4-Jun-13 13:43pm

1 solution

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.

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