Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
131 views
Hi,

I am testing out the Drag/Drop capabilities of the RadGrid (dragging from one grid to another), and I've come across a problem. It works great when the grid I'm dragging from has more than one row, but if there's one row I get the following JScript error thrown:

Microsoft JScript runtime error: Unable to get value of the property 'rows': object is null or undefined

Here's my ASPX markup:

    <script type="text/javascript">
 
        function OnClientUpdated(sender, args) {
            var message = "Update (check) was done!";
            var newMsgs = sender.get_value();
            if (newMsgs != 0) {
                sender.show();
                message += (newMsgs == 1) ? (" There is 1 new message!") : (" There are " + newMsgs + " new messages!");
            }
            else {
                message += " There are no new messages!";
            }
        }
         
    </script>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadScriptBlock runat="server" ID="scriptBlock">
 
        <script type="text/javascript">
                <!--
            function onRowDropping(sender, args) {
                if (sender.get_id() == "<%=RadGrid1.ClientID %>") {
                    var node = args.get_destinationHtmlElement();
                    if (!isChildOf('<%=RadGrid2.ClientID %>', node) && !isChildOf('<%=RadGrid1.ClientID %>', node)) {
                        args.set_cancel(true);
                    }
                }
                else {
                    var node = args.get_destinationHtmlElement();
                    if (!isChildOf('trashCan', node)) {
                        args.set_cancel(true);
                    }
                    else {
                        if (confirm("Are you sure you want to delete this order?"))
                            args.set_destinationHtmlElement($get('trashCan'));
                        else
                            args.set_cancel(true);
                    }
                }
            }
 
            function isChildOf(parentId, element) {
                while (element) {
                    if (element.id && element.id.indexOf(parentId) > -1) {
                        return true;
                    }
                    element = element.parentNode;
                }
                return false;
            }
                    -->
        </script>
 
    </telerik:RadScriptBlock>
     <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
         <telerik:RadSplitter ID="RadSplitter1" Width="100%" runat="server">
         <telerik:RadPane runat="server">
   <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true"
                 onneeddatasource="RadGrid1_NeedDataSource" onrowdrop="RadGrid1_RowDrop">
   <MasterTableView AllowCustomSorting="true" AllowPaging="true" DataKeyNames="ID" AllowSorting="true" PageSize="20">
   
   </MasterTableView>
     <ClientSettings AllowRowsDragDrop="True" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                    <Resizing AllowColumnResize="true" />
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
                          <ClientEvents OnRowDropping="onRowDropping" />
                </ClientSettings>
</telerik:RadGrid>     
         </telerik:RadPane>
         <telerik:RadSplitBar runat="server"></telerik:RadSplitBar>
         <telerik:RadPane runat="server">
   <telerik:RadGrid ID="RadGrid2" runat="server" AllowFilteringByColumn="true"
                 onneeddatasource="RadGrid2_NeedDataSource" onrowdrop="RadGrid2_RowDrop">
   <MasterTableView AllowCustomSorting="true" DataKeyNames="ID" AllowPaging="true" AllowSorting="true" PageSize="20">
   
   </MasterTableView>
     <ClientSettings AllowRowsDragDrop="True" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                    <Resizing AllowColumnResize="true" />
                             <ClientEvents OnRowDropping="onRowDropping" />
 
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
                </ClientSettings>
</telerik:RadGrid>     
          
         </telerik:RadPane>
         
         </telerik:RadSplitter>
    
</telerik:RadAjaxPanel>
 
  <telerik:RadNotification ID="RadNotification1" runat="server" LoadContentOn="TimeInterval"
        Width="300" Animation="Fade" EnableRoundedCorners="true" EnableShadow="true"
        OnClientUpdated="OnClientUpdated" Title="Notifications" OffsetX="-20" OffsetY="-20"
        TitleIcon="none" UpdateInterval="10000" AutoCloseDelay="1500" OnCallbackUpdate="OnCallbackUpdate">
        <ContentTemplate>
            <asp:Literal ID="lbl" runat="server"></asp:Literal>
        </ContentTemplate>
    </telerik:RadNotification>

