This project is read-only.

How to. New control?

Jun 12, 2011 at 7:55 PM




I want to write a new jquery webcontrol, but have some problems.

The steps i made:

1. Added my jquery script to jQuery/UI

2. Added a new class for the control and wrote

  [JQuery(Name = "DragUpload", Assembly = "jQuery", DisposeMethod = "destroy",
      ScriptResources = new string[] { "ui.dropup.js" }, StartEvent = ClientRegisterEvents.DocumentReady)]
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]


3. Wroted onPreRender

  protected override void OnPreRender(EventArgs e)
            JQueryScriptBuilder builder = new JQueryScriptBuilder(this);
            var scripts = new StringBuilder();

             scripts.Append("some code");

             // ClientScriptManager.RegisterDocumentReadyScript(this,builder.ToString());
           ClientScriptManager.RegisterJQueryControl(this, builder);


4. Add my control to visual studio toolbox and run the project

5. Get the error

Object reference not set to an instance of an object.

var typedScripts = from ts in sm.CompositeScript.Scripts
Línea 78:                                where ts.Assembly.ToLower() == scriptReference.Assembly.ToLower() &&
Línea 79:                                ts.Name.ToLower() == scriptReference.Name.ToLower()


What did I do wrong?


best regards