RowDataBound VS RowCreated

RowCreated is fired when the html-controls for a row are created. For example the controls you specify in templates, such as a textbox or a dropdownlist. Databinding has not yet taken place. After RowDataBound the databound-controls are filled with the actual values. For example a bound SelectedValue property of a DropDownList is set. In this eventhandler you could change these values if needed. Above that you could for example change properties of non-databound controls but this can also be done in the RowCreated eventhandler. Most of the time I use the DataBound event. The only moment I use the Created event is when I need to populate a DropDownList with Items. Otherwise databinding would fail.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s