Here's my code behind:

public IList<Delivery> _Deliveries
        {
            get { return (List<Delivery>)Session["Deliveries"]; }
            set { Session["Deliveries"] = value; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _Deliveries = new List<Delivery>();
                _Deliveries.Add(new Delivery { ID = 1, Assigned = false, Customer = "Micross", TripDate = DateTime.Today });
                _Deliveries.Add(new Delivery { ID = 2, Assigned = false, Customer = "Test", TripDate = DateTime.Today });
                _Deliveries.Add(new Delivery { ID = 3, Assigned = false, Customer = "Micross3", TripDate = DateTime.Today });
                _Deliveries.Add(new Delivery { ID = 4, Assigned = false, Customer = "Test3", TripDate = DateTime.Today });
 
                RadGrid1.DataBind();
            }
        }
 
        private void BindMain()
        {
            RadGrid1.DataBind();
        }
 
        private void BindSecond()
        {
            RadGrid2.DataSource = _Deliveries.Where(a => a.Assigned == true);
            RadGrid2.DataBind();
        }
 
 
 
        protected void OnCallbackUpdate(object sender, RadNotificationEventArgs e)
        {
            int newMsgs = DateTime.Now.Second % 10;
            if (newMsgs == 5 || newMsgs == 7 || newMsgs == 8 || newMsgs == 9) newMsgs = 0;
            lbl.Text = String.Concat(new object[] { "You have ", newMsgs, " new invoices to process!" });
            RadNotification1.Value = newMsgs.ToString();
        }
 
        protected void RadGrid2_RowDrop(object sender, GridDragDropEventArgs e)
        {
                foreach (GridDataItem draggedItem in e.DraggedItems)
                {
                    var tmpOrder = _Deliveries.Where(a => a.ID == (long)draggedItem.GetDataKeyValue("ID")).Single();
                    tmpOrder.Assigned = false;
                }
 
                RadGrid1.Rebind();
                RadGrid2.Rebind();
           
        }
 
        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            RadGrid1.DataSource = _Deliveries.Where(a => a.Assigned == false);
 
        }
 
        protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            RadGrid2.DataSource = _Deliveries.Where(a => a.Assigned == true);
 
        }
 
        protected void RadGrid1_RowDrop(object sender, GridDragDropEventArgs e)
        {
 
                foreach (GridDataItem draggedItem in e.DraggedItems)
                {
                    var tmpOrder = _Deliveries.Where(a => a.ID == (long)draggedItem.GetDataKeyValue("ID")).Single();
                    tmpOrder.Assigned = true;
                }
                RadGrid1.Rebind();
                RadGrid2.Rebind();
          
        }

Thanks!
Chris
Top achievements
Rank 1
 answered on 12 May 2012
2 answers
184 views
Hi Team,


        Today, I got strange error on Ajax Manager & Panel. Let me explain my test case. I have 1 text box and ontextchanged event of that textbox. Inside ontextchange event i updated current dattime to label control. All controls are inside asp:panel. After textchanged Ajax Manager will auto update my asp:panel.

         My error is after 1st time text change i can't type any text into text box if i didn't cursor move to other text box. It means i can type only one time at text box without cursor move to other. That error i face at IE8 and IE9. That error will get after press enter and lost cursor if i use tab key.

         Why i got this error on IE? Is it bug or my code wrong? I try to do that because of my require is same this case and all user are using IE only.

Noted: AjaxManager and Panel are same error.

Kindly please help to me. I need urgent for this case.

Sample Code aspx

