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

Script control 'dgPrd' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().

2 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sudha
Top achievements
Rank 1
Sudha asked on 05 Jul 2011, 02:57 PM
hi,
I am getting an exception at

 

 

this.pnlprdDes.RenderControl(htmlWriterForPrdtLst); 

that
"Script control 'dgPrd' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl"

For this I tried to set the RegisterWithScriptManager property of the RadGrid to "False". Then I did not get any exception, but the control is not going back to a registered java script. Please help me in resolving this issue.

Thanks,
Sudha.

 

2 Answers, 1 is accepted

Sort by
0
Ripunjay
Top achievements
Rank 1
answered on 07 Jul 2011, 03:41 PM
Hi telerik team,
Please let us know if its possible to render an asp panel containing radgrid back to client after a server callback event.
Can you provide a sample project that has the below callback code registered on page load:

if (!IsCallback)
       {
           String cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg",
              "ReceiveServerData", "context", true);
 
           String callbackScript = "function CallServer(arg, context) {" +
               cbReference + "; }";
 
           Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
               "CallServer", callbackScript, true);
       }

and then the row click of radgrid calls a method "OnDatagridRowClick"

<ClientSettings>
                                                    <Selecting AllowRowSelect="True" />
                                                    <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                                    <ClientEvents OnRowSelected="OnDatagridRowClick" OnGridCreated="GridCreated" />
                                                </ClientSettings>

The "OnDatagridRowClick" in javascript calls the Callserver event registered in the first code sample above:

function OnDatagridRowClick(row)
{
CallServer("Callserver invoked");
}

And the RaiseCallBackEvent returns a string from server side to clientside again (pnlDataDetails is the panel containing the radgrid):

public void RaiseCallbackEvent(string eventsArgument)
    {
 
StringBuilder returnString = new StringBuilder();
System.IO.StringWriter stringWriterForDataList
                = new System.IO.StringWriter();
 Html32TextWriter htmlWriterForFileList
                = new Html32TextWriter(stringWriterForDataList);
this.pnlDataDetails.RenderControl(htmlWriterForDataList);
returnString.Append("ShowData" + "|" + stringWriterForDataList.ToString() );
callBackReturnData = returnString.ToString();
                         
    }
 
public string GetCallbackResult()
    {
        return callBackReturnData;
    }

I expect the control to go back to the registered ReceiveServerData event in the first code sample:

function ReceiveServerData(retVal)
{
alert("After callback");
}

But this does not seem to happen. I need to update one grid on rowclick of another grid and hence I need to set "EnablePostBackOnRowClick" = true. This causes the control to go to pageload instead of ReceiveServerData event.
Also to avoid the exception which I was getting for rendering the panel containing the grid, I had set RegisterWithScriptManager = false. But that made the grid lose the styling applied. Please help me here ASAP as this has become a kind of showstopper in my application.

Thanks,
Ripunjay
0
Vasil
Telerik team
answered on 08 Jul 2011, 01:15 PM
Hello,

You could use web page methods like is shown in this online demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/databinding/defaultcs.aspx

You need to set EnablePageMethods property of the RadScriptManager to "true" to be able to use such a methods. Please examine how GetCount function is defined and used in the demo.

I hope this helps.

Greetings,
Vasil
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Sudha
Top achievements
Rank 1
Answers by
Ripunjay
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or