Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2010
    Posts
    46
    Thanks
    1
    Thanked 1 Time in 1 Post

    New at aspx programming

    New at aspx programming.

    In PHP:

    <?php
    code
    ?>

    How do you program in a .aspx program to get things started?

    Is it only in xml or can you program directly from a Visual Basic program?

    I want to access mysql databases:
    PHP Code:
    <?php
            $conn 
    mysql_connect('localhost''user''pass');
            
    mysql_select_db('db1');
            
    $sqls "UPDATE `register` SET security=1764 WHERE idr=3";
            
    $results mysql_query($sqls$conn);
            
    mysql_close($conn);
    ?>
    Last edited by Philosophaie; 07-03-2012 at 03:56 AM.

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,930
    Thanks
    46
    Thanked 203 Times in 202 Posts
    from my understanding of php, it is more like ASP than aspx... aspx usually utilizes (and IMO should) the code behind files.

    A 'sample' aspx page might have a look like so...
    Code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:Label ID="lbl_Demo" runat="server" Text="Label"></asp:Label>
            <asp:TextBox ID="txt_Demo" runat="server"></asp:TextBox>
            <asp:Button ID="btn_Demo" runat="server" Text="Button" 
                onclick="btn_Demo_Click" />
        </div>
        </form>
    </body>
    </html>
    and then the code behind...
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace WebApplication1
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    lbl_Demo.Text = "Sample 1";
                    txt_Demo.Text = "";
                }
            }
    
            protected void btn_Demo_Click(object sender, EventArgs e)
            {
                lbl_Demo.Text = txt_Demo.Text;
                txt_Demo.Text = "";
            }
        }
    }
    and it would render as...
    Code:
    
    
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head><title>
    
    
    
    </title></head>
    
    <body>
    
        <form method="post" action="WebForm1.aspx" id="form1">
    
    <div class="aspNetHidden">
    
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEzMTc4NjY3NTgPZBYCAgMPZBYCAgEPDxYCHgRUZXh0BQhTYW1wbGUgMWRkZJt1FGwftAzSw6Btk7luA4ajsvpQP8rnbjcBqI0SP3jH" />
    
    </div>
    
    
    
    <div class="aspNetHidden">
    
    
    
    	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwKVyP+aCALBztLIBgLZgJeUDWvmV3gm2pPl2jKIzfQLsY0a5YHNRBF1m4XrlxO+BAv2" />
    
    </div>
    
        <div>
    
            <span id="lbl_Demo">Sample 1</span>
    
            <input name="txt_Demo" type="text" id="txt_Demo" />
    
            <input type="submit" name="btn_Demo" value="Button" id="btn_Demo" />
    
        </div>
    
        </form>
    
    </body>
    
    </html>
    so as you can see... very different than php or ASP

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •