GridViewDesigner::GetDesignTimeHtml Method ()
Gets the markup that is used to render the associated control at design time.
Assembly: System.Design (in System.Design.dll)
The GetDesignTimeHtml() method does the following:
Sets the AutoGenerateColumns property of the control to true, if the Columns property is empty.
Sets the DataKeyNames property of the control to null, if the schema of the data source cannot be obtained.
Refreshes the TypeDescriptor object to force the PreFilterProperties method to be called.
Calls the base method to generate the markup.
Notes to Inheritors:
If you override the GetDesignTimeHtml method, be sure to call the base method, because it eventually, through several override levels, calls on the GridView control or a copy of the control to generate the markup.
The following code example shows how to override the GetDesignTimeHtml method in a class that is inherited from the GridViewDesigner class to change the appearance of the GridView control at design time. The example adds a new first row to the grid to contain the Caption property, if the Caption is defined. If the BorderStyle property of the control that is derived from the GridView class has the NotSet or None value, the GetDesignTimeHtml draws a blue dashed border around the control to make its extent more visible. It does not change the run-time appearance of the control.
Available since 2.0