The CellDataBindEventArgs class is used to encapsulate the arguments passed to handlers for the CellDataBind,
HeadingCellDataBind and AggregateCellDataBind events
| All Members | Constructors | Fields | |||
| Icon | Member | Description |
|---|---|---|
| CellDataBindEventArgs()()() | Initializes a new instance of the CellDataBindEventArgs class | |
| Cell |
Reference to the cell being created
| |
| Column |
Reference to the grid column for which the cell is being created
| |
| ColumnValue |
Database value assigned to cell
| |
| Database |
Reference to data access layer
| |
| Row |
Reference to the row in which the cell is being created
|
...
<DNL:DbNetGrid
ID="DbNetGrid1"
runat="server"
ConnectionString="SamplesDatabase"
FromPart="Suppliers"
OnCellDataBind="CreateHyperlink" >
<Columns>
<DNL:GridColumn ColumnExpression="CompanyName" />
<DNL:GridColumn ColumnExpression="Address" />
<DNL:GridColumn ColumnExpression="HomePage" />
</Columns>
</DNL:DbNetGrid>
...
<script runat="server">
public void CreateHyperlinks(object sender, DbNetGrid.CellDataBindEventArgs e)
{
switch (e.Column.ColumnExpression)
{
case "HomePage":
HyperLink link = new HyperLink();
link.Target = "_blank";
link.NavigateUrl = "http://" + e.Cell.Text;
link.Text = e.Cell.Text;
e.Cell.Text = "";
e.Cell.Controls.Add(link);
break;
}
}
</script>
...