• 0

sample asp.net code??


Question

Can someone post a simple line of ASP.NET code of text box or something??...I'm trying to make one in Notepad, but I keep getting a runtime error...please post the code for VB AND C#, thanks!

On a more or less separate topic...still haven't figured out how to fix my local host problem :(

Can't use VS.net to make ASP.net applications which really ****es me off...:dead:

Link to comment
https://www.neowin.net/forum/topic/19570-sample-aspnet-code/
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Here's a C# example from the docs:

<pre>

<%@ Page Language="C#" %>



<html>

	<head>

  <script language="C#" runat="server">

 	 void SubmitBtn_Click(Object Sender, EventArgs e) {

    Label1.Text = "TextBox1.Text = " + TextBox1.Text;

 	 }

  </script>

	</head>

	<body>

  <h3>TextBox Sample</h3>



  <form runat="server">

 	 <asp:TextBox id="TextBox1" Text="Type some text here" Columns="25" MaxLength="30" runat="server"/>

 	 <asp:Button OnClick="SubmitBtn_Click" Text="Copy Text to Label" Runat="server"/>

 	 <p>

 	 <asp:Label id="Label1" Text="Label1" runat="server"/>

  </form>

	</body>

</html>

</pre>

Link to comment
https://www.neowin.net/forum/topic/19570-sample-aspnet-code/#findComment-164308
Share on other sites

  • 0

Gumboot...that code of yours works even if I don't specify the page language, because the script language is specified. How do I get the same output from specifying the page language, instead of the script language?? I tried to do that in my code, but it gave me a runtime error. What should I do??

Link to comment
https://www.neowin.net/forum/topic/19570-sample-aspnet-code/#findComment-165059
Share on other sites

  • 0

Sorry, sleeping :D

The reason replacing <script language="C#" runat="server"> with <% %> gives you an error is because functions can only be defined with <script> blocks.

In fact, you only need one, to define all your functions. Then use <% %> blocks for the rest of your page.

The page language specifies the language of the <% %> blocks and probably the <script> blocks, by replacing <script language="C#" runat="server"> with <script runat="server">.

Link to comment
https://www.neowin.net/forum/topic/19570-sample-aspnet-code/#findComment-165472
Share on other sites

  • 0
  Quote
Originally posted by timdorr

What channel?

Well, it's on YTV here in Canada for some strange reason at 3:00 AM or so....I've seen them do asp.NET and C# examples and stuff...

I think that you can also see the episodes streaming online from microsoft's site:

http://msdn.microsoft.com/theshow/default.asp

and

http://msdn.microsoft.com/theshow/Overview.asp

Link to comment
https://www.neowin.net/forum/topic/19570-sample-aspnet-code/#findComment-166399
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.