ASP.NET: User Control, Add JavaScript & CSS in UserControl

 
You can still add them as you normally would. Here’s a very simple example.
WebUserControl.ascx 
 
<%@ ControlLanguage=”C#”AutoEventWireup=”true”CodeFile=”HomePastAttendance.ascx.cs”Inherits=”UserControl_Print”%>
<script src=”../Scripts/jquery-1.4.1.js” type=”text/javascript”></script>
<script src=”http://code.jquery.com/jquery-latest.js&#8221; type=”text/javascript”></script>
<script src=”Scripts/JScript-local-file.js” type=”text/javascript”></script>
<script src=”//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js”type=”text/javascript”></script>
<script src=”Scripts/JScript-local-file.js” type=”text/javascript”></script>
<script>
    $(document).ready(function () {
       
        $(“#datepicker”).datepicker();
    });
</script>
<%@ Registersrc=”PagerControl.ascx”tagname=”PagerControl”tagprefix=”uc1″%>
<style type=”text/css”>
    .style1
    {
        width: 100%;
    }
</style>
<h1>Print past attendance:</h1>
<p>Start Date: <input type=”text” id=”datepicker” /></p>
<br />
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s