Loading ...

Date is not displayinng....on web page

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  client side web development   » Date is not displayinng....on web page

Date is not displayinng....on web page

Posts under the topic: Date is not displayinng....on web page

Posted: 6/29/2011

Lurker 245  points  Lurker
  • Joined on: 4/15/2011
  • Posts: 44

I have binding date to lable control like this in gridview

<asp:Label ID="Label2" runat="server" Text='<%# Bind("jdate") %>'></asp:Label> 

but the date is not showing....


Posted: 6/29/2011

Starter 727  points  Starter
  • Joined on: 6/6/2011
  • Posts: 74
  Answered

Hi Pallavi,

Your label should be in asp:TemplateField like this:

<asp:TemplateField>
    <ItemTemplate>
        <asp:Label ID="Label2" runat="server"  Text='<%# Bind("jdate") %>'></asp:Label>
    </ItemTemplate>
</asp:TemplateField>

If Bind doesnt work for you try Eval:

<asp:TemplateField>
    <ItemTemplate>
        <asp:Label ID="Labe2" runat="server"
            Text='<%# Eval("jdate", "{0:M-dd-yyyy}") %>'></asp:Label>
    </ItemTemplate>
</asp:TemplateField>

Best Regards,

Gjorgji


tags DateTime

Posted: 6/29/2011

Professional 8505  points  Professional
  • Joined on: 5/3/2010
  • Posts: 391

 

pallavi karpe said:

 

I have binding date to lable control like this in gridview

<asp:Label ID="Label2" runat="server" Text='<%# Bind("jdate") %>'></asp:Label> 

but the date is not showing....

 

 

As Gjorgji suggested, use Eval (in your case) or Bind, if your date needs to be dislpayed in an ASP.NET Data Control.


Page 1 of 1 (3 items)