Basic question

Discussion in 'ASP .Net' started by Paul K, Nov 7, 2003.

  1. Paul K

    Paul K Guest

    I'm having a bit of trouble understanding how to get an
    asp.net page to look and feel like the asp page I have
    already created. It's a basic login page, which I have
    attempted to create in the vs html editor as so (just the
    form code):

    <form id="Form1" method="post" runat="server">

    <asp:table id="Table1" runat="server"
    HorizontalAlign="Center" CssClass="LogInHead"
    Width="300px">

    <asp:TableRow CssClass="LogIn">
    <asp:TableCell Text="Log In to EPES"></asp:TableCell>
    </asp:TableRow>

    </asp:table>

    <asp:table id="Table2" HorizontalAlign="Center"
    CssClass="LogInBody" Width="300px" Runat="server">

    <asp:TableRow>
    <asp:TableCell CssClass="LogInDesc" Text="User
    ID:"></asp:TableCell>
    <asp:TableCell CssClass="LogInCtrl">
    <asp:TextBox ID="txtUID" runat="server" Width="150px"
    MaxLength="20" />
    </asp:TableCell>
    </asp:TableRow>

    <asp:TableRow>
    <asp:TableCell CssClass="LogInDesc"
    Text="Password:"></asp:TableCell>
    <asp:TableCell CssClass="LogInCtrl">
    <asp:TextBox ID="txtPassword" Runat="server"
    Width="150px" MaxLength="20" TextMode="Password" />
    </asp:TableCell>
    </asp:TableRow>

    <asp:TableRow>
    <asp:TableCell>
    <asp:Button ID="btnSubmit" Runat="server" Text="Log In" />
    </asp:TableCell>
    </asp:TableRow>
    </asp:table>
    </form>

    I have tried to drag a button on to the table control in
    the designer (which didn't work). The method I have used
    above displays the page the way I want it to, but I can't
    seem to find a way to link the controls (specifically the
    button) to a server-side event.

    Any help (or any links) would be greatly appreciated.

    Paul K
     
    Paul K, Nov 7, 2003
    #1
    1. Advertising

  2. Paul K

    Jan Limpens Guest

    the table control you are using is for showing data or programatically
    adressing it somehow. for your example you do not neet this, draw a
    normal table instead (from the menu bar, bot the toolbox). ie use
    <table>, not <asp:table>.

    jj

    Paul K wrote:

    > I'm having a bit of trouble understanding how to get an
    > asp.net page to look and feel like the asp page I have
    > already created. It's a basic login page, which I have
    > attempted to create in the vs html editor as so (just the
    > form code):
    >
    > <form id="Form1" method="post" runat="server">
    >
    > <asp:table id="Table1" runat="server"
    > HorizontalAlign="Center" CssClass="LogInHead"
    > Width="300px">
    >
    > <asp:TableRow CssClass="LogIn">
    > <asp:TableCell Text="Log In to EPES"></asp:TableCell>
    > </asp:TableRow>
    >
    > </asp:table>
    >
    > <asp:table id="Table2" HorizontalAlign="Center"
    > CssClass="LogInBody" Width="300px" Runat="server">
    >
    > <asp:TableRow>
    > <asp:TableCell CssClass="LogInDesc" Text="User
    > ID:"></asp:TableCell>
    > <asp:TableCell CssClass="LogInCtrl">
    > <asp:TextBox ID="txtUID" runat="server" Width="150px"
    > MaxLength="20" />
    > </asp:TableCell>
    > </asp:TableRow>
    >
    > <asp:TableRow>
    > <asp:TableCell CssClass="LogInDesc"
    > Text="Password:"></asp:TableCell>
    > <asp:TableCell CssClass="LogInCtrl">
    > <asp:TextBox ID="txtPassword" Runat="server"
    > Width="150px" MaxLength="20" TextMode="Password" />
    > </asp:TableCell>
    > </asp:TableRow>
    >
    > <asp:TableRow>
    > <asp:TableCell>
    > <asp:Button ID="btnSubmit" Runat="server" Text="Log In" />
    > </asp:TableCell>
    > </asp:TableRow>
    > </asp:table>
    > </form>
    >
    > I have tried to drag a button on to the table control in
    > the designer (which didn't work). The method I have used
    > above displays the page the way I want it to, but I can't
    > seem to find a way to link the controls (specifically the
    > button) to a server-side event.
    >
    > Any help (or any links) would be greatly appreciated.
    >
    > Paul K
     
    Jan Limpens, Nov 7, 2003
    #2
    1. Advertising

  3. Paul K

    Paul K Guest

    jj,

    Thanks! The asp.net paradigm makes much more sense to me
    now.

    Paul K
     
    Paul K, Nov 7, 2003
    #3
  4. Paul K

    Keith Guest

    There are a few ways to link an event to a button.

    1. You can specify in the ASP:Button tag an OnClick that
    has a method. This will require that you know the
    parameters of the method Object o, System.EventArgs e

    2. double click on the button in design view. This is
    for those who are either 1 lazy and looking for a
    shortcut, or 2 don't know how the programming language
    uses Methods. This method will create the shell of a
    function for you with the parameters and draw the mapping
    between the button and the event method. This method
    does not always work depending on how technical your page
    is and if you have your button nested in a grid, etc.

    3. (this if for the VB developers) Create a button in
    HTML, Create a Method in the code. After the method
    declaration, append Handles buttonname.click

    4. (this is for the C# developers) Create a button in
    the HTML, Create your method with the appropriate
    parameters. Go to the System Generated code
    InitializeCompontent section and create your Delegate
    method reference. For example...
    this.btnCancel.Click += new System.EventHandler
    (this.btnCancel_Click);


    If you realy want to understand what is going on, you
    should use either option 3 or option 4. It will make you
    a better programmer in the long run.

    Good Luck,

    Keith

    >-----Original Message-----
    >I'm having a bit of trouble understanding how to get an
    >asp.net page to look and feel like the asp page I have
    >already created. It's a basic login page, which I have
    >attempted to create in the vs html editor as so (just

    the
    >form code):
    >
    ><form id="Form1" method="post" runat="server">
    >
    ><asp:table id="Table1" runat="server"
    >HorizontalAlign="Center" CssClass="LogInHead"
    >Width="300px">
    >
    ><asp:TableRow CssClass="LogIn">
    ><asp:TableCell Text="Log In to EPES"></asp:TableCell>
    ></asp:TableRow>
    >
    ></asp:table>
    >
    ><asp:table id="Table2" HorizontalAlign="Center"
    >CssClass="LogInBody" Width="300px" Runat="server">
    >
    ><asp:TableRow>
    ><asp:TableCell CssClass="LogInDesc" Text="User
    >ID:"></asp:TableCell>
    ><asp:TableCell CssClass="LogInCtrl">
    ><asp:TextBox ID="txtUID" runat="server" Width="150px"
    >MaxLength="20" />
    ></asp:TableCell>
    ></asp:TableRow>
    >
    ><asp:TableRow>
    ><asp:TableCell CssClass="LogInDesc"
    >Text="Password:"></asp:TableCell>
    ><asp:TableCell CssClass="LogInCtrl">
    ><asp:TextBox ID="txtPassword" Runat="server"
    >Width="150px" MaxLength="20" TextMode="Password" />
    ></asp:TableCell>
    ></asp:TableRow>
    >
    ><asp:TableRow>
    ><asp:TableCell>
    ><asp:Button ID="btnSubmit" Runat="server" Text="Log

    In" />
    ></asp:TableCell>
    ></asp:TableRow>
    ></asp:table>
    ></form>
    >
    >I have tried to drag a button on to the table control in
    >the designer (which didn't work). The method I have

    used
    >above displays the page the way I want it to, but I

    can't
    >seem to find a way to link the controls (specifically

    the
    >button) to a server-side event.
    >
    >Any help (or any links) would be greatly appreciated.
    >
    >Paul K
    >.
    >
     
    Keith, Nov 7, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Duenser

    Basic shifting question

    Stefan Duenser, Dec 7, 2004, in forum: VHDL
    Replies:
    4
    Views:
    444
    Stefan Duenser
    Dec 8, 2004
  2. Replies:
    1
    Views:
    584
    Eric Smith
    Jul 8, 2005
  3. Engineer
    Replies:
    6
    Views:
    630
    Jeremy Bowers
    May 1, 2005
  4. Replies:
    0
    Views:
    441
  5. Ark Khasin

    A basic question question about volatile use

    Ark Khasin, Jul 31, 2008, in forum: C Programming
    Replies:
    12
    Views:
    360
    Ark Khasin
    Jul 31, 2008
Loading...

Share This Page