|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Why doesn't work DataFormatString for GridView.BoundField ?works. Why is it so? <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1"> <PagerSettings Mode="NumericFirstLast" /> <Columns> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" > <ItemStyle Width="100px" /> </asp:BoundField> <asp:BoundField DataField="_Group" HeaderText="_Group" SortExpression="_Group" /> <asp:BoundField DataField="SubGroup" HeaderText="SubGroup" SortExpression="SubGroup" /> <asp:BoundField DataField="_Order" HeaderText="_Order" SortExpression="_Order" DataFormatString="{0:#,###.##}" /> <asp:BoundField DataField="Item" HeaderText="Item" SortExpression="Item" /> <asp:BoundField DataField="DateCreated" HeaderText="DateCreated" SortExpression="DateCreated" DataFormatString="{0:d}" /> <asp:BoundField DataField="DateModified" HeaderText="DateModified" SortExpression="DateModified" /> <asp:BoundField DataField="Value" HeaderText="Value" SortExpression="Value" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [config]"> </asp:SqlDataSource> </div> </form> </body> </html> Actually I found already why?
If someone wants to know here's the article http://www.netomatix.com/development/GridViewDataFormatting.aspx Show quoteHide quote "Pavel" wrote: > I have this code below and no format I put in property DataFormatString > works. Why is it so? > > <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" > Inherits="_Default" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml" > > <head runat="server"> > <title>Untitled Page</title> > </head> > <body> > <form id="form1" runat="server"> > <div> > <asp:GridView ID="GridView1" runat="server" AllowPaging="True" > AutoGenerateColumns="False" > DataKeyNames="ID" DataSourceID="SqlDataSource1"> > <PagerSettings Mode="NumericFirstLast" /> > <Columns> > <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" > ReadOnly="True" > SortExpression="ID" > > <ItemStyle Width="100px" /> > </asp:BoundField> > <asp:BoundField DataField="_Group" HeaderText="_Group" > SortExpression="_Group" /> > <asp:BoundField DataField="SubGroup" HeaderText="SubGroup" > SortExpression="SubGroup" /> > <asp:BoundField DataField="_Order" HeaderText="_Order" > SortExpression="_Order" DataFormatString="{0:#,###.##}" /> > <asp:BoundField DataField="Item" HeaderText="Item" SortExpression="Item" > /> > <asp:BoundField DataField="DateCreated" HeaderText="DateCreated" > SortExpression="DateCreated" DataFormatString="{0:d}" /> > <asp:BoundField DataField="DateModified" HeaderText="DateModified" > SortExpression="DateModified" /> > <asp:BoundField DataField="Value" HeaderText="Value" > SortExpression="Value" /> > </Columns> > </asp:GridView> > <asp:SqlDataSource ID="SqlDataSource1" runat="server" > ConnectionString="<%$ ConnectionStrings:ConnectionString %>" > ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" > SelectCommand="SELECT * FROM [config]"> > </asp:SqlDataSource> > > </div> > </form> > </body> > </html> > Yup, to summarize. HtmlEncode should be false.
Show quoteHide quote "Pavel" <pavelmagic***@yahoo.ca> wrote in message news:F0CB32B3-C6C2-46C8-8DE4-4135BE0858C8@microsoft.com... > Actually I found already why? > If someone wants to know here's the article > http://www.netomatix.com/development/GridViewDataFormatting.aspx > > "Pavel" wrote: > >> I have this code below and no format I put in property DataFormatString >> works. Why is it so? >> >> <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" >> Inherits="_Default" %> >> >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> >> >> <html xmlns="http://www.w3.org/1999/xhtml" > >> <head runat="server"> >> <title>Untitled Page</title> >> </head> >> <body> >> <form id="form1" runat="server"> >> <div> >> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" >> AutoGenerateColumns="False" >> DataKeyNames="ID" DataSourceID="SqlDataSource1"> >> <PagerSettings Mode="NumericFirstLast" /> >> <Columns> >> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" >> ReadOnly="True" >> SortExpression="ID" > >> <ItemStyle Width="100px" /> >> </asp:BoundField> >> <asp:BoundField DataField="_Group" HeaderText="_Group" >> SortExpression="_Group" /> >> <asp:BoundField DataField="SubGroup" HeaderText="SubGroup" >> SortExpression="SubGroup" /> >> <asp:BoundField DataField="_Order" HeaderText="_Order" >> SortExpression="_Order" DataFormatString="{0:#,###.##}" /> >> <asp:BoundField DataField="Item" HeaderText="Item" SortExpression="Item" >> /> >> <asp:BoundField DataField="DateCreated" HeaderText="DateCreated" >> SortExpression="DateCreated" DataFormatString="{0:d}" /> >> <asp:BoundField DataField="DateModified" HeaderText="DateModified" >> SortExpression="DateModified" /> >> <asp:BoundField DataField="Value" HeaderText="Value" >> SortExpression="Value" /> >> </Columns> >> </asp:GridView> >> <asp:SqlDataSource ID="SqlDataSource1" runat="server" >> ConnectionString="<%$ ConnectionStrings:ConnectionString %>" >> ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" >> SelectCommand="SELECT * FROM [config]"> >> </asp:SqlDataSource> >> >> </div> >> </form> >> </body> >> </html> >>
Global resources not localized on IIS
How can validator code get the FormView data object Using Custom Control in a FormView Validation Groups and Wizard step How to know the selected row in a DataControlField DetailsView Default Mode Why can't I get the FormView control's Paging controls to show? Have validators take up no space if control is valid site maps & menu control Customising the CatalogZone class |
|||||||||||||||||||||||