Loading a script within a Master page does not work at all. I get the following error from IE7 when loading the page:
error: 'ResetForm' is undefined
Code: 0
URL: http://localhost:.........
In the master page is the following code
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
<Scripts>
<asp:ScriptReference Path="~/Scripts/common.js" />
</Scripts>
</telerik:RadScriptManager>
The script file (common.js) is:function ResetForm(sender, eventArgs) {
document.forms[0].reset();
return false;
}
I am thinking that the masterpage is loaded after the content. so, in that case why is there a script manager
in the master page?? Or should I be loading my script in the content page?? I haven't seen an answer to this
seemingly common problem anywhere.
thank you!
<P style="TEXT-ALIGN: center; MARGIN: 0cm 0cm 10pt" class=MsoNormal align=center><SPAN style="COLOR: #00b050"><FONT face=Calibri>This is an extremely sophisticated newsletter<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></SPAN></P> <P style="TEXT-ALIGN: center; MARGIN: 0cm 0cm 10pt" class=MsoNormal align=center><SPAN style="COLOR: #00b050"><FONT face=Calibri>DOCUMENT<o:p></o:p></FONT></SPAN></P> <P style="TEXT-ALIGN: center; MARGIN: 0cm 0cm 10pt" class=MsoNormal align=center><o:p><FONT face=Calibri> </FONT></o:p></P><telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="Telerik" MultiPageID="RadMultiPage1"> <Tabs> <telerik:RadTab runat="server" Text="Order Setup" Value="OrderSetup" PageViewID="rpvOrderSetup" Selected="true" /> <telerik:RadTab runat="server" Text="Patient Information" Value="PatientInformation" PageViewID="rpvPatientInformation" Enabled="false" /> <telerik:RadTab runat="server" Text="Order Information" Value="OrderInformation" PageViewID="rpvOrderInformation" Enabled="false" /> </Tabs></telerik:RadTabStrip><telerik:RadMultiPage ID="RadMultiPage1" runat="server"> <telerik:RadPageView ID="rpvOrderSetup" runat="server" Selected="true"> <hr style="margin: 0px; padding: 0px; width: 100%;" /> <local:OrderSetup runat="server" ID="OrderSetup" /> </telerik:RadPageView> <telerik:RadPageView ID="rpvPatientInformation" runat="server"> <hr style="margin: 0px; padding: 0px; width: 100%;" /> <local:PatientInformation runat="server" ID="PatientInformation" /> </telerik:RadPageView> <telerik:RadPageView ID="rpvOrderInformation" runat="server"> <hr style="margin: 0px; padding: 0px; width: 100%;" /> <local:OrderInformation runat="server" ID="OrderInformation" /> </telerik:RadPageView></telerik:RadMultiPage>void OrderSetup_Click(EventArgs e){ RadTabStrip1.FindTabByValue("OrderSetup").ImageUrl = "~/images/Ok.png"; IList<RadTab> tabs = RadTabStrip1.GetAllTabs(); foreach (RadTab tab in tabs) tab.Enabled = true; RadTabStrip1.FindTabByValue("PatientInformation").Selected = true; RadMultiPage1.FindPageViewByID("rpvPatientInformation").Selected = true; // RadMultiPage1.SelectedIndex = RadMultiPage1.FindPageViewByID("rpvPatientInformation").Index;}
I need to show upcoming appointments from today to 7 days ahead. This works fine when the appointment is not recurring.
This works fine for non recurring appointments:
For Each a In RadScheduler1.Appointments.GetAppointmentsInRange("2011-03-21", "2011-03-28") ...add appointment data to table. NextFor Each a In RadScheduler1.Appointments ...add appointment data to table. Next rcbSearchOffices.trackChanges();
rcbSearchOffices.set_value(defaultOfficeId.value);
var
rcbSearchOffices.set_selectedItem(item);
rcbSearchOffices.updateClientState();
rcbSearchOffices.commitChanges();
However, when the combo box is displayed, the item that I am trying to select is not visibly selected unless I click on the combo box. If I click on the combo box, I am automatically taken to that item. What I want to happen is that the item is automatically displayed as the selected item in the combo box.
How do I do this?
Thanks!
Protected Sub LoadDock(ByVal sender As Object, ByVal e As CommandEventArgs)
Dim id As String = e.CommandName
lblErr.Text = id.ToString
Dim ds As New DataSet
ds = odata.ReturnDS(
"sp_GadgetsByGadgetName", "@GadgetName", id.ToString)
If LoadedGadgets(ReturnUserName() & "_" & ds.Tables("Generic").Rows(0).Item("GN")) = "False" Then
'Create Dock
Dim dock As New RadDock()
Dim widget As New UserControl
widget = LoadControl(ds.Tables(
"Generic").Rows(0).Item("GadgetContent"))
Dim X As Integer = (ResolutionX / 2) - (CInt(ds.Tables("Generic").Rows(0).Item("GadgetWidth")) / 2)
Dim Y As Integer = (ResolutionY / 2) - (CInt(ds.Tables("Generic").Rows(0).Item("GadgetHeight")) / 2)
With dock
.ID = ReturnUserName() &
"_" & ds.Tables("Generic").Rows(0).Item("GN")
.Title = ds.Tables(
"Generic").Rows(0).Item("GN")
.Skin =
"WebBlue"
.UniqueName = Guid.NewGuid().ToString()
.Width =
CInt(ds.Tables("Generic").Rows(0).Item("GadgetWidth"))
.Height =
CInt(ds.Tables("Generic").Rows(0).Item("GadgetHeight"))
.Left = X
.Top = Y
.Resizable =
False
.Pinned =
False
.OnClientDragEnd =
"Moved"
.OnClientDragStart =
"OnClientDragStart"
.DockHandle = DockHandle.TitleBar
.DockMode = DockMode.Floating
.BorderStyle = BorderStyle.None
.Attributes.Add(
"style", "filter:progid:DXImageTransform.Microsoft.Shadow(direction=145, color=#4b4b4b, strength=5) progid:DXImageTransform.Microsoft.Alpha(opacity=95);")
.OnClientCommand =
"OnClientCommand"
.EnableViewState =
False
End With
RadDockLayout1.Controls.Add(dock)
dock.ContentContainer.Controls.Add(widget)
PlaceGadgetInternal(ds.Tables(
"Generic").Rows(0).Item("GN"), X.ToString, Y.ToString, ReturnUserName)
End If
ds.Clear()
ds.Dispose()
ds =
Nothing
End Sub
[ToolboxItemAttribute(false)]publicclassRadDockSpike : WebPart{// Visual Studio might automatically update this path when you change the Visual Web Part project item.privateconststring_ascxPath = @"~/_CONTROLTEMPLATES/Buv.Backoffice.WebAdmin/RadDockSpike/RadDockSpikeUserControl.ascx";privateRadAjaxManager _ajaxManager;protectedoverridevoidOnInit(EventArgs e){base.OnInit(e);// Init the ajax manager_ajaxManager =newRadAjaxManager();_ajaxManager.EnableEmbeddedScripts =true;Page.Items.Add(typeof(RadAjaxManager), _ajaxManager);Page.Form.Controls.AddAt(0, _ajaxManager);}protectedoverridevoidCreateChildControls(){base.CreateChildControls();Control control = Page.LoadControl(_ascxPath);RadDockSpikeUserControl controlAux = controlasRadDockSpikeUserControl;controlAux.AjaxManager = _ajaxManager;Controls.Add(control);}}
public partial class RadDockSpikeUserControl : UserControl{ public RadAjaxManager AjaxManager; private List<DockState> _currentDockStates { get { //Store the info about the added docks in the session. For real life // applications we recommend using database or other storage medium // for persisting this information. List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStatesMyPortal"]; if (Object.Equals(_currentDockStates, null)) { _currentDockStates = new List<DockState>(); Session["CurrentDockStatesMyPortal"] = _currentDockStates; } return _currentDockStates; } set { Session["CurrentDockStatesMyPortal"] = value; } } protected override void OnInit(EventArgs e) { base.OnInit(e); // Initialize toolbar RadToolBarButton button = new RadToolBarButton(); button.Text = "Open new dock"; ToolBar.Items.Add(button); ToolBar.ButtonClick += new RadToolBarEventHandler(ToolBar_ButtonClick); //Recreate the docks in order to ensure their proper operation for (int i = 0; i < _currentDockStates.Count; i++) { if (_currentDockStates[i].Closed == false) { AddDockFromState(_currentDockStates[i]); //We want to save the dock state every time a dock is moved. } } } protected override void CreateChildControls() { base.CreateChildControls(); } protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); AjaxManager.AjaxSettings.AddAjaxSetting(ToolBar, Panel1, AjaxLoadingPanel); } protected void HandleLoadDockLayout(object sender, DockLayoutEventArgs e) { //Populate the event args with the state information. The RadDockLayout control // will automatically move the docks according that information. foreach (DockState state in _currentDockStates) { e.Positions[state.UniqueName] = state.DockZoneID; e.Indices[state.UniqueName] = state.Index; } } protected void HandleSaveDockLayout(object sender, DockLayoutEventArgs e) { //Save the dock state in the session. This will enable us // to recreate the dock in the next Page_Init. _currentDockStates = DockLayout.GetRegisteredDocksState(); } void ToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { AddDock("Untitled..."); } private void AddDockFromState(DockState state) { RadDock dock = new RadDock(); dock.ID = string.Format("Dock{0}", state.UniqueName); dock.ApplyState(state); Panel1.Controls.Add(dock); CreateSaveStateTrigger(dock); } protected void AddDock(string title) { RadDock dock = new RadDock(); dock.UniqueName = Guid.NewGuid().ToString(); dock.ID = string.Format("Dock{0}", dock.UniqueName); dock.Title = title; dock.Text = "Dock content"; //dock.Resizable = true; //dock.EnableRoundedCorners = true; Panel1.Controls.Add(dock); CreateSaveStateTrigger(dock); // Here is the problem: The dock client instance is null???!!! string script = string.Format(@" var dock = $find('{0}'); alert('Dock: ' + dock); //$find('{1}').dock($find('{0}')); $find('{2}').ajaxRequest();", dock.ClientID, PageDockZone.ClientID, AjaxManager.ClientID); AjaxManager.ResponseScripts.Add(script); } private void CreateSaveStateTrigger(RadDock dock) { //Ensure that the RadDock control will initiate postback // when its position changes on the client or any of the commands is clicked. //Using the trigger we will "ajaxify" that postback. dock.AutoPostBack = true; dock.CommandsAutoPostBack = true; AjaxSetting trigger = new AjaxSetting(); trigger.AjaxControlID = dock.ID; trigger.EventName = "DockPositionChanged"; AjaxUpdatedControl updatedControl = new AjaxUpdatedControl(); updatedControl.ControlID = Panel1.ID; trigger.UpdatedControls.Add(updatedControl); AjaxManager.AjaxSettings.Add(trigger); trigger = new AjaxSetting(); trigger.AjaxControlID = dock.ID; trigger.EventName = "Command"; updatedControl = new AjaxUpdatedControl(); updatedControl.ControlID = Panel1.ID; trigger.UpdatedControls.Add(updatedControl); AjaxManager.AjaxSettings.Add(trigger); }}
-
Usercontrol loaded by the WebPart (RadDockSpikeUserControl.ascx):
<telerik:RadToolBar ID="ToolBar" runat="server"> </telerik:RadToolBar> <asp:Panel ID="DocksContainer" runat="server"> <telerik:RadDockLayout ID="DockLayout" runat="server" OnLoadDockLayout="HandleLoadDockLayout" OnSaveDockLayout="HandleSaveDockLayout" > <telerik:RadDockZone ID="PageDockZone" runat="server"> </telerik:RadDockZone> <div style="display: block"> Hidden Ajaxified asp:Panel, which is used to receive the new dock controls. We will move them with script to the desired initial dock zone. <asp:Panel ID="Panel1" runat="server"> </asp:Panel> </div> </telerik:RadDockLayout></asp:Panel> <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" runat="server" Skin="Default" MinDisplayTime="500"></telerik:RadAjaxLoadingPanel>