Newbie Questions

  • Thread starter Thread starter Meir Rotfleisch
  • Start date Start date
M

Meir Rotfleisch

HI

Well I again have some initial questions.

I have created an app that connects to a MDB file. It runs fine in
development but when I put the files onto the live site it doesn't run my
quess is that the ConnectionString needs to be changed What or Where should
I be placing the MDB on the Live server?

Second question is how do I get an project to inhertit all webforms from a
webform that I created? Is it done only during runtime?

Meir
 
I have created an app that connects to a MDB file. It runs fine in
development but when I put the files onto the live site it doesn't run my
quess is that the ConnectionString needs to be changed What or Where should
I be placing the MDB on the Live server?

It doesn't really matter where you place the .mdb file, as long as your
Connection String references the location correctly.
Second question is how do I get an project to inhertit all webforms from a
webform that I created? Is it done only during runtime?

Hard to answer. What do you mean by "inherit...from a webform?" I suspect
that you mean that you want all your Pages to inherit from a single Page
class. That can be tricky as well, if, for example, you mean that you want
to inherit both the CodeBehind and Page Template, which can't be done with
the current version of ASP.Net. Your page classes can inherit from a single
Page class, but that is not the same as the Page Template, which also
inherits from a Page class. So, you need to be more specific about exactly
what you want to inherit, and what you want to inherit from.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 
If I understood your "inheritance" question, then the answer is as follows:


Create a new class file with the following header:

Public Class myRootWebPage

Inherits System.Web.UI.Page

add all your stuff here that should be available to all derived classes
End Class


Now, whenever you create a new webform, switch to Code View, and change the
line that looks like this
Inherits System.Web.UI.Page

to read like this
Inherits myRootWebPage
 
Kevin Hi

Thanks for your response



Since in development the Connection String is mapped to the local host on D:
drive how do I find the serverpath so that its server independant?

About the inheritance I basically want all the webforms that I add to the
application automatically have the same logo,Headers,and Menus. I guess I
could save it a Template however in what directory does Visual Studio .Net
look for the templates? and what extension do I save it as?

Thanks

Meir
 
Hi Meir,
Since in development the Connection String is mapped to the local host on D:
drive how do I find the serverpath so that its server independant?

It sounds like your .mdb file is somewhere inside your web, which is a good
thing, as you can use Server.MapPath(url) to get the absolute file path to
the database. Just put the URL of the .mdb file in as a parameter. For
example, if your database is in a folder named "db" just under the root of
your app, you can use:

string s = Server.MapPath("/db/myDatabase.mdb");
About the inheritance I basically want all the webforms that I add to the
application automatically have the same logo,Headers,and Menus. I guess I
could save it a Template however in what directory does Visual Studio .Net
look for the templates? and what extension do I save it as?

Yes, that's what I was afraid of. There are rumors that the next version of
ASP.Net (codename "Whidbey") will enable the developer to inherit both the
CodeBehind class and Page template, but that is not possible at present. I
think you might want to look at using User Controls for the common elements
in your ASP.Net pages as an alternative.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 
You could always place the header information in a Web Control (.ascx file).
Then you create a custom tag to embed the control in your .aspx page. I.e.:

<!-- This goes at the top of your page, just beneath the reference to the
default page language -->
<% Register TagPrefix="yourPrefix" TagName="Header" src="controlname.ascx"
%>

That creates a custom tag which you can then place in your code like so:

<yourPrefix:Header ID="whatever" Runat="server">

In this instance, by making it a control, you can have a code behind as
well. You can respond to menu selections, page navigation, etc. in the
control.

HTH

Flynn
 
Back
Top