This is a migrated thread and some comments may be shown as answers.

Drag/Drop not working in user control

1 Answer 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vanaja
Top achievements
Rank 1
Vanaja asked on 15 Mar 2013, 05:05 PM

hi,

  we have an ASP.NET website.

  Within here a user control.

  THis user control contains two RADGRID controls.
  
  Grid 1 is populated with data. Grid 2 is empty.

  We are trying to drag a row from Grid 1 to Grid 2.

  We have this working in another web page, but it seems that within a user control  there are complications.  When we perform the drag/drop we get this error:
 
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.review_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\mppr4\4fbd45b7\6039e974\App_Web_r6ddz0kb.20.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


The AJAX manager and settings are set up in the web page that is hosting the user control.

Here is the client script:

function onRowDropping(sender, args) {

                debugger;

                if (sender.get_id() == "<%=rgArticles.ClientID %>") {

                    var node = args.get_destinationHtmlElement();

                    if (!isChildOf('<%=RadGrid1.ClientID %>', node) && !isChildOf('<%=rgArticles.ClientID %>', node)) {

                        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;

            }


  What is happening is the code behind rowdropping method is not firing, instead we get the error above. 

  Does anyone have ideas why this wouldn't be working in a user control ? 

Vanaja

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 20 Mar 2013, 11:33 AM
Hi,

 In most cases issues with user controls arise from the fact that the elements there have different auto-generated client-side IDs than those in a standalone page. You can check the client-side logic and whether the code in the client-side event handlers is processed in the same way in both the page and user control. You can check the arguments passed to the server and whether all HTML elements are properly found in the code. If any of them is not found correctly or an invalid parameter is passed to the server you can get the above exception. You can also check how this works without any ajax on the page to see if the problem is in the ajax settings.

All the best,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Vanaja
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or