I don't think that's really an option. What's happening is that if only one (Event) List is returned, the List View dropdown doesn't get pre-populated based on the selected value. This is what I would like to happen but not sure how to force it. [cid:image003.png@01CCE712.C49EF0C0] cboList.SelectedValue = wp.ListName; // Get Fields and Views for selected List if (!string.IsNullOrEmpty(cboList.SelectedValue)) { foreach (SPField field in SPContext.Current.Web.Lists[cboList.SelectedValue].Fields) { if (field.Type == SPFieldType.DateTime) { cboField.Items.Add(new ListItem(field.Title, field.InternalName)); cboEndField.Items.Add(new ListItem(field.Title, field.InternalName)); } if (field.Type == SPFieldType.Text && field.Title == "Title" || field.Title == "Location") { cboTooltipField.Items.Add(new ListItem(field.Title, field.InternalName)); } } foreach (SPView view in SPContext.Current.Web.Lists[cboList.SelectedValue].Views) { cboView.Items.Add(new ListItem(view.Title, view.Title)); } cboView.SelectedValue = wp.ViewName; cboField.SelectedValue = wp.DateField; cboEndField.SelectedValue = wp.EndDateField; cboTooltipField.SelectedValue = wp.TooltipField; } From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Ishai Sagi Sent: Thursday, 9 February 2012 9:39 AM To: ozMOSS Subject: RE: Trigger eventhandler action when only one item in dropdown
Well, if there is only one item, I'd suggest not showing the dropdown at all (unless you want a "blank" options). [cid:image002.jpg@01CCE715.07B1BD00]Ishai Sagi | Solutions Architect 0488 789 786 | is...@exd.com.au<mailto:is...@exd.com.au> | www.sharepoint-tips.com<http://www.sharepoint-tips.com/> | @ishaisagi<http://twitter.com/ishaisagi> From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Paul Noone Sent: Thursday, 9 February 2012 09:34 To: ozMOSS (ozmoss@ozmoss.com) Subject: Trigger eventhandler action when only one item in dropdown Hi all, Just hit a curious problem with my webpart dropdowns. When only one item is available in a dropdown there's no way to trigger the onchange event. :) I've added a count for the items returned for each dropdown and, if it's less than or equal to 1, I add a dummy selection. While this works, I'm wondering what best practice is in this situation. Kind regards, Paul Noone --------------------------------------------------- Online Developer/SharePoint Administrator Infrastructure Team, ICT Catholic Education Office, Sydney p: (02) 9568 8461 f: (02) 9568 8483 e: paul.no...@ceosyd.catholic.edu.au<mailto:paul.no...@ceosyd.catholic.edu.au> w: http://www.ceosyd.catholic.edu.au/
<<inline: image003.png>>
<<inline: image004.jpg>>
<<inline: image002.jpg>>
_______________________________________________ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss