DataBinder.Eval用法范例

<asp:TemplateColumn HeaderText="CompanyName" ItemStyle-Width="240px">
         <ItemTemplate>
          <%#DataBinder.Eval(Container.DataItem,"CompanyName")%>
         </ItemTemplate>
         <EditItemTemplate>
          <radcb:RadComboBox
           DataSource='<%# LoadCompanyNames() %>'
           DataTextField="CompanyName"
           ExternalCallBackPage="ComboStreamer.aspx"
           EnableLoadOnDemand="True"
           Skin="WindowsXP"           
           id="RadComboBox1"
           Runat="server"
           Height="140px"
           Width="150px">
          </radcb:RadComboBox>
         </EditItemTemplate>
</asp:TemplateColumn>


//<%# DataBinder.Eval(Container.DataItem, "UnitPrice", "${0:F2}") %> 

//{0:G}代表显示True或False
//<ItemTemplate>
//     <asp:Image Width="12" Height="12" Border="0" runat="server"
//            AlternateText='<%# DataBinder.Eval(Container.DataItem, "Discontinued", "{0:G}") %>'
//            ImageUrl='<%# DataBinder.Eval(Container.DataItem, "Discontinued", "~/images/{0:G}.gif") %>' />
// </ItemTemplate>

//转换类型
 ((string)DataBinder.Eval(Container, "DataItem.P_SHIP_TIME_SBM8")).Substring(4,4)

{0:d} 日期只显示年月日
{0:yyyy-mm-dd} 按格 

你可能感兴趣的:(DataBinder.Eval用法范例)