1
Answer

Convert int Date to full name in Eval

Marius Vasile

Marius Vasile

Sep 15
350
1

I get month as integer from a Stored Procedure and I am some how forced to have it as integer but in View I want to display month name

<asp:TextBox ID="TextBox1" class="form-control" runat="server" Text='<%#(Eval("Month"))%>' Style="font-size: 9px;" />

I tried with 

<asp:TextBox ID="TextBox1" class="form-control" runat="server" Text='<%#Convert.ToDateTime(Eval("Month")).ToString("MMMM")%>' Style="font-size: 9px;" />

but I get error

Invalid cast from 'Int32' to 'DateTime'.

How it should be done?

Answers (1)