nkeg
05-19-2004, 04:46 AM
I'm writing an application in .net using c#. I want to include a menu that I use on all my files, so I would modify it only once. Any idea how? Because it doesn't support the #include.
|
Click to See Complete Forum and Search --> : including a file nkeg 05-19-2004, 04:46 AM I'm writing an application in .net using c#. I want to include a menu that I use on all my files, so I would modify it only once. Any idea how? Because it doesn't support the #include. PeOfEo 05-19-2004, 03:14 PM well are you just includeing some markup or are you trying to include a script? <!--#include File="includedfile.inc" --> or <!--#include virtual="includedfile.inc" --> is how you include with asp.net, asp classic, and shtml. It will be the same with vb.net c# or anything else. If you need to you can use <% Response.WriteFile ("Yourfile.inc") %> to include the file. nkeg 05-20-2004, 02:41 AM Thank you PeOfEo for your help.Actually only the second worked(Response.WriteFile(("Yourfile.inc")) which was what I needed in my question. But I need to include a connection file but the #include doesn't work, although it's written in msdn. The compiler doesn't recognise the varaible I use in the included file. Any suggestions? Or, can you tell me how make it a class and import it if the include doesn't work? PeOfEo 05-20-2004, 05:50 PM You can't use an include to get variables or scripts. It will not work, the server will parse in the content in the file b eing included but not execute it. Also, using an include tag within a <script> or <% code block %> will fail because they cannot be inside of them. <% Response.WriteFile ("Yourfile.inc") %> would be your only solution. If you want to call an external scripts you can use an external class, a code behind, or using script src <script runat="server" language="VB" src="mycodefile.vb"> webdeveloper.com
Copyright WebMediaBrands Inc., All Rights Reserved. |