<?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>Migrating from Visual Studio .NET 2003 to Visual Studio 2005 </title><link>http://forums.asp.net/1012.aspx</link><description>Discuss issues, strategies, tips, etc. for migrating from Visual Studio .NET 2003 to Visual Studio 2005</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/3062090.aspx</link><pubDate>Fri, 03 Apr 2009 22:57:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3062090</guid><dc:creator>belcherman</dc:creator><author>belcherman</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3062090.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=3062090</wfw:commentRss><description>Old post but I have the same situation. I am trying to call a function in my code behind form a aspx page. The thing is that this page is using inline coding module as opposed to code behind. I have a header.ascx file that has the function:

    void SiteName(Object sender, EventArgs e)
    {



        if (string.Compare(G_site.name, string.Empty) != 0)
        {
            LiteralWelcome.Text = &amp;quot;&amp;quot;;

            LiteralWelcome.Text += &amp;quot;&lt;tr&gt;\n&amp;quot;;
            LiteralWelcome.Text += &amp;quot;&lt;td colspan="2"&gt;&lt;span class="SciLftNavLTitle"&gt;Welcome!&lt;/span&gt;&lt;/td&gt;\n&amp;quot;;
            LiteralWelcome.Text += &amp;quot;&lt;/tr&gt;\n&amp;quot;;
            LiteralWelcome.Text += &amp;quot;&lt;tr&gt;\n&amp;quot;;
            LiteralWelcome.Text += &amp;quot;&lt;td colspan="2" align="center"&gt;&amp;quot; + G_site.name + &amp;quot;&lt;br /&gt;\n&amp;quot;;

            Response.Write(&amp;quot;&lt;td colspan="2" align="center"&gt;&amp;quot; + G_site.name + &amp;quot;&lt;br /&gt;\n&amp;quot;);

            if (string.Compare(G_site.site_id, string.Empty) != 0)
            {
                LiteralWelcome.Text += &amp;quot;(&amp;quot; + G_site.site_id + &amp;quot;)&amp;quot;;
            }

            else if (string.Compare(G_site.consortia_id, string.Empty) != 0)
            {
                LiteralWelcome.Text += &amp;quot;(&amp;quot; + G_site.consortia_id + &amp;quot;)&amp;quot;;
            }

            LiteralWelcome.Text += &amp;quot;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;\n&amp;quot;;
            LiteralWelcome.Text += &amp;quot;&lt;/tr&gt;\n&amp;quot;;
        }




    }




And form admin.aspx I am trying to call this function. I am not sure how to do that or if you can. I know this SiteName(sender,e);  will not work because the function is in the header.ascx code behind.


