Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
142 views

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!


Pero
Telerik team
 answered on 23 Mar 2011
4 answers
121 views
Hi,
when adding the text box inside the RADEditor, after submitting the page it automatically inserts some table tag around the text box tag. any idea how to prevent this behaviour?


regards,
Elangovan P
Dobromir
Telerik team
 answered on 23 Mar 2011
2 answers
94 views
When I paste the following HTML from word without any format stripping into design mode, RadEditor will not allow me to allign the text left until I switch to HTML mode and back to design mode. It seems the filters are not being applied.

<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>
Michael
Top achievements
Rank 1
 answered on 23 Mar 2011
1 answer
164 views
I have a TabStrip that is connected to a MultiPage. When using the UI, these two items are synched up correctly.

I use the tabs in a pseudo-wizard type application. When my app starts, all the tabs but the first one are disabled.  There is a button on the first tab (multipage actually) that when pressed, "starts" the process, and clicking it should enable all the other tabs, and move you to the second tab in the process to begin the data entry.

Here is my basic setup (partially removed items to condense code)
<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>

And here is the code behind:
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;
            // rpvPatientInformation.Selected = true;           
           // RadMultiPage1.SelectedIndex = 1; 
}

Most of this works. The image is added to the first tab, all the tabs are enabled, and the Patient Information tab is selected.

But what does NOT work is that the matching PageView is NOT selected. It still displays the PageView of the first tab.

What am I doing wrong?
Princy
Top achievements
Rank 2
 answered on 23 Mar 2011
2 answers
69 views

 

 

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.
Next

While this also works with recurring appointments:

For Each a In RadScheduler1.Appointments
    ...add appointment data to table.
Next

Now, is there a way to include any occurrences (from all recurring appointments) that meets the given period even if the Recurring appoinment Start date is before the given period?

Veronica
Telerik team
 answered on 23 Mar 2011
1 answer
815 views
Hello,

I am using a RadComboBox on an Ajax Modal Popup Extender.

What I am attempting to do is to select a specific item in the combo box and have that item displayed as the selected item in the combo box.  Prior to displaying the popup that contains the combo box, the combo box is populated and I know the Value of the item that I want to select.

Here is the javascript I am using:

rcbSearchOffices.trackChanges();

rcbSearchOffices.set_value(defaultOfficeId.value);

 

var

item = rcbSearchOffices.findItemByValue(defaultOfficeId.value);

 

 

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!

Princy
Top achievements
Rank 2
 answered on 23 Mar 2011
14 answers
262 views
Hi, I have read through pretty much every post I could regarding this issue, but have yet to find the answer to my problem.  I am dynamically loading docks to give the appearance of a "web os".  When a user clicks to open a new dock, it will usually open it.  However, if there are any docks "on the stage", it throws the above error.  I'm not using a raddockzone as I require windows that float only.  The docks are loaded in an AJAX update panel that is set to a conditional update mode. 

Code snippet below:

 

 

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

 

Pero
Telerik team
 answered on 23 Mar 2011
1 answer
33 views
Hi all,

I do my grid Edit on DblClick as show in Demo.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultvb.aspx
It's too slow to show EditMode. Is it because of too many columns?

At RadGrid1_ItemDataBound event I do several looping columns to set MaxLength of FilteringItem, to hide some data, change font color upon data bind to grid. Is it because of this?
But even I comment all those code and try, it's not faster just like before speed.

Is there any way I can make it faster?

Thanks
Hsi Kao
Pavlina
Telerik team
 answered on 23 Mar 2011
1 answer
76 views
Hi,

I want to use raddocks in sharepoint 2010 using ajax to create them and to reload their content.

My problem is happening when I add the first dock dinamically. The ajax request is made and my javascript is evaluated after the request is done but the i'm unable to get the RadDock client instance.

I already tried the hidden updatePanel approach and  the RadAjaxManager approach but I did not succeed.

Here is the code I'm using:

  • WebPart code (RadDockSpike.cs):

[ToolboxItemAttribute(false)]
public class RadDockSpike : WebPart
{
    // Visual Studio might automatically update this path when you change the Visual Web Part project item.
    private const string _ascxPath = @"~/_CONTROLTEMPLATES/Buv.Backoffice.WebAdmin/RadDockSpike/RadDockSpikeUserControl.ascx";
 
    private RadAjaxManager _ajaxManager;
 
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
 
        // Init the ajax manager
        _ajaxManager = new RadAjaxManager();
        _ajaxManager.EnableEmbeddedScripts = true;           
        Page.Items.Add(typeof(RadAjaxManager), _ajaxManager);
        Page.Form.Controls.AddAt(0, _ajaxManager);
    }
 
    protected override void CreateChildControls()
    {
        base.CreateChildControls();
         
        Control control = Page.LoadControl(_ascxPath);
        RadDockSpikeUserControl controlAux = control as RadDockSpikeUserControl;
        controlAux.AjaxManager = _ajaxManager;
        Controls.Add(control);
 
 
    }
}

  • Usercontrol loaded by the WebPart  (RadDockSpikeUserControl.cs):

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>



Can someone help me?

Michael Pinheiro
Pero
Telerik team
 answered on 23 Mar 2011
1 answer
94 views
Below is my code. my query is if i use Button type as LinkButton, i got the result. But the type is Image/push button then the back-end code doesn't work. whats the problem in this? can any one help?


    <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" GridLines="None"
            AutoGenerateColumns="False" PageSize="13" AllowSorting="True" AllowPaging="True"
            ShowStatusBar="True" >
            <MasterTableView DataKeyNames="Cid" AllowMultiColumnSorting="True" Width="100%"
                CommandItemDisplay="None">
                <Columns>
                    <telerik:GridBoundColumn UniqueName="Cid" SortExpression="Cid" HeaderText="Cid"
                        DataField="Cid" Visible="false" />
                    <telerik:GridDateTimeColumn UniqueName="HolidayDate" SortExpression="HolidayDate" HeaderText="Date"
                        DataField="HolidayDate" DataFormatString="{0:d}" />
                    <telerik:GridBoundColumn UniqueName="HolidayFor" SortExpression="HolidayFor" HeaderText="Holiday name"
                        DataField="HolidayFor" />
                    <telerik:GridButtonColumn UniqueName="EditColumn" CommandName="Edit" ButtonType="ImageButton" 
                        HeaderText ="Action" Text="Edit" HeaderStyle-Width="20px" />
                    <telerik:GridButtonColumn UniqueName="DeleteColumn" CommandName="Delete" ButtonType="LinkButton" 
                        Text="Delete"  HeaderStyle-Width="20px"/>
                </Columns>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents />
            </ClientSettings>
        </telerik:RadGrid>

    Protected Sub RadGrid1_DeleteCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid1.DeleteCommand
        Dim ID As String = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("Cid").ToString
        If e.CommandName = "Delete" Then
            Response.Write(ID)
end if
    End Sub

Pavlina
Telerik team
 answered on 23 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?