Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I have gridview with check box , which is loaded the menu from database.
I try to store menuid as array based on group

for example. I have 10 menu in Gridview. I select only 6 menu out of 10
I need check box value capture only.

1.Subscription
2.customer service
3.Reports
4.Renewal Form
5.Registration
6.Refund
7.complains Log
8.Reports By Agent
9.Payment Summary
10.Detailed Transaction Report

if i select 1,5,6,8,9,10 I need the value in text box like 10001101111

checked value = 1 and unchecked value = 0

Pls advice me

Maideen
Posted
Comments
Suvendu Shekhar Giri 13-Aug-15 0:33am    
Anything you have tried so far?
Maideen Abdul Kader 13-Aug-15 0:49am    
Hi
I have tried. But nothing happend

Dim ch As CheckBox
For i As Integer = 0 To GridView1.Rows.Count - 1
ch = CType(GridView1.Rows(i).Cells(0).FindControl("chk"), CheckBox)
If ch.Checked = True Then
Me.txtPrivCode.Text = 1
ElseIf ch.Checked = False Then
Me.txtPrivCode.Text = 0

End If
Next

pls advice me

1 solution

May be you have missed just to append the new value to old value in the loop. Try this-
VB
Dim ch As CheckBox
For i As Integer = 0 To GridView1.Rows.Count - 1
ch = CType(GridView1.Rows(i).FindControl("chk"), CheckBox)
If ch.Checked = True Then
Me.txtPrivCode.Text += "1"
ElseIf ch.Checked = False Then
Me.txtPrivCode.Text += "0"

End If
Next


Hope, it helps :)
 
Share this answer
 
v3
Comments
Maideen Abdul Kader 13-Aug-15 1:45am    
Mr.Giri
Thanks.
But nothing happened

Pls advice me
maideen
Suvendu Shekhar Giri 13-Aug-15 1:53am    
Can you check the updated solution now?

Removed ".Cells(0)"
Maideen Abdul Kader 13-Aug-15 2:02am    
Thank You Mr.Giri
Now working. Thank you again
maideen
Suvendu Shekhar Giri 13-Aug-15 2:05am    
Glad that it helped :)

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