Thursday, 28 March 2013

User Control: Add JavaScript & CSS in UserControl


You can still add them as you normally would. Here's a very simple example. 
WebUserControl.ascx 


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="HomePastAttendance.ascx.cs" Inherits="UserControl_Print" %>

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-latest.js" 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="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script src="Scripts/JScript-local-file.js" type="text/javascript"></script>
<script>
    $(document).ready(function () {
       
        $("#datepicker").datepicker();
    });
</script>
<%@ Register src="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 />

No comments:

Post a Comment