<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/DB.accdb" DeleteCommand="DELETE FROM [cargo] WHERE [código] = ?" InsertCommand="INSERT INTO [cargo] ([código], [cargo]) VALUES (?, ?)" SelectCommand="SELECT * FROM [cargo]" UpdateCommand="UPDATE [cargo] SET [cargo] = ? WHERE [código] = ?"> <deleteparameters> <asp:Parameter Name="código" Type="Int32" /> </deleteparameters> <insertparameters> <asp:Parameter Name="código" Type="Int32" /> <asp:Parameter Name="cargo" Type="String" /> </insertparameters> <updateparameters> <asp:Parameter Name="cargo" Type="String" /> <asp:Parameter Name="código" Type="Int32" /> </updateparameters> <asp:FormView ID="FormView1" runat="server" DataKeyNames="código" DataSourceID="AccessDataSource1"> <edititemtemplate> código: <asp:Label ID="códigoLabel1" runat="server" Text='<%# Eval("código") %>' /> <br /> cargo: <asp:TextBox ID="cargoTextBox" runat="server" Text='<%# Bind("cargo") %>' /> <br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> </edititemtemplate> <insertitemtemplate> cargo: <asp:TextBox ID="cargoTextBox" runat="server" Text='<%# Bind("cargo") %>' /> <br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" /> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </insertitemtemplate> <itemtemplate> código: <asp:Label ID="códigoLabel" runat="server" Text='<%# Eval("código") %>' /> <br /> cargo: <asp:Label ID="cargoLabel" runat="server" Text='<%# Bind("cargo") %>' /> <br /> <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" /> <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" /> <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New" /> </itemtemplate>
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) AccessDataSource1.Update() FormView1.ChangeMode(FormViewMode.ReadOnly) End Sub
FormView1.ChangeMode(FormViewMode.ReadOnly)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)