aspxtreme

DataGrid Control Syntax

ASP.NET Syntax   ASP.NET Syntax for Web Controls


ButtonColumn

Use the ButtonColumn class to create a command button that corresponds with each row in the DataGrid control.

<asp:DataGrid id="accessID" runat="server"
   AutoGenerateColumns=false
   ...

   <Columns>

     <asp:ButtonColumn
       ButtonType = "LinkButton | PushButton"
       CommandName = "CommandName"
       DataTextField = "DataSourceField for Button Caption"
       DataTextFormatString = "FormatString"
       Text = "ButtonCaption" />

   ....

   </Columns>

</asp:DataGrid>

ButtonColumn Properties


Property Description
ButtonType What type of button to render. The default is LinkButton.

When programming, this property is set using the ButtonColumnType Enumeration.

CommandName A string indicating the command that is sent when a button in the column is clicked. This string is available in the event-handling method through the CommandSource property of the e event argument object.
DataTextField The field name from the DataSource that is bound to the Text property of the button in the ButtonColumn.
DataTextFormatString A formatting expression string that specifies how the field is displayed in the cell.
Text The caption to display on the face of the button in this column. If DataTextField is set, it overrides this value.

For an example of using a ButtonColumn control, see Adding Button Columns to a DataGrid Web Server Control.

For additonal information, see the ButtonColumn Class documentation.


Books and more ...


Suggested Reading

Need a break ?


More ...
Back to top

Check out related books at Amazon

© 2000-2008 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support aspxtreme