Add a function to a ButtonColumn

Jackpanel

Freshman
Joined
Feb 23, 2004
Messages
35
I have a Datagrid that I'm using to list product quantity and descriptions, with ButtonColumns used to make them links to display the full details page. My problem is that some of the descriptions are blank (such as a newly created record), so there is no link displayed in those Description fields. I have a GetDescription function created to return a "-------" string for the users to click on if the description is blank, but can't figure out how to add the function to the ButtonColumn.

Code:
<asp:DataGrid id="ItemGrid" runat="server" showheader="false"
AutogenerateColumns="False" OnSelectedIndexChanged="ItemSelected"
DataKeyField="ID">
<Columns>
<asp:ButtonColumn DataTextField="Quantity" CommandName="select">
</asp:ButtonColumn>
<asp:ButtonColumn DataTextField="Description" CommandName="select">
</asp:ButtonColumn>
</Columns>
</asp:DataGrid>

Essentially what I need is a way to do this : DataTextField="GetDescription(Description)". Is there a syntax that allows this, or can bound columns only display unfiltered data directly from the recordset?
 
Back
Top