.NETte Dinge und noch einiges mehr ;-) RSS 2.0
 Thursday, May 31, 2007

(This is an extended comment to Omar's Post)

 

I have reduced the working example only for drag and drop functions. There is no db access or other stuff. I test it with different versions of ajaxtoolkit (1.0.10123.0, 1.0.10301.0, 1.0.61214.0). It works with all versions. I paste the default theme from dashboard, although it works without it (so you've to delete Theme="Default" from default.aspx line 1).
The AnimationExtender has to be in there ("activate" the ajaxtoolkit, see omar's comment).

So i have zipped my project file. You can download it here or i show the important information below.

 

default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
    Theme="Default" EnableSessionState="False" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="CustomDragDrop" Namespace="CustomDragDrop" TagPrefix="cdd" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>

    <script type="text/javascript">
    function onDrop( sender, e )
    {
        var container = e.get_container();
        var item = e.get_droppedItem();
        var position = e.get_position();
       
        //alert( String.format( "Container: {0}, Item: {1}, Position: {2}", container.id, item.id, position ) );
       
        var instanceId = parseInt(item.getAttribute("InstanceId"));
        var columnNo = parseInt(container.getAttribute("columnNo"));
        var row = position;
       
        //i doesn't want any db access
        //WidgetService.MoveWidgetInstance( instanceId, columnNo, row );
    }
    </script>

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"
            LoadScriptsBeforeUI="false" ScriptMode="Release" />
        <div>
            <asp:Panel ID="AddContentPanel" runat="Server" CssClass="widget_showcase" Visible="false">
                <div style="float: left">
                    <b>Click on any of the item to add it to your page.</b></div>
                <div style="float: right">
                    <asp:LinkButton ID="WidgetListPreviousLinkButton" runat="server" Visible="false"
                        Text="&lt; Previous" />
                    |
                    <asp:LinkButton ID="WidgetListNextButton" runat="server" Visible="false" Text="Next &gt;" /></div>
                <br />
                <br />
            </asp:Panel>
            <ajaxToolkit:AnimationExtender ID="AddContentPanelAnimation" runat="server" TargetControlID="AddContentPanel">
                <animations>
                    <OnLoad>
                        <FadeIn minimumOpacity=".2" />
                    </OnLoad>
                </animations>
            </ajaxToolkit:AnimationExtender>
            <asp:UpdatePanel ID="LeftUpdatePanel" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Panel ID="LeftPanel" runat="server" class="widget_holder" columnNo="0">
                        <asp:Panel ID="Widget" CssClass="widget" runat="server">
                            <asp:Panel ID="WidgetHeader" CssClass="widget_header" runat="server">
                                <asp:UpdatePanel ID="WidgetHeaderUpdatePanel" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <table class="widget_header_table" cellspacing="0" cellpadding="0">
                                            <tbody>
                                                <tr>
                                                    <td class="widget_title">
                                                        <asp:LinkButton ID="WidgetTitle" runat="Server" Text="Widget Title" /><asp:TextBox
                                                            ID="WidgetTitleTextBox" runat="Server" Visible="False" /><asp:Button ID="SaveWidgetTitle"
                                                                runat="Server" Visible="False" Text="OK" /></td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </asp:Panel>
                        </asp:Panel>
                        <div id="DropCue1" class="widget_dropcue">
                        </div>
                    </asp:Panel>
                    <cdd:CustomDragDropExtender ID="CustomDragDropExtender1" runat="server" TargetControlID="LeftPanel"
                        DragItemClass="widget" DragItemHandleClass="widget_header" DropCueID="DropCue1"
                        OnClientDrop="onDrop" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>

Thursday, May 31, 2007 11:15:36 AM (W. Europe Standard Time, UTC+01:00)  #    Comments [3] -
.NET |  ASP.NET
Sunday, July 08, 2007 3:12:46 PM (W. Europe Standard Time, UTC+01:00)
Thank you~ Steini~
This problum is very nuisance.
Thank you~ your post.
Friday, July 20, 2007 10:46:35 AM (W. Europe Standard Time, UTC+01:00)
Hello,
I tried the example given , i am able to drag the widget but when i drop it goes back to its original position,how do i drop it at the position where i want.

In the example widgetService.MoveWidgetInstance( instanceId, columnNo, row );
is commented can you please let me know from where can i get the instance of widgetService.

Any kind of help would be really appreciated.

Thanks
Vijal
Friday, July 20, 2007 12:34:13 PM (W. Europe Standard Time, UTC+01:00)
In my simple sample there is only one dropcue. If you want to drag it from one column to another, like in omars sample, then you add more dropcue tags. WidgetService is the webservice that recieves the changed position of the moved widget. The webmethod looks like this:

[WebMethod][ScriptMethod(UseHttpGet=false)]
public void MoveWidgetInstance(int widgetId, int toColumn, int toRow)
{
new DashboardFacade(Profile.UserName).MoveWidgetInstance(widgetId, toColumn, toRow);
}
Comments are closed.
Archive
<January 2009>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2009
Christian Stein
Sign In
Statistics
Total Posts: 238
This Year: 0
This Month: 0
This Week: 0
Comments: 20
All Content © 2009, Christian Stein
DasBlog theme 'Business' created by Christoph De Baene (delarou)