Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET with Text Editor

Status
Not open for further replies.

shalni

Programmer
Oct 16, 2003
12
0
0
IN
I want to create a ASP.net page without using Visual Studio. But in the same structure i.e., i want to have a .aspx file, a .aspx.cs file and a class file. I am using Notepad to create these files.

I created these 3 files in a virtual directory and incuded the following code in the beginning of the aspx page:

<%@ Page language=&quot;c#&quot; Codebehind=&quot;Translator.aspx.cs&quot; AutoEventWireup=&quot;false&quot; Inherits=&quot;TranslatorClass&quot; src=&quot;TranslatorClass.cs&quot;%>

I created both the classes in the same namespace.

But when i access this page thru browser i get this error:

CS0117: 'ASP.Translator_aspx' does not contain a definition for 'butTranslate_Click'

Source Error:



Line 5: <asp:label id=&quot;ss&quot; text=&quot;<b>Universal Translator</b>&quot; font=&quot;Bold, Large&quot; runat=&quot;server&quot; /><br>
Line 6: <asp:textbox id=&quot;txtSource&quot; TextMode=&quot;MultiLine&quot; runat=&quot;server&quot; />
Line 7: <asp:button id=&quot;butTranslate&quot; Text=&quot;Translate&quot; AutoPostBack=&quot;true&quot; onClick=&quot;butTranslate_Click&quot; runat=&quot;server&quot; />
Line 8: </form>


This method butTranslate_Click has been defined in the Translator.aspx.cs file.

Please tell me where i am wrong and what i need to do in order to run ASP.net pages like these without VS.net


 
VS.Net includes the following code in its code behind pages for initialization. Make sure that you include it as well:

Also have you compiled the .cs file and placed the dll in your bin directory? If not try that as well.


VS.Net designer generated code:

override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}

One other thing, you may want to try web Matrix ( or #Develop ( instead of notepad as an editor. Both are free.

VB Rookie
 
well, i had included the designer generated code. But had not compiled the cs files. now i have for Translator.aspx file --> two cs files one is Translator.aspx.cs and TranslatorClass.cs file. Shud i compile both? and how do i compile them? Please help
 
Yes you should compile both if both are referenced. As far as compiling ... honestly I don't know how to do it via the command line.

The way I've done it without VS.Net was through Web Matrix. There is an add-on for it called the one-to-many compiler reloaded. I used that and it worked like a charm. You may want to consider it. Also I believe that #Develop has a mechanism for compiling through their app but I've never used it so I can't say for sure.

VB Rookie
 
I compiled the TranslatorClass.cs using the command csc /t:library then i copied the dll to the bin directory in the virtual folder. but when i tried to compile Translator.aspx.cs it gave me error. Actually in the Translator.aspx.cs file i create an object of the TranslatorClass. so it is giving me error. I actually have created both the classes in the same namespace. Please help!!!!
 
It is giving me error that it might be missing an assembly or namespace reference. It is cuz i am creating an object of TranslatorClass.cs in Translator.aspx.cs. How to solve this?
And BTW how to call a dll in a class file??

Please help me!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top