New ASP.net Problem

trewyn15

Limp Gawd
Joined
May 7, 2013
Messages
274
Hey guys, have another ASP.net problem. This one's a little more complicated but not too bad. I think I have the general layout and such done as I built from an older program of mine.

It is supposed to be pulling the information from the file DBSAMPLE.mdb. This code is currently pulling from something else, I cannot find where it is pulling though.

Here is the task:



Here is my current code:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="C#" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Organization Chart Updates</title>
<style type="text/css">
.auto-style1 {
	text-align: left;
}
</style>
</head>

<body>


<h2 class="auto-style1">Lab 8 - Airplane Seat Locations:</h2>
<form id="form" runat="server">
	
	 <div class="auto-style1">
	
	 <asp:FormView
        id="FormView1"
        DataKeyNames="Id"
        DataSourceId="orgChart"
        DefaultMode="Edit"
        AllowPaging="True"
        Runat="server">
        <EditItemTemplate>
        <asp:Label
            id="lblSeat"
            Text="Seat Number:"
            AssociatedControlID="txtSeat"
            Runat="server" />
        <asp:TextBox
            id="txtSeat"
            Text='<%#Bind("Seat")%>'
            Runat="server" />
        <br />     
        <asp:Label
            id="lblPassenger"
            Text="Passenger Name:"
            AssociatedControlID="txtPassenger"
            Runat="server" />
        <asp:TextBox
            id="txtPassenger"
            Text='<%#Bind("Passenger")%>'
            Runat="server" />
        <br />     
        <asp:Label
            id="lblClass"
            Text="Class:"
            AssociatedControlID="txtClass"
            Runat="server" />
        <asp:TextBox
            id="txtClass"
            Text='<%#Bind("Class")%>'
            Runat="server" />
        <br />     
        <asp:Label
            id="lblTicket"
            Text="Ticket Price:"
            AssociatedControlID="txtTicket"
            Runat="server" />
        <asp:TextBox
            id="txtTicket"
            Text='<%#Bind("Ticket")%>'
            Runat="server" />
        <br />     
        <asp:Label
            id="lblFrequent"
            Text="Frequent Flyer:"
            AssociatedControlID="txtFrequent"
            Runat="server" />
        <asp:TextBox
            id="txtFrequent"
            Text='<%#Bind("Frequent")%>'
            Runat="server" />
        <br />   
       
        <br />     


        <asp:Button
            id="btnEdit"
            Text="Edit"
            CommandName="EditCommand"
            Runat="server" />  
            
		<asp:Button 
			runat="server" 
			Text="Delete" 
			id="btnDelete"/> 
		<asp:Button
			runat="server" 
			Text="New"
			id="btnNew"/>
        </EditItemTemplate>
    </asp:FormView> 
	
	 </div>


<center>
	
	 <asp:SqlDataSource
        id="orgChart"
        SelectCommand="SELECT Name, Title, Reports_To, Department, Telephone, Email, Id FROM [Organization Chart Data]"
        UpdateCommand="UPDATE [Organization Chart Data] SET Name=@Name,Title=@Title, Reports_To@Reports_To, Department=@Department, Telephone=@Telephone, Email=@Email where Id=@Id, Name=@Name,Title=@Title, Reports_To@Reports_To, Department=@Department, Telephone=@Telephone, Email=@Email"
        ConnectionString="<%$ ConnectionStrings:Orgchart %>"
        ProviderName="<%$ ConnectionStrings:Orgchart.ProviderName %>"
        Runat="server" />

</form>
</center>
</body>
</html>

and here is my current output:



I think I'm close but I'm not 100% sure, as I'm having a little trouble understanding ASP.net.

Any help is appreciated!
 
Look into the GridView control, instead of the FormView control.

Edit:
This code is currently pulling from something else, I cannot find where it is pulling though.
Look into your SqlDataSource definition.


Second Edit:
Thinking more about this thread and your previous thread, is your teacher ignoring the code-behind files in their lessons and/or examples?
 
Last edited:
What does your output look like when actually executed, rather than in just the design window?
 
The question you should be asking yourself is: "Where in my code is the data source associated with the page control(s)". Find that, and work back from there.
 
Back
Top