Sunday, January 9, 2011

Display Gridview data in Upper case using RowDataBound event


You just need to add RowDataBound event. In which you have to set all text data  in upper case.
.aspx code:
    <asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound">
    </asp:GridView>
.aspx.cs code :
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
         for (int i = 0; i < e.Row.Cells.Count; i++)
        {
             e.Row.Cells[i].Text = e.Row.Cells[i].Text.ToUpper();
        }
     }

2 comments: