Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1139
Format Date in Web Drop Down
posted

I'm retrieving a date value from sql and its returning the time portion as well as the date.

I just want to display the date in the drop down.

Is there something like a DataFormatString for the dropdown???

 

chuck

Parents
No Data
Reply
  • 8160
    posted

    Hello,

    one option could be to use ItemTemplate and Databinder.Eval, then put whatever you want.

    for example:

     <ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px" DataKeyFields="OrderID"
            ValueField="OrderID" DataSourceID="AccessDataSource1">
            <DropDownItemBinding KeyField="Orders" />
            <ItemTemplate>
                <%# DataBinder.Eval(Container.DataItem, "OrderDate", "{0:d}")%>
            </ItemTemplate>
        </ig:WebDropDown>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb"
            SelectCommand="SELECT [OrderID], [OrderDate] FROM [Orders]"></asp:AccessDataSource>
    

     

    Also take a look at the online samples: WebDropDown Templates

    http://help.infragistics.com/NetAdvantage/ASPNET/2011.2/CLR4.0/?page=WebDropDown_Templating.html

    Hope this helps

Children