What is the use of DataFormatString in Gridview?

 Posted by vishalneeraj-24503 on 1/14/2014 | Category: ASP.NET Interview questions | Views: 711 | Points: 40
Answer:

DataFormatString as name suggested,is used for formatting of data inside Gridview.We give DataFormatString in BoundField to format as we want like date in any format,currency and so on.

For Example:-
<asp:BoundField DataField="created_date" DataFormatString="{0:d}" HeaderText = "Created Date"/>


<asp:BoundField DataField="salary" HeaderText="Salary" DataFormatString="{0:C}" />


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response