The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Web Programming > ASP / ASP.NET


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags: , , , , ,

Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 06-29-2007, 12:40 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,118
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Icon9 Help with ASP.NET C# Form

This is the .aspx code that I currently have:

Default.aspx

PHP Code:
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!
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>Untitled Page</title>
</
head>
<
body>
   <
form id="Form1" runat="server">
      
What is your name?<br />
      <
asp:Textbox ID="Textbox1" Runat="server"></asp:Textbox><br />
      <
asp:Button ID="Button1" Runat="server" Text="Submit"
       
OnClick="Button1_Click" />
      <
p><asp:Label ID="Label1" Runat="server"></asp:Label></p>
   </
form>
</
body>
</
html
This one is the Default.aspx.cs

PHP Code:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default System.Web.UI.Page
{
    
protected void Button1_Click(object senderEventArgs e)
    {
        
Label1.Text "Hello " Textbox1.Text;
    }

I don't see if there's anything wrong on my codes, but the result is not as waht I expected to be. The form loads as expected, but when I type in input value to the textbox, it doesn't return me anything ;-/ It basically just stays on the same page, and showing the same thing.... thx for the help... appreciate it!!!

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #2 (permalink)  
Old 06-30-2007, 02:48 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,118
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Icon13

Haha, I got the form works with this
I'm extremelly happy!!! haha...

PHP Code:
<html>
<
head runat="server">
    <
title>My First ASP.NET Page</title>
    <
script language="C#" runat="server">
        
void Button_OnClick(object SourceEventArgs e)
        {
            
result.Text "Hello " name.Text;
        }
    
</script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:TextBox ID="name" runat="server"></asp:TextBox><br />
        <asp:Button Text="submit" runat="server" OnClick="Button_OnClick" />
        <p>
            <asp:Label ID="result" runat="server"></asp:Label>
        </p>
    </form>
</body>
</html> 
I'm now going to try to get it working with the Behind Code.. haha... hopefully it would work, isn't it just going to be the same thing but I just need to move this code below to the Default.aspx.cs right?

PHP Code:
    <script language="C#" runat="server">
        
void Button_OnClick(object SourceEventArgs e)
        {
            
result.Text "Hello " name.Text;
        }
    
</script> 

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

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



All times are GMT -7. The time now is 08:19 AM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50