Telerik Forums
UI for ASP.NET AJAX Forum
14 answers
287 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
35 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
79 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
98 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
1 answer
94 views
Hello,

I want to refresh/reload a individual raddoc on the layout on Custom Command click. If I make autopostback=true then it refresh complete page and all raddocs get refreshed.

Can you suggest me refresh individual raddoc keeping rest intact on page ?

Thanks,
Prayag
Pero
Telerik team
 answered on 23 Mar 2011
22 answers
1.0K+ views
Hi all.

I am rewriting a rather large web application with just about 100 lists in it. We have to access control the lists, and the actions performed on them so we are trying to make the creation of the lists (RadGrids) dynamic.

In the old system, we would have a XML config file for the lists and then do the HTML by hand for each list.

We would like to continue using the XML file, and with regular GridBoundColumn types it works fine. We find ourselves in some problems when we need to display 2 field names in one column, then we have to use GridTemplateColumn.

With more than 100 lists, all with different datasources, things get a bit tricky. We have implemented a simple ITemplate for 1 datasource, but because all the datasources are different, this does not seem to be a viable solution. We would have to create an eventListener for all the special columns in all the datasources, with some very tricky coding ...

Is there any way we can send into the column collection a simple string like just like when we are creating a template column in the ASPX file:

<telerik:GridTemplateColumn>
<ItemTemplate>
<a href="<%#Eval("LinkUrl")%>"><%#Eval("LinkText")%></a>
</ItemTemplate>
</telerik:GridTemplateColumn>
Is it possible for us to use the <a href="<%#Eval("LinkUrl")%>"><%#Eval("LinkText")%></a> model to create these columns in any way ??
Iana Tsolova
Telerik team
 answered on 23 Mar 2011
1 answer
69 views
Hello

I am trying to implement the google like filtering as described in your help topic with my RadGrid (v2010.3.1317.40).
I have done all you describe but I still have an error when I click in combobox :

The target '....' for the callback could not be found or did not implement ICallbackEventHandler.

I do not understand why my ItemsRequested event is never fired.

Can you help me on this?
Read you soon
Pavlina
Telerik team
 answered on 23 Mar 2011
4 answers
77 views
Hello,
I am running into an issue where I need to set document.domain in order to allow communication between rad windows.  an unintended consequence seems to be that radeditors no longer function.  I found an old thread about this from 2009, but there didn't seem to be a solution.  Is there a work around, or fix for this issue? 

Also, it seems to be affecting the RadUpload Progress Bar as well.

Thanks
Lance
Rumen
Telerik team
 answered on 23 Mar 2011
5 answers
158 views
Hi

Am using inline editing ,setting  item to edit mode in grid prerender event it takes long time to rebind.

Is there workaround for it.

Also i use another method , when i load the grid initially  i use editindexes.add to set all the items in edit mode but when i navigate to next page the grid is not rendering in edit mode.

since our company is facing more issues in telerik am facing hard time to convince my manager.

Please help it is urgent.

Regards

Sathya
Sebastian
Telerik team
 answered on 23 Mar 2011
1 answer
47 views
I have a panel and I would like the items in it to not have scroll bars when i expand them. There is plenty of room at the bottom of the page to expand these to fit the items without use of scrollbars. I have tried palying with the height and childheight settings for all the parts but nothing makes any changes at all.
Helen
Telerik team
 answered on 23 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?