Showing posts with label dll. Show all posts
Showing posts with label dll. Show all posts

Monday, March 26, 2012

Duplicate Script Reference

I am trying to create a WebControl dll. There is a common.js file in the dll. It is shared bewteen all WebControls.

If I simply add the script reference using
ScriptManager.Scripts.Add( ...) or implementingGetScriptReferences function of IScriptControl. Duplicate script reference will be created when user add multiple web controls.

It is a problem because a ajax javascript class cannot be registered twice.

If I use ScriptManager.RegisterClientScriptInclude, the script will be unique but it is inserted before ajax javascript liberary.

It seems that I have to do something special to make this work. anyone has suggestions or has experienced the same issue??

thanks

Rushui

Look up the example under ajax.asp.net/docs for the IScriptControl interface. If you implement the interface using their example as a template you shouldn't have issues; I'm not sure what they're doing under the hood, but the GetScriptReferences method specified is being called in some way that helps avoid conflicts.

Upon further investigation, it seems that duplicate script reference of a web control dll can be avoided by implementing GetScriptReference function of IScriptControl interface. The Scripts collection of ScriptManager however doesnot check for duplicates.

My situation is a bit strange since I am trying to share a common js lib between the page and the web control dll. Guess I just have to avoid doing that.

Thanks

Rushui

Wednesday, March 21, 2012

DropDownExtender offset since 10201

When upgrading my toolkit dll to the latest version, all my dropdownextenders seem to render with 20 pixels margin to the left side. It's only the "dropdownbox" surrounding the textlabel: the dropdownlist itself is where it should be. Anyone else experiencing this problem? It might have to do something with my CSS, but it worked before. I've already copied the CSS from the example website, that didn't fix it (though it was different from the file I had)

Isn't anyone experiencing these problems? It probably has something to do with relative/absolute positioning or something. I wonder what changed since last release cause I didn't experience these problems before.

Which CSS class handled the dropdown position?