![]() |
| ||
| App_Code and control Hey, I have a this readblog.cs file in projects App_Code folder, and at main folder I have Blog.aspx -> Blog.aspx.cs file. And I have a Table control in Blog.aspx file, called Bloglist, and I am trying to modify it from App_Code/readblog.cs class file and I dont know how to use Using statements or something like that to get reference so I could use Bloglist at App_Code folder? . here's a snippet from both of files-> ---------------------------- Down under App_Code/readblog.cs ---------------------------- using System;and somewhere down here is that this.Bloglist item, and it doesnt find it (of course, cause theres not a reference to the Blog.aspx.cs file, and I dont know how to do it? I have tryed namespaces and etc, maeby im just confused cause its in the App_Code folder ---------------------------- Down under blog.aspx.cs ---------------------------- using System; THX! <- Noob! |
| ||
| Re: App_Code and control When using a website project, you don't need to worry about namespaces. Anything in App_Code is automatically available in the pages in the rest of the site (for better or worse). The code you posted should work (assuming readblog has a constructor that accepts a string parameter). Are you getting a compilation error? |
| ||
| Re: App_Code and control Quote:
Yeah it works that way, no problem in there, but other way around. I have this code in App_Code/readblog.cs file void RebuildBlogPage(DataSet ds) Error -> 'readblog' does not contain a definition for 'BlogTable' and no extension method 'BlogTable' accepting a first argument of type 'readblog' could be found (are you missing a using directive or an assembly reference?) And that BlogTable is at ~/Blog.aspx file? |
| ||
| Re: App_Code and control I'm assuming that's some code that's been moved from an ASPX page's code behind into its own class? It sounds like BlogTable was a control on that page. If so, what you probably need to do is have RebuildBlogPage return a Table. Something like: Table RebuildBlogPage(DataSet ds) Then, in your ASPX page, you would add the return value of that method to the controls collection of your page, placeholder, panel, or whatever you're using for layout. |
| ||
| Re: App_Code and control Now we are getting to point. But my knowledge is not enough yet, ill past both codes here Blog.aspx.cs using System; and App_Code/readblog.cs using System; Now it's mixed with that return table. Everything else is original, i tried somethings. Now I have to return that table over to Blog.cs somehow....? Thx allready, it would be nice if i could figure it out on my own, but just cant :( |
| ||
| Re: App_Code and control Okay, with that in mind, things are going to be a little different. Doing something like this for your readblog class would be a step in the right direction: using System; Then, in Blog.aspx.cs, you could add that table to the page like this: using System; Before going too far, it might not hurt for you to take a look at some tutorials on object oriented design and programming. That's what's at the heart of this. Getting off to the right start with it will make things go much more smoothly. |
| ||
| Re: App_Code and control Hey buddy, Blogtable was a table runat the server. It could not find the table, so therefore it is not referenced. Create a server controlled table on the page with the ID of "BlogTable". |
| ||
| Re: App_Code and control That wouldn't work for what he's doing, because the readblog.cs class trying to reference BlogTable isn't in the scope of the Page (though, it looks like it probably was at one point). |
| ||
| Re: App_Code and control Thx mates. I know and I am reading couple of books now from wrox. Thx, have to try that at home at learn whats happening in there :) |
| All times are GMT -4. The time now is 11:16 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC