Jump to content

Recommended Posts

When you use ASP, you either write your code in JScript or VBScript. If you chose JScript, you can use those links (JScript is essentially the same as JavaScript, only Microsoft developed it). If you chose VBScript, then I can't really help you. If you don't know what you are working in, paste some code and I'll tell you. You might also be able to see something at the top that says one of these:<% @LANGUAGE="JScript" %>or <% @LANGUAGE="VBScript" %>That will also tell you what you're working with.

Link to post
Share on other sites

Ok. Anyway, how could I use javascript in formating my data in the repeater. I have included my repeater code here. :)

<asp:repeater id="rptOrders" runat="server"><ItemTemplate><tr><td align="center"><%# DataBinder.Eval(Container.DataItem,"fnl_datectd")%></td><td align="center"><a href='orderdetails.aspx?id=<%# DataBinder.Eval(container.dataitem,"fnl_id") %>'><%# container.dataitem("fnl_orderno") %></a></td><td>      $<%# DataBinder.Eval(container.dataitem,"TOTAL") %></td><td align="center"><%# DataBinder.Eval(container.dataitem,"fnl_stat") %></td></tr></ItemTemplate></asp:repeater>

Link to post
Share on other sites

Ahh.. you're working in ASP.NET. Which means you probably are not using JScript, and hopefully not VB.NET (if you are, you have my sympathy).Look on the top of the page, and look for this:<%@ Page Language="xxx" %>Tell me what the 'xxx' part is on your page.There are several built-in converters in .NET, but I'm not much of a .NET pro. But I've got a book sitting next to me, so if I can help you I will.

Link to post
Share on other sites

OK, like I said, I'm not that great with .NET but I'll see what I can do.First, you need to import the VB namespace, so add this to the top of your page:

<% @Import Namespace="Microsoft.VisualBasic" %>

Then when you have your date here:

<%# DataBinder.Eval(Container.DataItem,"fnl_datectd")%>

I'm not quite sure how to format the code, but I think it should be something like this:

<%# String.Format("{0:d}", DataBinder.Eval(Container.DataItem,"fnl_datectd"))%>

Again, I'm totally clueless if that is even correct syntax. Here is a page for reference:http://www.aspfaqs.com/ASPScripts/PrintFAQ.asp?FAQID=181

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...