Venkat
Venkat

Reputation: 81

What is the use of InsertVisible property of BoundField in a GridView

Can any one explain to me what the use of "InsertVisible" property of BoundField in a GridView is and at what conditions we should use it? I have seen the description on msdn.com but I am not able to understand exactly.
Thanks in advance.

Upvotes: 7

Views: 8613

Answers (1)

Josh Darnell
Josh Darnell

Reputation: 11433

The GridView control is not designed for inserting data. Thus, this explanation is more applicable to a DetailsView or a FormView.

When you put a databound control into "insert mode", it turns all of the BoundFields into user input controls (TextBoxs, CheckBoxs, etc) by default. InsertVisible allows you to change this as follows:

  • InsertVisible = true: A user-input control will be generated. This allows a user to enter a value for that field into your datasource.
  • InsertVisible = false: A user input control is not to be generated, thus the user is not given the opportunity to enter a value.
    • This is especially useful if you plan to programatically fill out that field (with an auto-generated ID or some calculated value).

Here is the MSDN article as a reference (I realize you mention that you read the article, this is just for the sake of completeness).

Upvotes: 7

Related Questions