the In Dynamic Data you would get a checkbox automatically if the entity type for that column is of type Boolean. if you want to be able to check any row and update the underlying entity without going into edit mode for that row I believe with DD you will
have to add a custom Colum template like this:
you will then need to handle the checkbox changed event.
The gridview is designed to work via data binding if you are wanting to have the data updated on checkbox change then you may be better looking at a client side framework like Angular or some such.
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
None
0 Points
1 Post
Make a checkbox clickable and updateable on grid view Dynamic Data
Jul 27, 2016 04:12 PM|Mohsinkhan93|LINK
How do i make a checkbox “is update” clickable on grid view and when user check or uncheck the check box then field in database should update?
Contributor
2155 Points
2142 Posts
Re: Make a checkbox clickable and updateable on grid view Dynamic Data
Jul 27, 2016 08:50 PM|march11|LINK
Well your jumping a little ahead with the Gridview, but you can handle this in the Click event of the check box,
You will need to read the Gridview row to get the info needed to update the database.
Make certain that the check box property Enable Postback is set to True.
This should get you started.
You will need to add a FindControl something like this to get the check box then test for its value....
Dim chkBox As CheckBox = DirectCast(row.FindControl("chkSelected"), CheckBox)
Do this inside a loop that iterates over each Griddview row.
For Each dr In GridView1.Rows
All-Star
17652 Points
3510 Posts
Re: Make a checkbox clickable and updateable on grid view Dynamic Data
Jul 28, 2016 06:37 AM|Chris Zhao|LINK
Hi Mohsinkhan93,
You could use CheckBox.CheckedChanged Event.
Best Regards,
Chris
All-Star
17916 Points
5681 Posts
MVP
Re: Make a checkbox clickable and updateable on grid view Dynamic Data
Jul 28, 2016 10:45 AM|sjnaughton|LINK
the In Dynamic Data you would get a checkbox automatically if the entity type for that column is of type Boolean. if you want to be able to check any row and update the underlying entity without going into edit mode for that row I believe with DD you will have to add a custom Colum template like this:
this code goes in the <Columns> collection.
you will then need to handle the checkbox changed event.
The gridview is designed to work via data binding if you are wanting to have the data updated on checkbox change then you may be better looking at a client side framework like Angular or some such.
Always seeking an elegant solution.