• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 549
  • Last Modified:

JQuery Custom Control

I am trying to call a calender popup using custom controls which is not working

What i did

I download calender plugin shown below and run in my webpage - worked
I replaced the calendar JS and CSS files to dll - NOT WORKED
I added a Sample js and css file in the DLL and called that js and css - WORKED

Why the calender JS and css not worked?

Trials that i did
Changed the property to Embedded resource
Removed the DOTS from the Jquery JS files

This is the way i am calling the css:

 string cssDatePickerURL = Page.ClientScript.GetWebResourceUrl(typeof(WebDate), "Infotech3i.TSG.WebControls.WebDate.jquery.ui.datepicker.css");
 HtmlLink cssDatePicker = new HtmlLink();
cssDatePicker.Href = cssDatePickerURL;
 cssDatePicker.Attributes.Add("rel", "stylesheet");

This is the way i am calling the JS:

  cs.RegisterClientScriptResource(typeof(WebDate), "Infotech3i.TSG.WebControls.WebDate.jquery-1.7.1.min.js");
            cs.RegisterClientScriptResource(typeof(WebDate), "Infotech3i.TSG.WebControls.WebDate.jquery.ui.core.js");
            cs.RegisterClientScriptResource(typeof(WebDate), "Infotech3i.TSG.WebControls.WebDate.jquery.ui.datepicker.js");
  • 2
1 Solution
PeteEngineerAuthor Commented:
CSS files are taken but Java scripts are not.

In Fire Bug , HTML tag shows <Link> tag. There are 9 link tag each for my
CSS and Js files. In those CSS links are showing data properly but JS data
is showing as below :

<title>The resource cannot be found.</title>

<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>The resource cannot be found.</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> 
<b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.
<b> Requested URL: </b>/WebResource.axd<br><br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

Moreover, there is Firebug tab name CSS.

In that there is a dropdown which shows 9 webresource.axd?sfsdfsdfsdcsksdfkhskdf values where each describes the js and css files embedded as resource.

in those CSS resources are look fine, but for js nothing is visible and a blank page comes in the firebug console while i click

I have found following following trials to fix this issue : But no hope :-(

Added [assembly: WebResource("MyNamespace.MyScriptFile.js", "text/javascript")] above the class's namespace declaration.
Script file has build action "Embedded Resource".
Tried registering during OnInit, OnLoad and OnPreRender
Script file is in the same assembly and namespace as the control registering it its work fine.

Does not work using any of the following methods:
ScriptManager.RegisterClientScriptResource(Page, GetType(), "MyNamespace.MyScriptFile.js");

Page.ClientScript.RegisterClientScriptResource(GetType(), "MyNamespace.MyScriptFile.js");

Try implementing my own ScriptManger and then adding the embedded file from there. Here's an example

public class MyScriptManager : System.Web.UI.ScriptManager
protected override void OnInit(EventArgs e)
RegisterClientScriptResource(this, typeof(ScriptManagerExtension), "MyNamespace.MyScriptFile.js");


[assembly: WebResource("Library.Resources.Scripts.libscript.js", "text/javascript", PerformSubstitution = true)]

Changed the order of js files



Created Different solution for dll

Please help any other alternatives available?
PeteEngineerAuthor Commented:
Thanks God !!

Issue got fixed :

I issue was .i was using  javascript in the website which i was calling and was using
wrong client ID ..but when i embedded in the dll its working like below :

 string javascript = "<script type='text/jscript'> " +
                                 "$(document).ready(function () { " +
                                 "$('" + "#" + this.ClientID + "').datepicker(); " +

            Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID, javascript);

Thanks for the help !
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now