locked
puzzled RRS feed

  • Question

  • User65893105 posted

    ive finally managed to get the clubsite starter kit running on a sql server 2000 backend.  Im not very experienced with .net and have a small amount of experinces with version 1.  Im a bit confused about the way code is created.  In version 1, if I placed say a button on a form and doulble clicked it, i'd get a button click method in the code behind page.  With 2005, I get the button click method, but its in with the asp (on the same page)  they were separate before...is this new or am I doing something wrong

    ** visual studio adds this in the asp, what happened to the code behind ????

    <script runat="server">

    protected void LoginButton_Click(object sender, EventArgs e)

    {

    }

    </script>

    Friday, February 24, 2006 7:18 AM

All replies

  • User2069888697 posted

    If you are trying to add a button to one of the pages that came with the starter kit the code is in the same file.

    If it is a page you added you are given the option to place code in a seperate file in the Add New Item dialog box.

    I haven't tried to seperate the code in the original pages, but I don't see any reason you can not do it.

    Friday, February 24, 2006 10:04 AM
  • User1052258516 posted

    The code for the club kit was developed (I assume) to show that you can actually code your pages this way.  If you look at the Personal Starter Kit it is coded with the familiar code behind that we all love about ASP.NET (or do we all).  If you wanted to actually spend the time and make this as a code behind application you could by doing this for each page.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

    1. Create a new class file for each page with the naming scheme PAGENAME.aspx.vb or PAGENAME.ascx.vb<o:p></o:p>
    2. Add the following code to each page (source view) to the <%@ Page tag: CodeFile="PAGENAME.aspx.vb" Inherits="PAGENAME_aspx"<o:p></o:p>
    3. In the code file you would need to replace the "Public Class XXXX" with "Partial Class PAGENAME_aspx : Inherits System.Web.UI.Page"<o:p></o:p>
    4. Then you would need to copy all of the code from the <script runat="server"> tag in the aspx page (source view) to the Partial Class PAGENAME_aspx class.<o:p></o:p>
    5. Once this is done you should probably close the Visual Studio or the Express program and reload the project.  Then try and run it and go through all of the pages and see if the functionality works, you may have to change the scope or visibility of some functions to public so they work.<o:p></o:p>

    One other thing when you create a new class file you will be asked to add it to the App_Code folder if you are doing the code behind thing you probably don't want to do this (for the sake of the IDE more than anything), it should work in theory but I have never tried it myself.<o:p></o:p>

    This is no means how easy it may or may not be I could be totally wrong, but in theory you should be able to code your entire ASP.NET application in notepad and it still work if you do it correctly.

     

    Saturday, February 25, 2006 8:28 PM
  • User392212907 posted

    Can you post the steps you took to get this kit to work with SQL Server 2000? I am trying to accomplish the same thing and cannot get it to work. I have also tried the suggestions on this page http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx but, now I am getting the following error: Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'AP01-063-505\ASPNET'.

    Thanks,
    Joey

     

    Saturday, February 25, 2006 11:58 PM