.NET Framework - How to populate a asp:Repeater from a base class?
Asked By sonic
28-Dec-07 09:02 AM
Hi,
What is the best way of populating a repeater control from a SQL Database
using a base class. I am trying to impliment a base class that can be used
across future websites and will populate a repeater control on the aspx page.
The logic is losing me a bit as it seems wrong to try to access the control
from a base class but I can't seem to get the base class to work correctly
unless I copy all the html code into the base class and write it out which
also seems wrong?
Any help would be appreciated?
Thanks.
BaseClass.MainPage
(1)
Repeater
(1)
MainPage
(1)
Database
(1)
Impliment
(1)
Sonicm
(1)
Dec
(1)
Ignacio Machin \( .NET/ C# MVP \) replied...
Hi,
Usually the repeater's content is declared in the aspx page. I have never
seen it done othewise.
I do not understand what you mean with a "base class", could you explain
further?
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
sonic replied...
Hi,
Yes sorry, I am (cough for an exam) creating a web page, that needs to show
some data from SQL. However, part of it is that similar pages in the future
will need to show the data in the future. So I have created a base class to
come off the main aspx page.
The only problem is that I don't know how to show the data on the aspx page
from the base class as it cannot see any of the controls on the main page?
So:
page1.aspx
page1.aspx.cs
This has dec (public partial class _Default : BaseClass.MainPage ) in it.
Then the base class
MainPage.cs
This has the dec ( public class MainPage : System.Web.UI.Page ) in it.
Well it seems that it all compiles and runs ok but I cannot access any of
the aspx objects from the base class MainPage.CS
Hope this helps with the explination?
Ignacio Machin \( .NET/ C# MVP \) replied...
Hi,
What if you create an user control instead?
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.

articles I have read about TDD, a good unit test does not rely on the database or other such external / environmental conditions. More generally, a good unit test is atomic and developing unit tests for a DAL - whose purpose in life is to interact with a database? Your thoughts and opinions are appreciated. C# Discussions ADO.NET (1) LLBLGen (1) ASP.NET (1) IIS (1) Application (1) Database (1) Adapter (1) Report (1) I would test the behavior in the DAL. I m Model View * Patterns* view parts 1-5 The unit test needs to create a new database in a known state, open it using the DAL under test, verify the results, clean up the database. Ben, Then it wont be a unit test in the TDD sense. In fact i still develop the test before the code. You could even use the test to drive database layout (this might not be very effective at normalization though). Absolutely, I agree. In fact thats how i would even design my Database tables. Similar to what Ben said, We used to have a "test database (or one of each, mssql, mysql, oracle) that each time would be cleaned out and
NET database inspection API? .NET Framework Is there a straightfoward API in .NET that allows for inspection of a database? That is, to look at the structure of the database, without knowing anything in advance about it? For example, retrieving a list of tables in the database. Doing a little browsing in MSDN, I see that the abstract representation of a database appears to be the DataSet class. I also see that I can use database to a DataSet. Because for example DataSet.Tables returns a collection of tables in the database, I thought this might be useful. However, it looks to me as though the connection can only be made with some advance knowledge of the database. It appears that to get a data adapter hooked up to a database requires the
for table .NET Framework Hi, How do I check if a table exists in my database? - - Thanks Morris ASP.NET Web Controls Discussions SQL Server (1) CALLMasterMDB (1) OleDbConnection.GetSchema (1 TABLES Check the result you can see all the base tables and views of the database. Please let me know if it works. If you have further questions please feel free column to be visible if a table (mailboxactivitylog) exists in either the sql or access database bound to the gridview via datasource. How do I check if this table exists? I correct you have two questions: 1. How to know if a tables exists in the database. 2. How to hide a column of a GridView manually. To the first question, we can query the database to see all the tables in it. Then check if the table exists in the database. Generally database has some system tables that can help to do this. For SQL Server, it's So we can use the following query: SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES For Access database we use MSysObjects. Here's the query for Access: Select Name from MSysObjects We can
am trying to write a program that will save a connection string for any ODBC database. I cannot find the equivalent of 'cnn.Properties("Prompt") = 2' in ADO.Net. I am thirteen years ago by OleDb: http: / / msdn.microsoft.com / en-us / library / ms810892.aspx http: / / database.ittoolbox.com / documents / odbc-vs-oledb-18150 The very first version of the .NET Framework Providers about 10 years ago and these providers are available in .NET. Depending on the database you are using, you will need a specific provider with a specific connection string to them up each time. In this particular case, my program will conect to an Oracle database, but I do not have Oracle here. I am too lazy to make a trip my program (to convert an XML file into records in a table) against an Oracle database. There does not seem to be a .NET provider for MS Access, and even if there were, I would have to write different code depending on the database that I was connecting to: dim cnn as JetConnection 'or something like that and change is expected to work with, so I do not have to support an arbitrary unknown database, I still want to be able to use the program with a database other than Access or Oracle. If the OleDB provider has its own login dialog box
Any Option to Save Changes to Database? .NET Framework Okay, I finally got databases working with my ASP.NET projects. Now, I m back to WinForms so here we go again. I understand that when creating a database file in my project, the default settings is to silently wipe out any existing data I'm creating a test project in VS 2005 that uses a SQL Server Express database. I then created a Windows form and bound my edit controls to a table in the database. I'm able to add any number of records and browse through them. But, again want to keep any data they created. Does anyone know the trick to making my database changes permanent? Thanks. - - Jonathan Wood SoftCircuits Programming http: / / www.softcircuits.com ADO.NET Discussions SQL Copy to Ouput" option. Kerry Moorman Kerry is right. When you incorporate the SQL Server database (file) into your project, it too is subject to the infamous "Copy to Output" setting s Guide to Visual Studio and SQL Server (7th Edition) _ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ _ If I select the database under Data Connections in the Server Explorer, there's only a couple of properties and re all greyed out anyway. As I think I mentioned, I'm not attaching a database file. It's a SQL Server Express database. So where would I got to find