PDA

Click to See Complete Forum and Search --> : getting started with asp.net


deano1
Jun 6th, 2002, 07:35 AM
Hi All,

Im just getting started with asp.net, haven't got a clue. I've been reading tutorials exctra. Which tend to give code examples but not example how build a project. for example the code below i know it works, so i create a new asp project and put the code in the webform code page. What i get is problems, with putting html in asp page. Never used to be a problem. How are we meant to layout code should html be put somewhere different. In short i need a little help with using the software, not writing the code.

any help would be appreciated.


<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<html>
<head>
<link rel="stylesheet"href="intro.css">
</head>

<script language="VB" runat=server>

Sub SubmitBtn_Click(Sender As Object, E As EventArgs)

Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New SqlConnection("server=localhost;database=pubs;Trusted_Connection=yes")
MyCommand = New SqlDataAdapter("select * from Titles where type='" + Category.SelectedItem.Value + "'", myConnection)

DS = new DataSet()
MyCommand.Fill(DS, "Titles")

MyList.DataSource = DS.Tables("Titles").DefaultView
MyList.DataBind()

End Sub


</script>

<body>

<center>

<form action="intro8.aspx" method="post" runat="server">

<asp:adrotator AdvertisementFile="ads.xml" BorderColor="black" BorderWidth=1 runat="server"/>

<h3> Name: <asp:textbox id="Name" runat="server"/>

Category: <asp:dropdownlist id="Category" runat=server>
<asp:listitem >psychology</asp:listitem>
<asp:listitem >business</asp:listitem>
<asp:listitem >popular_comp</asp:listitem>
</asp:dropdownlist>
</h3>

<asp:button text="Lookup" OnClick="SubmitBtn_Click" runat="server"/>

<p>

<ASP:DataGrid id="MyList" HeaderStyle-BackColor="#aaaadd" BackColor="#ccccff" runat="server"/>

</form>

</center>

</body>

</html>