C Sharper
C Sharper

Reputation: 8646

getting checked checkbox out of grid

I have checkboxes at grid header row.

I wanted to find checkboxes which are clicked.

My check boxes are named as :

chk1 chk2 chk3 chk4

chk is common and 1,2,3,4 gets increament per column.

To get checked box,i did following code:

For i As Integer = 0 To gvSearch.Columns.Count - 1

IF CType(gvSearch.HeaderRow.FindControl("chk"& i+1 ,CheckBox).Checked)  THEN

'some logic

END IF

Next

But, CType(gvSearch.HeaderRow.FindControl("chk"& i+1 ,CheckBox).Checked) is giving me error as:

Syntax error in cast operator;two arguments separated by comma are required.

Please help me.

Upvotes: 0

Views: 102

Answers (1)

David Sdot
David Sdot

Reputation: 2333

Your brackets are placed incorrect

CType(gvSearch.HeaderRow.FindControl("chk"& i+1),CheckBox).Checked

Upvotes: 1

Related Questions