DataGrid questions (urgent)

V

Vincent

1. In the edit mode of the datagrid, can I restrict the
max. length of data entry the editing textbox ?
eg in my database table, the length of the field is 10, I
want to make sure that user will not enter data with
length more than 10

2. I have made a template column of checkbox in
datagrid, how can I add a check all function for them ?

Thx
 
S

Saravana

Here is the answers for your question,

1 . In editmode, set the Maxlength for the Textbox in ItemDataBound event
handler.
2. Have a button in your form. when you press that button loop throught
datagrid items and check all your check box.
 
V

Vincent

I know how to loop through the dataGrid items, however,
how can I check the check box ?
 
S

Saravana

check out this code snippet,

For Each di In DataGrid1.Items

' Make sure this is an item and not the header or footer.

If di.ItemType = ListItemType.Item OrElse di.ItemType =
ListItemType.AlternatingItem Then

CType(di.FindControl("chkbox1"), RadioButton).Checked = True

End If

Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top