Using the class of a user control in code-behindhttp://forums.asp.net/t/1426138.aspx/1?Using+the+class+of+a+user+control+in+code+behindFri, 22 May 2009 15:42:53 -040014261383179502http://forums.asp.net/p/1426138/3179502.aspx/1?Using+the+class+of+a+user+control+in+code+behindUsing the class of a user control in code-behind <p>I'm having an issue where I want to be able to reference the class of a UserControl in a page, like this</p> <pre class="prettyprint">FooControl foo = (FooControl) LoadControl(&quot;~/controls/FooControl.ascx&quot;); foo.Bar= &quot;Bazbazbaz&quot;; this.Controls.Add(foo);</pre> <p>Where FooControl is a UserControl in the folder &quot;controls&quot;. So far I have figured the following out:</p> <p>1) You must use the @Reference directive at the top of the markup page for each control you want to reference this way (adding an entry in web.config/system.web/pages/controls won't work)<br> 2) You don't need to have the @Register directive or an instance of the control on the page.<br> 3) The control needs to have a &quot;ClassName&quot; attribute defined in it's @Control tag. For inline controls, this is already done. For code-behind, you have to add that to the tag in the ascx file (I've tested it)<br> <span style="font-style:italic">4) You can't do this from a code-behind file</span>. <span style="font-style:italic">It just doesn't work, and complains it can't find the class FooControl (&quot;</span><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><b>Compiler Error Message: </b>CS0246: The type or namespace name 'FooControl' could not be found (are you missing a using directive or an assembly reference?)<span style="font-style:italic">&quot;)</span></font></p> <p>Point 4 is what I'm trying to figure out. I can't put the control in declaritively in the mark-up, and I don't want to have an interface for every control I need. I haven't been able to find any answers for this question, except maybe one article that I read that said &quot;you can't use code-behind if you want to do this&quot;. I'm hoping to get to the bottom of this. I'm hoping some expert out there can give me an answer and tell me a solution. Or at least a definite answer. And if this isn't possible. <span style="font-style:italic">Why not?</span> Thanks,<br> Anthony Aziz<br> </p> 2009-05-21T21:06:24-04:003179778http://forums.asp.net/p/1426138/3179778.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>That code should work.&nbsp; If you are not using the type FooControl using the exact namespace and class path (I guess you would call it), then you need to be sure that at the top of the code file, you import the namespace.</p> <p>&nbsp;</p> <p>For example, if your control path is &quot;~/controls/FooControl.ascx&quot; and your project namespace is Project, then instead of:</p> <p>&nbsp;</p> <p>FooControl foo = etc.</p> <p>you must write</p> <p>Project.controls.FooControl foo = etc.</p> <p>&nbsp;</p> <p>unless at the top, you include that namespace, like in C# writing:</p> <p>using Project.controls;</p> <p>&nbsp;</p> <p>granted, this will only work if you did not change the code-behinds namespace, as Visual Studio automatically gives it the namespace based upon Project name and the folder path to where you had it create the control. <br> </p> 2009-05-22T02:20:58-04:003180718http://forums.asp.net/p/1426138/3180718.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>&nbsp;This is caused by changes in the ASP.NET 2.0 compilation model. The new dynamic compilation for pages and user controls has the side-effect of making their types more difficult to reference. The best solution is to create a base class for your control which exposes the functionality you need, and reference that instead. Have a look at <a href="http://www.west-wind.com/presentations/AspNetCompilation/AspNetCompilation.asp"> this article</a> for more info. HTH<br> </p> 2009-05-22T11:21:50-04:003180928http://forums.asp.net/p/1426138/3180928.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>&nbsp;Thank you both for replying. Talk about a long article. I'll be sure to look into it in more detail later. I'm going to see if jzimmerman's solution will work first. I have considered creating an interface in App_Code for each control... but that can be annoying, and perhaps there's another way. I'm just confused as to why the difference between code-behind and inline impacts so heavily on this issue.</p> <p>&nbsp;As to referencing the control by namespace, I'll be sure to try that (as soon as I get VS up on this slow computer). I haven't put anything in a namespace (perhaps I should?), so you're saying the FQN is &lt;ProjectName&gt;.controls.FooControl ? (I hope this works for nested folders, as the actual control is ~/controls/reports/ReportForm.ascx. Normally, I wouldn't doubt it, but there's been too many surprises). I'm going to try this out, but one thing I can forsee is not knowing the project name. I'm connected to localhost (and it's not something I can change, this is the way the development machines are set up here). What would the project name be, then?</p> <p>Again, Thanks, I welcome more advice and explanations! <br> </p> 2009-05-22T13:01:04-04:003181078http://forums.asp.net/p/1426138/3181078.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>it may also depend upon what type of project you are doing.&nbsp; (you mentioned that you have an app_code folder, and i think that app_code folders are only used in web sites, not web apps.)</p> <p>with a web app, you control source files look something like this:</p> <p>&nbsp;</p> <pre class="prettyprint">using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace XUCS.code.controls { public partial class CourseDisplay : System.Web.UI.UserControl {</pre> <p>&nbsp;&nbsp;</p> <p>the namespace line is automatically generated to be ProjectNamespace.ParentFolder.ChildFolder</p> <p>&nbsp;</p> <p>&nbsp;for web site projects, the namespace block is removed, but now the class name (that is, if kept as default) reflects the controls folder path.&nbsp; so all there would be to define the control would be </p> <p>public partial class Code_Controls_CourseDisplay : System.Web.UI.UserControl</p> <p>&nbsp;</p> <p>&nbsp;So, if you are using a web site project, then you should already be doing it right, as long as you are sure you are using the full class name on the controls code file.</p> <p>&nbsp;</p> <p>Instead of referring to your code via a general example, could you possibly post (or email me) the actual code you are using? <br> </p> 2009-05-22T14:05:13-04:003181096http://forums.asp.net/p/1426138/3181096.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>WELL, after restarting VS and waiting 20 minutes for it to load (yeah, I know, a new workstation is in the works...), I believe I've got something.</p> <p>I started with a using clause, then browed through the namespaces IntelliSense brought up. I looked throught the unusualy sounding ones, and found one called &quot;ASP&quot;. IntelliSense showed me there were a few classes in there... related to some (but not all) of my UserControls, and no child namespaces. So I simply put &quot;using ASP&quot;, and it worked, at least for my test were the page and the control are in the same directory. Now, to test a more realistic situation.</p> <p>I'll post more when I find out more. <br> </p> 2009-05-22T14:17:08-04:003181121http://forums.asp.net/p/1426138/3181121.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>Sorry jzimmerman, posted before I read your reply. Let me gather the code and post it. I'll have to edit it to take out database and server paths, but the actual code shouldn't be too big an issue.</p> <p>The project <i>is</i> a Web Site Project, I think. How I opened it, Open Website &gt; IIS &gt; localhost. And I tried the full class name (_controls_reports_ReportForm), but it was the same issue. If I put ClassName=&quot;ReportForm&quot; in the markup file, I can reference it by that name anyways.</p> <p>The issue was referencing in the code-behind file of an aspx page. I think the namespace was the issue. And I think the ASP namespace only contains controls where you use the &lt;%@ Reference Control=&quot;...&quot; %&gt; to reference the file. I'm still testing. Thanks for the advice, again. <br> </p> 2009-05-22T14:27:29-04:003181133http://forums.asp.net/p/1426138/3181133.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>as long as the control is visible in the namespace you referenced, it really shouldn't matter whether the page is in the same folder as the control.</p> <p>&nbsp;</p> <p>you might want to check the controls that you said were not listed under the namespace, and see which namespace they belong to in their code file, just so you would know for future reference.<br> </p> 2009-05-22T14:32:11-04:003181154http://forums.asp.net/p/1426138/3181154.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>I just played around with a few things, and in a new web site project, i could only use controls in the code-behind that were referenced in the aspx markup using the &lt;%@ Reference %&gt; tag.</p> <p>&nbsp;</p> <p><strike>The ASP namespace you imported must have been written into the control code files, it is not generated by default i dont believe.&nbsp; if you check a control's code that is in that namespace, then it probably has the ASP namespace declaration.&nbsp; The controls that you noticed were missing probably have not had that namespace added to them yet.</strike></p> <p>&nbsp;Actually, i think you are right about the ASP namespace thing.&nbsp; I added a reference tag to a page real quick, and the class appeared in the ASP namespace. <br> </p> 2009-05-22T14:41:51-04:003181209http://forums.asp.net/p/1426138/3181209.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>Okay, I figured it out (with help to you guys, of course!). The namespace is &quot;ASP&quot; for this website. I don't know why, but it is. I'll give a little background. I started at this company in October, and I didn't start working on the web application until February. The software is a subscriber based web application spread across multiple server farms. It was originally done in classic ASP, and only a few new parts are being coded in ASP.NET (my Crystal Reports module is one of them). Everyone has a copy of the webapp in there local IIS folder, so I connect to the website under localhost IIS. It has a lot of .asp and other files, so it's not a deployed project. I save the pages I work on, then browse to http://localhost/apage.aspx to test.</p> <p>There is no namespace in the code-behind files. From your post it sounds likes the ASP namespace is the default namespace for controls referenced. Anyways, this works for me. I'll post the relevant code. You won't be able to run it, there's some framework objects there that are just to complicated to post.<br> </p> <p>Here's the page:</p> <p>&nbsp;&nbsp;</p> <pre class="prettyprint">&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeFile=&quot;ReferencingControlsIncodeBehind.aspx.cs&quot; Inherits=&quot;_test_ReferencingControlsIncodeBehind&quot; %&gt; &lt;%@ Reference Control=&quot;~/_test/WebUserControlInline.ascx&quot; %&gt; &lt;%@ Reference Control=&quot;~/_test/WebUserControlCodebehind.ascx&quot; %&gt; &lt;%@ Reference Control=&quot;~/controls/reports/ScheduledReports.ascx&quot; %&gt; &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt; &lt;head runat=&quot;server&quot;&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt; &lt;div&gt; &lt;asp:PlaceHolder ID=&quot;placeholder&quot; runat=&quot;server&quot;&gt;&lt;/asp:PlaceHolder&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre>&nbsp;<p>&nbsp;</p><p>&nbsp;And the code behind:</p><p>&nbsp;&nbsp;</p><pre class="prettyprint"><span class="kwd">using</span> System;<br><span class="kwd">using</span> System.Collections;<br><span class="kwd">using</span> System.Configuration;<br><span class="kwd">using</span> System.Data;<br><span class="kwd">using</span> System.Web;<br><span class="kwd">using</span> System.Web.Security;<br><span class="kwd">using</span> System.Web.UI;<br><span class="kwd">using</span> System.Web.UI.HtmlControls;<br><span class="kwd">using</span> System.Web.UI.WebControls;<br><span class="kwd">using</span> System.Web.UI.WebControls.WebParts;<br><br><span class="kwd">using</span> ASP;<br><br><span class="kwd">public</span> partial <span class="kwd">class</span> _test_ReferencingControlsIncodeBehind : System.Web.UI.Page<br>{<br> <span class="kwd">protected override void</span> OnInit(EventArgs e)<br> {<br> WebUserControlInline inline = (WebUserControlInline)LoadControl(<span class="st">"WebUserControlInline.ascx"</span>);<br> inline.Text = <span class="st">"INLINE"</span>;<br> placeholder.Controls.Add(inline);<br><br> WebUserControlCodebehind codebehind = (WebUserControlCodebehind)LoadControl(<span class="st">"WebUserControlCodebehind.ascx"</span>);<br> codebehind.Text = <span class="st">"CODE BEHIND"</span>;<br> placeholder.Controls.Add(codebehind);<br><br> ScheduledReports scheduledReports = (ScheduledReports)LoadControl(<span class="st">"~/controls/reports/ScheduledReports.ascx"</span>);<br> XmlReportScheduler scheduler = <span class="kwd">new</span> XmlReportScheduler(Application[<span class="st">"app_imagingserver1"</span>].ToString(), 479);<br> scheduler.oabcode = 0;<br> scheduledReports.LoadSchedules(scheduler, 479);<br> placeholder.Controls.Add(scheduledReports);<br><br> <span class="kwd">base</span>.OnInit(e);<br> }<br>}<br><br></pre>&nbsp;<p>&nbsp;</p><p>And the ReportScheduler.ascx</p><p>&nbsp;</p><pre class="prettyprint">&lt;%@ Control Language="C#" AutoEventWireup="false" CodeFile="ScheduledReports.ascx.cs" Inherits="controls_reports_ScheduledReports" ClassName="ScheduledReports"%&gt;<br>&lt;<span class="tag">asp:Repeater</span><span class="attr"> ID=</span><span class="attrv">"reportList"</span><span class="attr"> runat=</span><span class="attrv">"server"</span>&gt;<br> &lt;<span class="tag">HeaderTemplate</span>&gt;<br> &lt;<span class="tag">table</span>&gt;<br> &lt;<span class="tag">tr</span>&gt;<br> &lt;<span class="tag">td</span>&gt;Scheduled Report &lt;<span class="tag">em</span>&gt;(Click to modify)&lt;/<span class="tag">em</span>&gt;&lt;/<span class="tag">td</span>&gt;<br> &lt;<span class="tag">td</span>&gt;Created By&lt;/<span class="tag">td</span>&gt;<br> &lt;<span class="tag">td</span>&gt;Last Modified&lt;/<span class="tag">td</span>&gt;<br> &lt;<span class="tag">td</span>&gt;Last Ran&lt;/<span class="tag">td</span>&gt;<br> &lt;<span class="tag">td</span>&gt;Delete&lt;/<span class="tag">td</span>&gt;<br> &lt;/<span class="tag">tr</span>&gt;<br> &lt;/<span class="tag">HeaderTemplate</span>&gt;<br> &lt;<span class="tag">ItemTemplate</span>&gt;<br> &lt;<span class="tag">tr</span>&gt;<br> &lt;<span class="tag">td</span>&gt;&lt;<span class="tag">asp:LinkButton</span><span class="attr"> ID=</span><span class="attrv">"editLink"</span><span class="attr"> CommandName=</span><span class="attrv">"edit"</span><span class="attr"> CommandArgument=</span><span class="attrv">"<span class="dir">&lt;%#</span> ((ScheduledReport)Container.DataItem).File <span class="dir">%&gt;</span>"</span><span class="attr"> runat=</span><span class="attrv">"server"</span>&gt;<span class="dir">&lt;%#</span> ((ScheduledReport)Container.DataItem).File.Replace(".xml", "") <span class="dir">%&gt;</span>&lt;/<span class="tag">asp:LinkButton</span>&gt;&lt;/<span class="tag">td</span>&gt;<br> &lt;<span class="tag">td</span>&gt;<span class="dir">&lt;%#</span> ((ScheduledReport)Container.DataItem).UserId <span class="dir">%&gt;</span>&lt;/<span class="tag">td</span>&gt;<br> &lt;<span class="tag">td</span>&gt;<span class="dir">&lt;%#</span> ((ScheduledReport)Container.DataItem).Modified.ToString(XmlReportScheduler.LIF_DATE_FORMAT) <span class="dir">%&gt;</span>&lt;/<span class="tag">td</span>&gt;<br> &lt;<span class="tag">td</span>&gt;<span class="dir">&lt;%#</span> ((ScheduledReport)Container.DataItem).LastRan &gt; DateTime.MinValue ? ((ScheduledReport)Container.DataItem).LastRan.ToString(XmlReportScheduler.LIF_DATE_FORMAT) : "Never" <span class="dir">%&gt;</span>&lt;/<span class="tag">td</span>&gt;<br> &lt;<span class="tag">td</span>&gt;&lt;<span class="tag">asp:LinkButton</span><span class="attr"> ID=</span><span class="attrv">"deleteLink"</span><span class="attr"> CommandName=</span><span class="attrv">"delete"</span><span class="attr"> CommandArgument=</span><span class="attrv">"<span class="dir">&lt;%#</span> ((ScheduledReport)Container.DataItem).File <span class="dir">%&gt;</span>"</span><span class="attr"> runat=</span><span class="attrv">"server"</span>&gt;Delete&lt;/<span class="tag">asp:LinkButton</span>&gt;&lt;/<span class="tag">td</span>&gt;<br> &lt;/<span class="tag">tr</span>&gt;<br> &lt;/<span class="tag">ItemTemplate</span>&gt;<br> &lt;<span class="tag">FooterTemplate</span>&gt;<br> &lt;<span class="tag">tr</span>&gt;<br> &lt;<span class="tag">td</span><span class="attr"> colspan=</span><span class="attrv">"5"</span>&gt;Total scheduled reports: <span class="dir">&lt;%#</span> Container.ItemIndex <span class="dir">%&gt;</span>&lt;/<span class="tag">td</span>&gt;<br> &lt;/<span class="tag">tr</span>&gt;<br> &lt;/<span class="tag">table</span>&gt;<br> &lt;/<span class="tag">FooterTemplate</span>&gt;<br>&lt;/<span class="tag">asp:Repeater</span>&gt;<br></pre>&nbsp;<br><p>&nbsp;</p><p>And it's code behind: </p><p>&nbsp;</p><pre class="prettyprint"><span class="kwd">using</span> System;<br><span class="kwd">using</span> System.Collections;<br><span class="kwd">using</span> System.Collections.Generic;<br><span class="kwd">using</span> System.Configuration;<br><span class="kwd">using</span> System.Data;<br><span class="kwd">using</span> System.Web;<br><span class="kwd">using</span> System.Web.Security;<br><span class="kwd">using</span> System.Web.UI;<br><span class="kwd">using</span> System.Web.UI.HtmlControls;<br><span class="kwd">using</span> System.Web.UI.WebControls;<br><span class="kwd">using</span> System.Web.UI.WebControls.WebParts;<br><br><span class="kwd">public</span> partial <span class="kwd">class</span> controls_reports_ScheduledReports : System.Web.UI.UserControl<br>{<br> <span class="kwd">public event</span> CommandEventHandler EditSchedule;<br> <span class="kwd">public event</span> CommandEventHandler DeletedSchedule;<br><br> <span class="kwd">protected override void</span> OnLoad(EventArgs e)<br> {<br> reportList.ItemCommand += <span class="kwd">new</span> RepeaterCommandEventHandler(reportList_ItemCommand);<br> <span class="kwd">base</span>.OnLoad(e);<br> }<br><br> <span class="kwd">public void</span> LoadSchedules(XmlReportScheduler scheduler, <span class="kwd">int</span> mabcode)<br> {<br> List&lt;ScheduledReport&gt; reports = scheduler.GetScheduledReportSummaries(mabcode);<br><br> <span class="kwd">if</span> (reports.Count &lt; 1)<br> {<br> reportList.Controls.Clear();<br> reportList.DataSource = <span class="kwd">null</span>;<br> }<br> <span class="kwd">else</span><br> {<br> reportList.DataSource = reports;<br> reportList.DataBind();<br> }<br> }<br><br> <span class="kwd">private void</span> reportList_ItemCommand(<span class="kwd">object</span> source, RepeaterCommandEventArgs e)<br> {<br> <span class="kwd">if</span> (e.CommandName == <span class="st">"edit"</span>)<br> {<br> <span class="kwd">if</span> (EditSchedule != <span class="kwd">null</span>)<br> {<br> EditSchedule(<span class="kwd">this</span>, <span class="kwd">new</span> CommandEventArgs(<span class="st">"filename"</span>, e.CommandArgument));<br> }<br> }<br> <span class="kwd">else if</span> (e.CommandName == <span class="st">"delete"</span>)<br> {<br> <span class="kwd">if</span> (DeletedSchedule != <span class="kwd">null</span>)<br> DeletedSchedule(<span class="kwd">this</span>, <span class="kwd">new</span> CommandEventArgs(<span class="st">"filename"</span>, e.CommandArgument));<br> }<br><br> }<br>}<br><br></pre>&nbsp;&nbsp; <p>&nbsp;</p> <p>&nbsp;</p> 2009-05-22T15:08:34-04:003181214http://forums.asp.net/p/1426138/3181214.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>the more i think about it, i dont think that you can use namespaces in code files, since you are using a web site project.&nbsp;</p> <p>with a web app project, all the code is compiled into an actual .dll library, whereas with a web site, the code is not compiled this way.&nbsp; since with a web app all the code is in one assembly, it can contain things like namespaces, but with a web site, the code files are just code files, and since they are not in an assembly, they cannot be contained in things like namespaces.<br> </p> 2009-05-22T15:10:34-04:003181239http://forums.asp.net/p/1426138/3181239.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>from what ive been playing around with (i use web apps instead of web sites, so i dont know too much about their differences), it seems that the ASP namespace is an &quot;on-the-fly&quot; namespace.&nbsp; if you have two different pages, and look at the ASP namespace for each, then you will find that they do not show the same things.&nbsp; by default, it looks as if for each page, their ASP namespace allows access to the current page for which you are working on.&nbsp; then, when you add Reference tags, the controls you reference for that page become visible only in that pages ASP namespace. (this would explain why earlier, not all of the controls in the directory where you put them were visible in the ASP namespace).<br> </p> <p>&nbsp;</p> <p>as i said in my previous post, web sites are not compiled into an assembly.&nbsp; This would also mean that your web site project does not actually have a namespace to it. <br> </p> 2009-05-22T15:19:36-04:003181245http://forums.asp.net/p/1426138/3181245.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>Yeah, I've read into the Website-VS-Webapp bit, and see what you mean. Well, I edited my above post, that solution worked. The rules as I understand them:</p> <ol> <li>The control needs to have a ClassName tag in the &lt;%@ Control %&gt; tag (actually, I think if it doesn't you'll use the generated class name?)<br> </li><li>The page has to use a &lt;%@ Reference %&gt; tag in the .aspx file to reference the control</li><li>If page uses a code-behind file, the namespace &quot;ASP&quot; contains all controls reference with the &lt;%@ Reference %&gt; tag. If it's inline code, there's no need for this.</li></ol> Again, thanks for all the help. Now, back to the problem that got me into this in the first place. I may have to make yet another post :S<br> <br> EDIT: We're playing some weird post tag here. I read your other reply, yes thats right, all the controls reference and the actual page class itself, from what I can see.<br> 2009-05-22T15:22:45-04:003181287http://forums.asp.net/p/1426138/3181287.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p></p> <blockquote><span class="icon-blockquote"></span> <h4>aazizorg</h4> <p></p> <li>The control needs to have a ClassName tag in the &lt;%@ Control %&gt; tag (actually, I think if it doesn't you'll use the generated class name?)<br> </li></blockquote> <p>ClassName i believe will only override the name of the class as defined in the code-behind. <br> </p> <br> its good though that you've gotten this problem worked out.&nbsp; sorry i couldn't have given you a more direct answer from the beginning; i'm still in the learning stages with this stuff.<br> <br> and, it probably would be a good idea to post a new thread for your other problem.<br> 2009-05-22T15:40:32-04:003181291http://forums.asp.net/p/1426138/3181291.aspx/1?Re+Using+the+class+of+a+user+control+in+code+behindRe: Using the class of a user control in code-behind <p>I think I've got a work around for that problem that better suits the situation anyways.</p> <p>You actually helped me a lot. I didn't know what kind of response I'd get on these forums, but so far looks pretty helpful, I'm glad I posted. <br> </p> 2009-05-22T15:42:53-04:00