Re: some databinding techniqes neede using in listview -

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Comments inline:

mesut wrote:
Hi colleagues,

I hope someone have experience with these databinding techniques in
aspx... and can explain me the reason?

I've got a listview and I would like to fix these #3 problems just to
learn how to do it...

can someone help me what is wrong in my code? I won't get squeezed
line or whatever.. so the syntax looks correct.

( 1 )
this works
<td><%# ((DateTime)Eval("DeliveredDate")).ToShortDateString()%></td>

I would like to do - put date in dd-MMM-yyy
<td><%# ((DateTime)Eval("DeliveredDate")).ToShortDateString("dd-MMM-
yyyy")%></td>

result: CS1501: No overload for method 'ToShortDateString' takes '1'
arguments.
why? how can I get dd-MMM-yyy?????


The function ToShortDateString will return a predefined formatted string. You want to use toString(format String) to return the format you want. The applicable format strings for date are found at

http://msdn.microsoft.com/en-us/library/az4se3k1.aspx




( 2 )
this works
<td><%# GetCityDescription("Amsterdam")%></td>

I would like to pass in by Eval("flexible city here")
<td><%# GetCityDescription(Eval("City"))%></td>

result: GetCityDescription(string)' has some invalid arguments

NOTE: GetcityDescription is a protected function in code behind...

why can't I use Eval?????? how can I fix this?


Not close to VS at present but you want to look for page methods as the cure for this problem.


( 3 )
this works <td><%# Eval("OrderDate").ToString()%></td>
but I would like to get in dd-MMM-yyyy
<td><%# Eval("OrderDate").ToString("dd-MMM-yyyy")%></td>

I get this error: CS1501: No overload for method 'ToString' takes '1'
arguments

You need to cast "OrderDate" to a date to be able to use the format string (see above for applicable string values"




Can someone explain me why I get these errors? I mean why can't I do
these? I would like to understand the reason??


the last thing maybe in the dates what happens if the fields contains
null or are blanks (no date in the table) will that dump? How can I
avoid this than too :)

thanks
mesut


LS
.



Relevant Pages

  • Re: Controlling Javascript from server side
    ... but five different language implementations here. ... 'true' means that the request must be handled asynchronously. ... There is exactly *no* reason for such a thing here. ... | percent-endoded string). ...
    (comp.lang.javascript)
  • Re: Is that a good design?
    ... I would have been able to reason the first gotcha. ... public string FirstName; ... has a reference architecture that shows the use of patterns. ... Public Shared Function GetUserInstance() As User ...
    (microsoft.public.dotnet.framework)
  • Re: packagemaker script assistance needed.
    ... Is there a reason you're conditionalizing the whole block instead of one ... string will do as you want.) ...
    (comp.sys.mac.programmer.help)
  • Re: Allow Zero Length String Property - 2000 vs 2003
    ... Well, if that was the reason, I believe my second point still stands - ... Web Interfaces do empty strings. ... > "Brendan Reynolds" <brenreyn at indigo dot ie> wrote in message ... >> Are you the same person who posted the 'Allow Zero Length String in MS ...
    (microsoft.public.access.tablesdbdesign)
  • Re: a method to make js have the ability to inherit
    ... but without the implied type-conversion of the string ... that uses the name of a specific constructor. ... programmer has no idea at all what types of object they are ... no reason for ever doing so. ...
    (comp.lang.javascript)