Default3.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="_txtBox" EventName="OnTextChanged">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="_pnlLine" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="_txtDock" EventName="OnTextChanged">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="_pnlDock" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <div>
            <asp:Panel runat="server" ID="_pnlLine">
                <asp:Label runat="server" ID="_lblTime" Text="Time"></asp:Label><br />
                <asp:TextBox runat="server" ID="_txtBox" OnTextChanged="_txtBox_TextChanged" AutoPostBack="true"></asp:TextBox><br />
                <asp:TextBox runat="server" ID="TextBox1" Text="Nothing"></asp:TextBox>
            </asp:Panel>
        </div>
        <div>
            <telerik:RadDockLayout ID="rdlayout" runat="server" EnableEmbeddedSkins="true">
                <telerik:RadDockZone ID="rdZone" runat="server" Orientation="Vertical" Width="890px"
                    FitDocks="true" CssClass="margin-top: 100px">
                    <telerik:RadDock ID="AddLine" runat="server" DefaultCommands="ExpandCollapse" DockMode="Docked"
                        Width="780px" Title="Testing">
                        <ContentTemplate>
                            <div>
                                <asp:Panel runat="server" ID="_pnlDock">
                                    <asp:Label runat="server" ID="_lblDock" Text="Time"></asp:Label><br />
                                    <asp:TextBox runat="server" ID="_txtDock" OnTextChanged="_txtDock_TextChanged" AutoPostBack="true"></asp:TextBox><br />
                                    <asp:TextBox runat="server" ID="TextBox3" Text="Nothing"></asp:TextBox>
                                </asp:Panel>
                            </div>
                        </ContentTemplate>
                    </telerik:RadDock>
                </telerik:RadDockZone>
            </telerik:RadDockLayout>
        </div>
    </div>
    </form>
</body>
</html>

CB of Default3.aspx

using System;
 
public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void _txtBox_TextChanged(object sender, EventArgs e)
    {
        _lblTime.Text = System.DateTime.Now.ToString();
    }
 
    protected void _txtDock_TextChanged(object sender, EventArgs e)
    {
        _lblDock.Text = System.DateTime.Now.ToString();
    }
}

Regards,
Alex
ALEX
Top achievements
Rank 1
 answered on 12 May 2012
1 answer
97 views
Hi,

I implemented comboBox following scenarios.
A defined asp page of master page has a web user control 1 (UC1), UC1 contains another web user control (UC2) which has a radcombox control.  It messes up on display and can not select with the custom skin which I defined.  It works with simple a page -> web user control but not with above case.

my telerik v2009.3.1208.35,

Kind Regards,

Duy
Ivana
Telerik team
 answered on 12 May 2012
9 answers
450 views
Hi,
I have a page with a RadSplitter taking 100% height and width. Inside this I have two RadPanes (vertical) correctly fitting the page.
If I put a RadGrid with a number of records that would exceed the page height inside one of the two panes it happens that the RadGrid is correctly represented  inside the pane with vertical scroll bar that is correctly contained inside the RadPane, but the page gets an additional vertical scroll bar that would scroll the page to all the height of the table...which is not shown ! (Two screen shots are attached).
This behavior shows up in IE, Firefox, Safari, ect....so it is not browser dependent. 
I've tried many...adjustments including adjusting ScrollHeight but without any change in the behavior of the page.
Help !

Thanks a lot as always.
Irwin
Top achievements
Rank 1
 answered on 11 May 2012
1 answer
145 views
I am trying to bind a grid to this xml

<?xml version="1.0" encoding="utf-8"?>
<Sites>
  <Site Name="Name" URL="www.google.com" >
    <KPIData StartDate="2012-04-01"></KPIData>
  </Site>
 
</Sites>


It works apart from the last column and I can't work out how to get it to appear.  I suspect it needs a selector but haven't been able to find out how to do it.  Here is my ASPX page

<Columns>
      <telerik:GridBoundColumn DataField="Name"
          FilterControlAltText="Filter Name column" HeaderText="Site Name" SortExpression="Name"
          UniqueName="Name">
      </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="URL"
          FilterControlAltText="Filter URL column" HeaderText="URL" SortExpression="URL"
          UniqueName="URL">
      </telerik:GridBoundColumn>
      <telerik:GridBoundColumn DataField="GATableID"
          FilterControlAltText="Filter GATableID column" HeaderText="GA Profile Id" SortExpression="GATableID"
          UniqueName="GATableID">
      </telerik:GridBoundColumn>
 
 
       <telerik:GridBoundColumn DataField="/KPIData[@StartDate]"
          FilterControlAltText="Filter StartDate column" HeaderText="StartDate" SortExpression="StartDate"
          UniqueName="StartDate">
      </telerik:GridBoundColumn>
  </Columns>
