Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Basic question

Reply
Thread Tools

Basic question

 
 
Paul K
Guest
Posts: n/a
 
      11-07-2003
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
 
Reply With Quote
 
 
 
 
Jan Limpens
Guest
Posts: n/a
 
      11-07-2003
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


 
Reply With Quote
 
 
 
 
Paul K
Guest
Posts: n/a
 
      11-07-2003
jj,

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

Paul K
 
Reply With Quote
 
Keith
Guest
Posts: n/a
 
      11-07-2003
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
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TurboTax Basic vs. Taxcut Basic? Sharp Dressed Man Computer Support 1 01-12-2009 12:52 PM
What is the difference between Visual Basic.NET and Visual Basic 6? Jimmy Dean Computer Support 3 07-25-2005 07:05 AM
Re: Python interpreter in Basic or a Python-2-Basic translator. rrr@ronadam.com Python 0 05-02-2005 01:48 PM
Python interpreter in Basic or a Python-2-Basic translator. Engineer Python 6 05-01-2005 10:16 PM
Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET Jaime MCSD 2 09-20-2003 05:16 AM



Advertisments