Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Wednesday, March 28, 2012

Change default view of CalendarExtender

I need to change the default calendar view from Days to Years when it initially pops up. Does anybody know how to do this?

Hi Arjang,

me@.arjang.ca:

I need to change the default calendar view from Days to Years

Would you please give us more clear explanations?Do you want to list all the Days of a year on the page? If yes , I think you'd better use javascript + HTML to write your own calendar.As far as I know, the CalendarExtender is designed for showing the Days of a month. For more details, please visit: http://www.asp.net/AJAX/Control-Toolkit/Live/Calendar/Calendar.aspx or the Ajax ControlToolkit's source code.Thanks.

Best regards,

Jonathan


Hi Jonathan

I wanted to have the ability to change the default calendar view from Days to Years when it initially pops up. One real world scenario when this would be very important would be when using the calendar to select a birthdate. The year could be 1950 so it's not practical for someone to scroll back month by month, and users don't always understand they have to click the title twice to switch to year. Exposing a property like "InitialView" that could be set at design time or runtime would be ideal. The calendar would pop up right to year selection, then month, then day.

Anyway, I fixed it by changing the Ajax source code and it seems it is working properly.

Thanks,

Arjang



I would be very interested in doing this as well, what did you change?(in CalendarBehavior.js?)

Also, I would like to fire the date selected event when the user selects a month rather than a day.

Any help would be appreciated.


I did the following changes:

1. added another parameter for default mode:

this._defaultMode ="days";

this._mode =this._defaultMode;

2. expose a property to handle default mode:

get_defaultMode :function() {returnthis._defaultMode;},

set_defaultMode :function(value) {

if (this._defaultMode != value) {

this._defaultMode = value;

this._mode =this._defaultMode;this.raisePropertyChanged("defaultMode");

}

},

3. in hide function change "days" tothis._defaultMode

this._switchMode(this._defaultMode,true);

4. finally, in_switchMonth function add the following code in the else section of "if (this._animated && !dontAnimate)".

if (this._mode !="days")

{

var element =this._modes[this._mode];

$common.setLocation(element, {x:0,y:0});

$common.setVisible(element,true);

}

Hope it helps! please let me know if you face any problem.


Worked like a charm. Thanks so much.

Monday, March 26, 2012

CascadingDropDowns in VB

I'm trying to convert the CascadingDropDown list sample to VB and I'm running into a problem. When I view the page, there are no errors but the dropdown lists don't populate. It doesn't seem like the webservice is being run. The reason I say this is beacuse if I change the "ServicePath" property on the aspx page to point to a nonexistant file, I get the exact same results...No error and no data in the lists. But I figure that if the ServicePath that Im pointing at doesn't exist, I should be getting an error. Here is my code for the .vb service and the .aspx code. What am I missing?

Inherits System.Web.Services.WebServicePrivate ReadOnly _document asNew XmlDocument()Private ReadOnly _hierarchy() asString Public Sub CarsService()'Read XML data from disk _document.Load(Server.MapPath("~/App_Data/CarsService.xml")) _hierarchy(0) ="Make" _hierarchy(1) ="Model"End Sub <WebMethod()> _Public Function GetDropDownContents(ByVal knownCategoryValuesAs String,ByVal categoryAs String)As AtlasControlToolkit.CascadingDropDownNameValue()Dim knownCategoryValuesDictionary asNew StringDictionary knownCategoryValuesDictionary = AtlasControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)Return AtlasControlToolkit.CascadingDropDown.QuerySimpleCascadingDropDownDocument(_document, _hierarchy, knownCategoryValuesDictionary, category)End Function
<atlas:ScriptManager id="ScriptManager1" EnablePartialRendering="true" runat="server"></atlas:ScriptManager> <atlas:UpdatePanel ID="UpdatePanel1" runat="server"><contenttemplate><table><tr> <td>Make</td> <td><asp:DropDownList ID="DropDownList1" runat="server" Width="170" /></td></tr><tr> <td>Model</td> <td><asp:DropDownList ID="DropDownList2" runat="server" Width="170" /></td></tr><tr> <td>Color</td> <td><asp:DropDownList ID="DropDownList3" runat="server" Width="170" /></td></tr></table><br /><asp:Button ID="Button1" runat="server" Text="I want this car" OnClick="Button1_Click" /><br /><br /><asp:Label ID="Label1" runat="server" Text="[No response provided yet]"></asp:Label></contenttemplate></atlas:UpdatePanel><atlasToolkit:CascadingDropDown id="CascadingDropDown1" runat="server"><atlasToolkit:CascadingDropDownProperties TargetControlID="DropDownList1" Category="Make"PromptText="Please select a make" ServicePath="CarsService.asmx" ServiceMethod="GetDropDownContents" /><atlasToolkit:CascadingDropDownProperties TargetControlID="DropDownList2" Category="Model"PromptText="Please select a model" ServicePath="CarsService.asmx" ServiceMethod="GetDropDownContents"ParentControlID="DropDownList1" /><atlasToolkit:CascadingDropDownProperties TargetControlID="DropDownList3" Category="Color"PromptText="Please select a color" ServicePath="CarsService.asmx" ServiceMethod="GetDropDownContents"ParentControlID="DropDownList2" /></atlasToolkit:CascadingDropDown></form>

Hmmm - the code looks okay to me. Two questions:

1) Does the sample website page for CascadingDropDown work okay?

2) If you put a breakpoint in the web service, can you verify that it does or doesn't work


Make sure that your Web.Config is updated to allow browser access to web services. You can find details at this link:

http://atlas.asp.net/docs/atlas/doc/services/exposing.aspx#enable

If you don't then I think you'll find that your drop-down lists will not be populated!

Hope this helps

Wednesday, March 21, 2012

CascadingDropDown In a user control

Hi,

I'm trying to use the cascading dropdown control inside the edit template of a form view control which is wraped inside a user control. The cascading dropdown obtains its data from a database. Their is no problem geting the data. The issue is when I go to set the selected value of the cascading dropdown to a value in the FormView_databound event handler, the selected value is does not get set, it shows "Please Select" which is the value I set in the begining.

Please help

Please try your scenario with the recently available61106 release of the Toolkit (and ASP.NET AJAX Beta 2). If the problem persists, then please reply with acomplete, self-contained sample page that demonstrates the problem so that we can investigate the specific behavior you're seeing. Thank you!