Results 1 to 11 of 11

Thread: No buttons

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Posts
    15

    Unhappy No buttons

    Hi,
    just fiddling at "Hello World" stage. With .NET professional installed on a Win2000 professional machine, when I try creating and running a simple asp.net app with one button on it and labels - all I get is the labels on the subsequent web page through IE.
    Can anyone explain and help me please - where has the button gone?

    Cheers.

  2. #2
    Hyperactive Member kleptos's Avatar
    Join Date
    Aug 2001
    Location
    The Dark Carnival
    Posts
    346
    If you could post the source of the page your missing the button im sure we can figure it out for you.
    ..::[kleptos]::..
    • Database Administrator (MSSQL 2000)
    • Application Developer (C#)
    • Web Developer (ASP.NET)


  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    a Web Form button? As in
    <asp:Button blah blah>
    ??

    If so...does it have the runat="server" attribute in it? If it doesnt that would keep the button fropm showing.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    haven't done enough experimenting myself to see if it needs the />, but it might.... just try somethin like this:

    <asp:Button
    id="Blah"
    Text="MyButton"
    OnClick="NameofSubHere"
    Runat="Server" />

    that will make a button with an id of blah (so u can do stuff like Blah.Visible = False), and the button will read MyButton, and when you click it, it will call NameofSubHere.

    Runat="Server" kinda turns it into a .net button..

    also, i think it helps to have that button in a form tag

    so really you'd have somethin like:

    <form Runat="Server">

    <asp:Button
    id="Blah"
    Text="MyButton"
    OnClick="NameofSubHere"
    Runat="Server" />

    </form>

    try that out.

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    well you always need to close a tag anyway..whether this is forced by ASP .NET, I dont know, but it should always be done anyway

    Also the button does not HAVE to be ina form tag...only if you want it to do something..:P

    The button should still appear regardless.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    true..

    you're not getting any errors on the page in the browser?

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    well he said that just the button does not show but the labels do..that is why I said he may be missing the runat="server" as without it, there wont be any error, it will be sent to the browser as is but the browser wont recognize the <asp:button...>
    and wont do anything with it.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  8. #8

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Posts
    15

    the code

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebAppTest.WebForm1"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 214px; POSITION: absolute; TOP: 155px" runat="server" Text="Button" Width="125px" Height="54px" BackColor="Red" BorderStyle="Groove" ForeColor="Black"></asp:Button>
    </form>
    </body>
    </HTML>

  9. #9
    pvb
    Guest
    Using beta 2 code the following shows a button(with your style), click the button and hello world gets stamped where the label control is located(all asp.net tags must be closed properly, the compiler will let you know in detail if they're not):
    Code:
    <script language="vb" runat="server">
    Sub myButton_OnClick(s As Object, e As EventArgs)
    	myLabel.Text = "<p>Hello World!</p>"
    End Sub
    </script>
    <html>
      <head>
        <title></title>
      </head>
      <body>
        <form id="Form1" method="post" runat="server">
    		<asp:Button id="myButton" 
    			style="Z-INDEX: 101; LEFT: 214px; POSITION: absolute; TOP: 155px" 
    			runat="server" 
    			Text="Button" 
    			Width="125px" 
    			Height="54px" 
    			BackColor="Red" 
    			BorderStyle="Groove" 
    			OnClick="myButton_OnClick"
    			ForeColor="Black"/>
    		<asp:Label Runat="server"
    			id="myLabel"/>
        </form>
      </body>
    </html>

  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Posts
    15

    Talking Solved!!!

    Just for other people who may suffer same problem:
    I found out that ASP.NET won't work if you install the .NET framework before you install IIS - like I did. In the help there is a command line instruction which repairs this. However, I had tried this before but didn't notice a syntax error in the instruction (there is an extra space in the command) but I think I didn't get any indication that it had not performed. Anyway all is well now - I think!

  11. #11
    Lively Member
    Join Date
    Jul 2002
    Location
    Gateshead, UK
    Posts
    101

    God damn XHTML/.net...

    <topic breaker: DO NOT BOTHER READING IF YOU WANT TO STICK TO THE TOPIC...>

    Don't know about you people, but I find the idea of having to type in, for example, "value='value'", a bit stupid, when there is a default in normal HTML... XHTML has some crazy syntax rules...

    Jus' gettin' that of my chest - it's kinda the wrong place though lol... Nevermind - sorry folks...

    P.S: I don't really like "<br />" either - standard "<br>" works just fine, etc! ARGH...
    <% Session("OwNeD")=True %><html><body>Blah... <%="Now get your ass back to the twilight zone..."%></body></html>

Posting Permissions

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



Click Here to Expand Forum to Full Width