Richard
Top achievements
Rank 1
 answered on 11 May 2012
13 answers
206 views
Im using FileExplorer to display a directory in which the user can "file away" into our document management program. A request came in for us to delete the directory if it becomes empty. This is no problem but fileexplorer is still pointing at the directory that has now been removed. Any suggestions? Im using CustomFileSystemProvider as outlined in http://www.telerik.com/support/kb/aspnet-ajax/editor/physical-paths-and-different-content-types.aspx for the deletion of the directory i've tried several things including

CustomFileSystemProvider myProvider = (CustomFileSystemProvider)Session["myCustomFileSystemProvider"];
myProvider.DeleteDirectory(RadFileExplorer1.TreeView.SelectedValue);
Fred
Top achievements
Rank 1
 answered on 11 May 2012
1 answer
68 views
Hi,

Can we edit rows when radgrid is generated with AutoGenerateColumns="true".


Regards,
Akki
Kshitiz
Top achievements
Rank 1
 answered on 11 May 2012
0 answers
134 views

Added the RadChart to a webpart and deployed to Sharepoint Foundation.  It was working but all of a sudden i am getting this error.  

Failed to render "Wiki Content" column because of an error in the "Multiple lines of text" field type control.  See details in log.  Exception message: A generic error occurred in GDI+.  Check the folder specified in the TempImagesFolder property of the control.  Current value is "Chart".  The folder should exist and must have been granted write permissions for the ASPNET user

I have confirmed that there is a directory at C:\inetpub\wwwroot\wss\VirtualDirectories\80\Chart

I also manually set the permissions so that "Everyone" has Full Control on the directory.  It is still giving me problems.  Can someone step me through what i need to do/doing wrong....using Sharepoint Foundation running on my Win7 development system..


Many thanks


UPDATE: figured it out.  was missing ~/ in front of the Temp.  :)  

Michael
Top achievements
Rank 1
 asked on 11 May 2012
1 answer
149 views
Hi,

I been using telerik grid for more than one year. In our new project we need telerik grid client side binding. I created test project to learn to pieces of client side binding. I get master table view null in my basic binding operation. below is the mark up i have. I don't have anything specified in my code behind. Please take a look and let me know what i am doing wrong. 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title>RadGrid Client Side Binding Test</title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
 
        <script type="text/javascript">
        function pageLoad() {
            var data = [{ "ID": 1, "Text": "Text1" }, { "ID": 2, "Text": "Text2"}];
            var mtv = $find("RadGrid1").get_masterTableView(); mtv.set_dataSource(data); mtv.dataBind();
            }
 
        </script>
 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
        </telerik:RadAjaxLoadingPanel>
        <div>
            <telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false">
                <MasterTableView>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" HeaderText="ID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Text" HeaderText="Text">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </div>
    </form>
</body>
</html>
Richard
Top achievements
Rank 1
 answered on 11 May 2012
2 answers
132 views
When I save the content of the editor while in preview mode, all links have target="_blank". If I go back to design or html mode, the targets are reset to their original values.

I understand that the target attribute is added in preview mode so that links always open in a new window. But when I access the content for saving, the links should revert to their original targets.

I can't reproduce this in the demo, because I can't click a 'save' button and see the content

My workaround will be to hide my save button while in preview mode, but I would prefer not to have to do this.


I had a post last year where a similar issue was discussed, and you gave me a solution - can I remove this code now?

http://www.telerik.com/community/forums/aspnet-ajax/editor/anchors-and-preview-mode.aspx
Dan Ehrmann
Top achievements
Rank 1
 answered on 11 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?