Is it possible to do this. Call a function in a included user controls code behind? Header.ascx is a webusercontrol in admin.aspx</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2474982.aspx</link><pubDate>Tue, 08 Jul 2008 16:16:49 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2474982</guid><dc:creator>sg.microsofttech</dc:creator><author>sg.microsofttech</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2474982.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2474982</wfw:commentRss><description>&lt;p&gt;Make sure that you are calling Page.DataBind().&lt;/p&gt;&lt;p&gt;cheers&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2305020.aspx</link><pubDate>Thu, 17 Apr 2008 18:48:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2305020</guid><dc:creator>rathergolf</dc:creator><author>rathergolf</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2305020.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2305020</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m running into this same thing a LOT!&amp;nbsp; I have a web site project that was created in VS05 and runs great. I&amp;#39;ve tried to move some of the pages to a VS08 project and I get the &amp;quot;Function Not Delcared&amp;quot; error. I also periodically get an error that a variable hasn&amp;#39;t been declared in the code behind the page for a simple label that exists in the page.&amp;nbsp; What is the deal with VS???&amp;nbsp; Has anyone discovered why this happens??&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2290337.aspx</link><pubDate>Thu, 10 Apr 2008 22:21:49 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2290337</guid><dc:creator>quizwedge</dc:creator><author>quizwedge</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2290337.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2290337</wfw:commentRss><description>&lt;p&gt;okay, that&amp;#39;s bizarre... now it&amp;#39;s working fine.&amp;nbsp; Oh, well, I guess I just shouldn&amp;#39;t question it. :)&amp;nbsp; At least I know that what I did is correct.&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Dan&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2287882.aspx</link><pubDate>Thu, 10 Apr 2008 02:39:11 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2287882</guid><dc:creator>Thomas Sun – MSFT</dc:creator><author>Thomas Sun – MSFT</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2287882.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2287882</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for your response.&lt;/p&gt;
&lt;p&gt;Does the codebehind class have a namespace? If yes, we need to add the namespace in the Inherits section&amp;nbsp;of&amp;nbsp;Page directive. In your case,&amp;nbsp;I cannot see the namespace in the codebehind, but you use a namespace in the Inherits section&amp;nbsp;of&amp;nbsp;this Page directive. For more information about Page directive, see &lt;a href="http://msdn2.microsoft.com/en-us/library/ydy4x04a(VS.80).aspx"&gt;http://msdn2.microsoft.com/en-us/library/ydy4x04a(VS.80).aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hope this helps.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2287666.aspx</link><pubDate>Wed, 09 Apr 2008 22:50:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2287666</guid><dc:creator>quizwedge</dc:creator><author>quizwedge</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2287666.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2287666</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I tried switching from # to = and still got the Name &amp;#39;f_MyFunction&amp;#39; is not declared.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2285990.aspx</link><pubDate>Wed, 09 Apr 2008 10:05:05 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2285990</guid><dc:creator>Thomas Sun – MSFT</dc:creator><author>Thomas Sun – MSFT</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2285990.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2285990</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;quizwedge:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; 
&lt;p&gt;Weird... here&amp;#39;s the entire code of a sample page that&amp;#39;s erroring... just in case I missed something (I only changed the main project name to MyProject for security reasons).&amp;nbsp; The solution has two projects, UserInterface and BusinessLogic.&amp;nbsp; The BusinessLogic project is just a bunch of classes.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;----ASPX page&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;%@ Page Language=&amp;quot;vb&amp;quot; AutoEventWireup=&amp;quot;false&amp;quot; MasterPageFile=&amp;quot;~/MyProject.Master&amp;quot; CodeBehind=&amp;quot;zTestForForum.aspx.vb&amp;quot; Inherits=&amp;quot;UserInterface.zTestForForum&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; title=&amp;quot;Untitled Page&amp;quot; %&amp;gt;&lt;br /&gt;&amp;lt;asp:Content ID=&amp;quot;Content1&amp;quot; ContentPlaceHolderID=&amp;quot;ContentPlaceHolder1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%#f_MyFunction(1)%&amp;gt;&lt;br /&gt;&amp;lt;/asp:Content&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;----CodeBehind&lt;/p&gt;
&lt;p&gt;Public Partial Class zTestForForum&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inherits System.Web.UI.Page&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Function f_MyFunction(ByVal ID As Integer) As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return ID.ToString&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;br /&gt;&lt;br /&gt;End Class &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Dan&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp; 
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The expression inside &amp;lt;%# %&amp;gt; will be executed only when DataBind method is called. The expression inside &amp;lt;%= %&amp;gt; will be executed when it appears in the page. &lt;/p&gt;
&lt;p&gt;In your case, you can use the &lt;em&gt;&lt;strong&gt;&amp;lt;%=f_MyFunction(1) %&amp;gt;.&lt;/strong&gt;&lt;/em&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hope this helps.&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2285142.aspx</link><pubDate>Wed, 09 Apr 2008 00:57:10 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2285142</guid><dc:creator>quizwedge</dc:creator><author>quizwedge</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2285142.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2285142</wfw:commentRss><description>&lt;p&gt;Weird... here&amp;#39;s the entire code of a sample page that&amp;#39;s erroring... just in case I missed something (I only changed the main project name to MyProject for security reasons).&amp;nbsp; The solution has two projects, UserInterface and BusinessLogic.&amp;nbsp; The BusinessLogic project is just a bunch of classes.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;----ASPX page&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;lt;%@ Page Language=&amp;quot;vb&amp;quot; AutoEventWireup=&amp;quot;false&amp;quot; MasterPageFile=&amp;quot;~/MyProject.Master&amp;quot; CodeBehind=&amp;quot;zTestForForum.aspx.vb&amp;quot; Inherits=&amp;quot;UserInterface.zTestForForum&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; title=&amp;quot;Untitled Page&amp;quot; %&amp;gt;&lt;br /&gt;&amp;lt;asp:Content ID=&amp;quot;Content1&amp;quot; ContentPlaceHolderID=&amp;quot;ContentPlaceHolder1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%#f_MyFunction(1)%&amp;gt;&lt;br /&gt;&amp;lt;/asp:Content&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;----CodeBehind&lt;/p&gt;&lt;p&gt;Public Partial Class zTestForForum&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inherits System.Web.UI.Page&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Function f_MyFunction(ByVal ID As Integer) As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return ID.ToString&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;br /&gt;&lt;br /&gt;End Class &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Dan&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2285130.aspx</link><pubDate>Wed, 09 Apr 2008 00:43:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2285130</guid><dc:creator>RJA</dc:creator><author>RJA</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2285130.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2285130</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;The code you&amp;#39;ve shown should work - it looks good.&amp;nbsp; I&amp;#39;ve created a Master Page w/a content page and a myFunction as you&amp;#39;ve described to test it out and it works great.&amp;nbsp; Is the ID parameter set somewhere else or used in a data binding expression?&amp;nbsp; Perhaps if you can post the rest of the functions code if possible that might point toward what the problem is.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2285101.aspx</link><pubDate>Wed, 09 Apr 2008 00:10:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2285101</guid><dc:creator>quizwedge</dc:creator><author>quizwedge</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2285101.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2285101</wfw:commentRss><description>&lt;p&gt;Just to clarify, the function is in the content page codebehind.&amp;nbsp; The function is called from the content page as well.&amp;nbsp; Thanks.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2282907.aspx</link><pubDate>Tue, 08 Apr 2008 07:45:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2282907</guid><dc:creator>quizwedge</dc:creator><author>quizwedge</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2282907.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2282907</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;It&amp;#39;s in the content page as part of the page&amp;#39;s class.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2282369.aspx</link><pubDate>Tue, 08 Apr 2008 01:59:43 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2282369</guid><dc:creator>RJA</dc:creator><author>RJA</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2282369.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2282369</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Check to see where you are calling myFunction from - the content page or master page and where&amp;#39;s it defined, in the content page or master page?&amp;nbsp; If myFunction is defined in the master page you may need to use the Me.Master property to access it and call it. &lt;br /&gt; &lt;/p&gt;</description></item><item><title>Calling a Public Function from the ASPX page</title><link>http://forums.asp.net/thread/2282291.aspx</link><pubDate>Tue, 08 Apr 2008 00:46:29 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2282291</guid><dc:creator>quizwedge</dc:creator><author>quizwedge</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2282291.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1012&amp;PostID=2282291</wfw:commentRss><description>&lt;p&gt;I know I did this in Visual Studio 2003 (ASP.NET 1.1), but can&amp;#39;t seem to do it in Visual Studio 2005 (ASP.NET 3.5?). I&amp;#39;ve got a page that&amp;#39;s part of a master page.&amp;nbsp; The project is an AJAX project.&amp;nbsp; From the aspx page, I&amp;#39;m trying to call myFunction(ID) with the following: &amp;lt;%# myFunction(ID) %&amp;gt;.&amp;nbsp; On the codebehind page, I have the following as part of the partial public class:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Function myFunction(ByVal ID As Integer) As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return ID.ToString&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;My function actually does more, but I figured I&amp;#39;d keep things simplified.&amp;nbsp; Visual Studio 2005 says &amp;quot;Name &amp;#39;myFunction&amp;#39; is not declared&amp;quot;.&amp;nbsp; What am I doing wrong?&amp;nbsp; This worked great in Visual Studio 2003.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Dan&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>