简体   繁体   中英

Literal content ('DataFormatString=“{0:D6}”') is not allowed within a 'System.Web.UI.WebControls.ListItemCollection'

i wanted to display decimal two places value in my grid and I used DataFormatString. Here is my asp.net code

  <asp:BoundField HeaderText="Value" DataField="Value" SortExpression="Value" DataFormatString"{0:F2}" />

but it is giving error

Literal content ('') is not allowed within a 'System.Web.UI.WebControls.DataControlFieldCollection'.

I'm missing the = , so change

DataFormatString"{0:F2}"

to

DataFormatString="{0:F2}"

这是因为您忘记放置=

DataFormatString="{0:F2}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM