Asp.Net Forme primjer Dataview kontrole

Dataview Select, updatue i delete komande, u asp:SqlDataSource  dio koda nalazi se ConnetionString za povezivanje sa Sql Server Bazom podataka te Select, update i Delete SQL komande koje se izvršavaju u Dataview-u, tu je važno dodati @id parametar.  


<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

    <div>

        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:SQLConn %>"
            SelectCommand="SELECT TOP (100) PERCENT id, ime, prezime, email, password, countLogin FROM  dbo._logins"
            UpdateCommand="UPDATE [_logins] SET [ime] = @ime,[prezime] = @prezime, [email] = @email, [password] = @password WHERE [id] = @id"
            DeleteCommand="DELETE FROM dbo._loginLogs WHERE [idLogin] = @id; DELETE FROM dbo._logins WHERE [id] = @id" runat="server">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>

                <asp:Parameter Name="ime" Type="String" />
                <asp:Parameter Name="prezime" Type="String" />
                <asp:Parameter Name="email" Type="String" />
                <asp:Parameter Name="password" Type="String" />

                <asp:Parameter Name="id" Type="Int32" />
            </UpdateParameters>

        </asp:SqlDataSource>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>

        <div class="row">
            <div class="col-md-12">
                <h2>Korisnici:</h2>
                <asp:GridView ID="GridView1" CssClass="table" runat="server" DataKeyNames="id" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True" ForeColor="#333333" GridLines="None" CellPadding="4">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True" SortExpression="id" />
                        <asp:BoundField DataField="ime" HeaderText="Name" SortExpression="Name" />
                        <asp:BoundField DataField="prezime" HeaderText="Prezime" />
                        <asp:BoundField DataField="countLogin" HeaderText="Br. logiranja" />
                        <asp:BoundField DataField="email" HeaderText="Email" />
                        <asp:BoundField DataField="password" HeaderText="Lozinka" />
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ID="ibEdit" runat="server" CommandName="Edit" ToolTip="Edit" ImageUrl="~/icon/edit.png" />
                                <asp:ImageButton ID="ibSelect" runat="server" CommandName="Delete" OnClientClick="return confirm('Potvrdite brisanje korisnika?');" ToolTip="Delete" ImageUrl="~/icon/delete.gif" />
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:ImageButton ID="ibUpdate" runat="server" CommandName="Update" ImageUrl="~/icon/update.png" />
                                <asp:ImageButton ID="ibCancel" runat="server" CommandName="Cancel" ImageUrl="~/icon/cancel.png" />
                            </EditItemTemplate>
                        </asp:TemplateField>
                    </Columns>

                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
            </div>
            <div class="col-md-12">
                <h2>Novi:</h2>
                <div class="form-group">
                    <asp:TextBox ID="tIme" class="form-control" placeholder="Ime" runat="server" ControlToValidate="tIme"></asp:TextBox>
                    <asp:RequiredFieldValidator ValidationGroup="group1" ID="RequiredFieldValidator1" runat="server" ErrorMessage="Obavezno polje" ClientIDMode="Static" ControlToValidate="tIme" Display="Dynamic"></asp:RequiredFieldValidator>
                </div>
                <div class="form-group">
                    <asp:TextBox ID="tPrezime" class="form-control" placeholder="Prezime" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ValidationGroup="group1" Display="Dynamic" ID="RequiredFieldValidator2" runat="server" ErrorMessage="Obavezno polje" ClientIDMode="Static" ControlToValidate="tPrezime"></asp:RequiredFieldValidator>
                </div>

                <div class="form-group">
                    <asp:TextBox ID="tEmail" class="form-control" placeholder="Email" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ValidationGroup="group1" Display="Dynamic" ID="RequiredFieldValidator3" runat="server" ErrorMessage="Obavezno polje" ClientIDMode="Static" ControlToValidate="tEmail"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ValidationGroup="group1" ID="RegularExpressionValidator1" runat="server" ErrorMessage="Email nije ispravan" Display="Dynamic" ClientIDMode="Static" ControlToValidate="tEmail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                </div>

                <div class="form-group">
                    <asp:TextBox ID="tLozinka" class="form-control" placeholder="Lozinka" runat="server"></asp:TextBox>
                </div>
                <div>
                    <asp:Button runat="server" ValidationGroup="group1" class="form-control btn btn-primary" Text="Dodaj novog korisnika" OnClick="_Click" />
                </div>
            </div>
        </div>
        


            </ContentTemplate>

        </asp:UpdatePanel>

    </div>



</asp:Content>