Showing posts with label date. Show all posts
Showing posts with label date. Show all posts

Saturday, March 24, 2012

Demo applications up to date?

I found the Atlas wiki demo and Dice r us demo application but they seem to be written for earlier versions of Atlas/AJAX. Will these be updated or does anyone know where there are other demo applications to be found? Also I'm looking for a demo app that shows drag & drop into a dropzone. Suggestions/Links?

you are right the demo is out of date.

actually, you can still use old demo for latest code.

you just need to know whats been change.

if you want i can send you the code for Drag & Drop demo.

i wrote the article for CollapsiblePanel, let me know if you interest


MIB426:

you just need to know whats been change.

if you want i can send you the code for Drag & Drop demo.

i wrote the article for CollapsiblePanel, let me know if you interest

Do you know what to change?

Yes please mail me, would love to take a look at it. Is it hard to do drag & drop? You can email me at dotnetslave@.yahoo.com. Thanks!!


Hi,

inthis thread you'll find an example of widgets done with the ASP.NET AJAX drag and drop engine and xml-script.

Wednesday, March 21, 2012

Default date selection, like a high-lighted box for ajaxToolkit:CalendarExtender

Hi,

Can we do this? Right now when the textbox is clicked, a calendar does pop-up with the sentence at the bottom - Today is - today's date - is there a way to select the day in month, having a blue box around it?

Thanks.

Do you mean have a default date selected in the calendar when the click in the textbox? If so, then Yes. There is aSelectedDate property you can set. You can also change the color to whatever you want using theCssClass="ClassName" and the.ajax__calendar_active property. Seehttp://www.asp.net/AJAX/AjaxControlToolkit/Samples/Calendar/Calendar.aspx for more info. If it is something else that you are trying to accomplish, let me know.

Bebandit

Default current date in Calendar

When using the Calendar extender, is there a way to put a default current date in the textbox?

Auto populate the text field of the textbox with <%# DateTime.Now.ToShortDateString() %> or make the assignment in code-behind.


I realized that I can assign in code behind but I don't want to do that, that's why I asked because I thought the calendar extender should allow me to do that easily. I can't do this, <%# DateTime.Now.ToShortDateString() %>, since this textbox is bind to a database.


I don't believe the calendar extender can do it automatically, but you could through JavaScript; though, you could also check the textbox and if nothing has been assigned after binding, then make the assignment.


bmains:

Auto populate the text field of the textbox with <%# DateTime.Now.ToShortDateString() %> or make the assignment in code-behind.

Okay, I thought I can try something like this:

<asp:TextBox ID="txtDate" runat="server" Text='<%# Bind("dateCreate", "{0:d}", DateTime.Now.ToShortDateString())%>' Width="80px"></asp:TextBox><br />   

But when compile it gave me this error:

Error 1 A call to Bind was not well formatted. Please refer to documentation for the correct parameters to Bind. E:\Website\Outlook\admin\admOLissue.aspx 110

Any othe ideas?


Hello,

I'm not sure, but I don't think Bind supports the last parameter. If that is the case, you could create a public method that takes an object as such:

public function FormatDate(objDate As Object) As String
if (objDate is Nothing orelse objDate.Equals(DbNull.Value)) then
return DateTime.Now.ToShortDateString()
else
return CType(objDate, DateTime).ToShortDateString()
end if
end function

And in the textbox:

<asp:TextBox Text='<%# FormatDate(Bind("dateCreate"))%>'


Okay, I got the following error when compiled:

Error 2 The name 'Bind' does not exist in the current context E:\Website\admOLissue.aspx 110

This error comes from this line:

<asp:TextBox Text='<%# FormatDate(Bind("dateCreate"))%>'

By the way, I'm using C#.


Try using Eval instead.


If I use Eval instead of Bind, will it bind to the database if I click on the Update button?


Updates are not based on Bind or Eval statements, but on the value in textbox, not the value passed through Bind or Eval statements... If Bind doesn't work anyway, try to see if Eval will work in that context...


Okay, that seems to fix it.Thanks so much!


Hi there,

I have tried the statement with Eval and didn't work for me. When I click on edit and the field shows the correct date. But once i click on update it doesn't show anything. Is there any other possible way of doing this?

Thanks


I'd be able to help better if you posted the relevant code. Post the control you are doing this with, as well as the parent control that it is in, and how you are updating.


I think the current date ends up in the bottom of the calendar control and you can click on it to take today's date. I know this isn't great, but with a little bit of user training, it can work. I'd prefer to be able to specify today's date to be the default date as well, but since it's not available, this is the best option I could find and not have to rig it up programmatically.


bmains:

Try using Eval instead.

Not sure why, but it's not working. The value will not get updated in the database. Code in .aspx page:

<asp:TextBox ID="txtModDate" runat="server" Text='<%# defaultDate(Eval("modDate"))%>'></asp:TextBox>

Code behind:

1public string defaultDate(Object crntDate)2 {3string currentDate = Convert.ToDateTime(crntDate).ToShortDateString();4if (!String.IsNullOrEmpty(currentDate))5 {6return DateTime.Now.ToShortDateString();7 }8else9 {10return currentDate;11 }

Here is the popup error:

Cannot insert the value NULL into the column 'modDate', table "myDB.dbo.myTable'; column does not allow nulls. INSERT fails. The statement has been terminated.

Default Calendar view set at decades

Hi,

I'm using the Calendar control for a Date Of Birth field on my form. However I would prefer the calendar to open up on the decades screen so that members will be able to tell easily what they have to do. I have a feeling that if the calendar pops up displaying October 2007 for example, the users won't realise they can click on the title to go up a level. Whereas if they start on 2000-2009 its more easier to understand.

Thanks,

Curt.

Sorry to bump this thread, but does anyone know how to do this?


Hi CurtWRC,

My understanding of your issue is that you want to make the CalendarExtender to shown as "Year Mode" instead of "Day Mode". If I have misunderstood, please feel free to let me know.

Here is the sample which I switch the display mode on its OnClientShown event.

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" Format="yyyy-MM-dd"OnClientShown="onCalendarShown"> </ajaxToolkit:CalendarExtender> <script type="text/javascript" language="javascript"> function onCalendarShown(sender,args){ sender._switchMode("years", true); } </script> </form></body></html>
Best regards,
Jonathan

Thatsexactly what I was after. Thanks Jonathan!