Hi i have a datagrid with
<asp:BoundField DataField="PrenotazioneEffettuata" HeaderText="Pren. Effettuate"
SortExpression="PrenotazioneEffettuata" />
PrenotazioneEffettua开发者_如何转开发ta is a boolean field.
In the grid there is true/false value
is possible print yes/no instead of true/false?
thanks
you can make it to template field and change value in row databound event. like...
<ItemTemplate>
<asp:Label runat="server" ID="lbl"> </asp:Label>
</ItemTemplate>
Code behind
protected void yourGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRow dr = ((DataRowView)e.Row.DataItem).Row;
if(Convert.ToBoolean( dr["PrenotazioneEffettuata"]))
{
((Label)e.Row.FindControl("lbl")).Text = "Yes";
}
else
{
((Label)e.Row.FindControl("lbl")).Text = "No";
}
}
}
精彩评论