<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Web Forms</title><link>http://forums.asp.net/18.aspx</link><description>All about building ASP.NET Pages - server controls, events, validation, etc.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Data binding expressions in javascript  include files</title><link>http://forums.asp.net/thread/3274476.aspx</link><pubDate>Sat, 04 Jul 2009 08:39:58 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274476</guid><dc:creator>Abdulla.AbdelHaq</dc:creator><author>Abdulla.AbdelHaq</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274476.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=3274476</wfw:commentRss><description>&lt;p&gt;you got two choices ... either you send the clientId of the control as argumant to the javascript function from the page .. or you need to use the &amp;quot;Javascript object oriented way&amp;quot; .. I mean you need to create a variables and properties for the javascript external file and then create object instance from that javascript file..&lt;/p&gt;&lt;p&gt;like this ..&lt;/p&gt;&lt;p&gt;function myJsClass(SomeControlClientID)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.SomeControlObj = document.getElementById(SomeControlClientID);&lt;br /&gt;&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;myJsClass.prototype.ToggleStartDateCalendarPopup=function()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;You can now use the control object here by calling the &amp;quot;SomeControlObj&amp;quot;&lt;br /&gt;&amp;nbsp;variable which contain the object of the control&lt;br /&gt;&lt;br /&gt;EX:&amp;nbsp; this.SomeControlObj&lt;br /&gt;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now in the page declare javascript object from that javascript class&lt;/p&gt;&lt;p&gt;&amp;lt;script language=&amp;#39;javascript&amp;#39;&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;var MyObjJs = new myJsClass(&amp;#39;&amp;lt;%= TextBox1.ClientID %&amp;gt;&amp;#39;);&lt;/p&gt;&lt;p&gt;MyObjJs.ToggleStartDateCalendarPopup();&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Data binding expressions in javascript  include files</title><link>http://forums.asp.net/thread/3273881.aspx</link><pubDate>Fri, 03 Jul 2009 17:46:40 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273881</guid><dc:creator>andieje</dc:creator><author>andieje</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273881.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=3273881</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi&lt;/p&gt;
&lt;p&gt;I have some javascript that contains databinding expressions. I was trying to include this in my webpage as include file or by using RegisterStartUPScript &lt;/p&gt;
&lt;p&gt;Here is the javascript&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;function ToggleStartDateCalendarPopup()
        {
            $find(&amp;quot;&amp;lt;%= dpStartDate.ClientID %&amp;gt;&amp;quot;).showPopup();
        }
        
        function ToggleEndDateCalendarPopup()
        {
            $find(&amp;quot;&amp;lt;%= dpEndDate.ClientID %&amp;gt;&amp;quot;).showPopup();
        }&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;But then the page does not run and I get this error: Message: &amp;#39;null&amp;#39; is null or not an object&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;I presume this is because of the data binding expressions. Is there anything I can do to include this javascript externally?&lt;/p&gt;
&lt;p&gt;I tried putting the javascript in a usercontrol so that I could drop it on the pages that use this code but naturally the page wouldn&amp;#39;t compile because the user control does not have a control called dpStartDate.&lt;/p&gt;
&lt;p&gt;Any help is much appreciated&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>