Use Checkbox in Grid templetefield

we can esily use checkbox into templetefiled in grid control. If you use Mysql, it is better to use field data type as bit. Again you can also use text type where you store value like YES/NO.

Now, please go to the page source view. Add a new template field in the grid like below,

Here check box is not two way binding. you can not use Bind. so you need some care in the time inserting. Write below code in grid view RowUpdating event,

// in grid row updating event
e.NewValues["isZoomToExtent"]= ((CheckBox)GridView1.Rows[GridView1.EditIndex].FindControl("editChkIsZoomToExtent")).Checked;

All is done, you can now enjoy the output

GIS Programmer, CEGIS


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s