<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="addpoint.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="sinistra" runat="Server">
    <asp:Label ID="usersinistra" runat="server" Text="Label" Visible="False"></asp:Label>
    Da questa pagina puoi aggiungere o rimuovere i tuoi datapoint.
    <br />
    <br />
    <h2>
        I tuoi datastream:</h2>
    <asp:DataList ID="DataList1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
        BorderWidth="1px" CellPadding="2" DataKeyField="id_datastream" DataSourceID="AccessDataSource1"
        ForeColor="Black">
        <AlternatingItemStyle BackColor="PaleGoldenrod" />
        <FooterStyle BackColor="Tan" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <ItemTemplate>
            ID:
            <asp:Label ID="id_datastreamLabel" runat="server" Text='<%# Eval("id_datastream") %>' />
            <br />
            Descrizione:
            <asp:Label ID="descriptionLabel" runat="server" Text='<%# Eval("description") %>' />
            <br />
            <br />
        </ItemTemplate>
        <SelectedItemStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
    </asp:DataList>
    <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/ASPNetDB.mdb"
        
        SelectCommand="SELECT [reg_time], [id_datastream], [description] FROM [datastreams] WHERE ([user] = ?)">
        <SelectParameters>
            <asp:ControlParameter ControlID="usersinistra" Name="user" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
    </asp:AccessDataSource>
    <br />
    <br />
    <div class="menu1">
        <ul>
            <li class="menu-01">
                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/code/mypage.aspx">My Page</asp:HyperLink></li>
            <li class="menu-02">
                <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/code/addstream.aspx">DataStreams Settings</asp:HyperLink></li>
        </ul>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="destra" runat="Server">
    <asp:Label ID="userdestra" runat="server" Text="Label" Visible="False"></asp:Label>
    <h2>DataPoints Adding</h2>
    
    ID_DataStream:
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="AccessDataSource2"
        DataTextField="id_datastream" DataValueField="id_datastream">
    </asp:DropDownList>
    <asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/ASPNetDB.mdb"
        SelectCommand="SELECT [id_datastream] FROM [datastreams] WHERE ([user] = ?)">
        <SelectParameters>
            <asp:ControlParameter ControlID="userdestra" Name="user" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
    </asp:AccessDataSource>
    <br />
    Value:
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Add" OnClick="Button1_Click" />
    <br />
    <br />
    <h2>
        DataPoints Deleting</h2>
    ID_DataPoint:
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    <asp:Button ID="Button2" runat="server" Text="Delete" OnClick="Button2_Click" />
    <br />
    <br />
    <asp:Image ID="Image1" runat="server" ImageUrl="~/images/ok.jpg" Visible="False"
        Height="100px" Width="100px" />
    <asp:Image ID="Image2" runat="server" ImageUrl="~/images/no.jpg" Visible="False"
        Height="100px" Width="100px" />
    <br />
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label><br />
    <asp:Label ID="Label2" runat="server" Text=""></asp:Label><br />
    <asp:Label ID="Label3" runat="server" Text=""></asp:Label><br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" BackColor="LightGoldenrodYellow" BorderColor="Tan" 
        BorderWidth="1px" CellPadding="2" DataSourceID="AccessDataSource4" 
        EnableModelValidation="True" ForeColor="Black" GridLines="None" 
        AutoGenerateColumns="False" DataKeyNames="id" Width="575px">
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
        <Columns>
            <asp:BoundField DataField="my_datastream" HeaderText="ID_Datastream" 
                SortExpression="my_datastream" />
            <asp:BoundField DataField="data" HeaderText="Data" SortExpression="data" />
            <asp:BoundField DataField="ip" HeaderText="IP" SortExpression="ip" />
            <asp:BoundField DataField="id" HeaderText="ID_Datapoint" InsertVisible="False" 
                ReadOnly="True" SortExpression="id" />
            <asp:BoundField DataField="myvalue" HeaderText="Value" 
                SortExpression="myvalue" />
        </Columns>
        <FooterStyle BackColor="Tan" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
            HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
    </asp:GridView>
    <br />
<asp:AccessDataSource ID="AccessDataSource4" runat="server" 
    DataFile="~/App_Data/ASPNetDB.mdb" 
    SelectCommand="SELECT * FROM [datapoints] WHERE ([my_datastream] = ?)">
    <SelectParameters>
        <asp:ControlParameter ControlID="DropDownList1" Name="my_datastream2" 
            PropertyName="SelectedValue" Type="Int32" />
    </SelectParameters>
</asp:AccessDataSource>
    <br />
</asp:Content>
