> 1) how to update the gridview?
You could do something like this:

<asp:GridView ID="yourGridView" runat="server" DataKeyNames="id"
DataSourceID="yourDataSource" >
        <Columns>
            <asp:TemplateField HeaderText="Information" >
                <ItemTemplate>
                    <asp:Label ID="InformationID" runat="server"
Text='<%# Eval("id") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="InformationID" runat="server"
Text='<%# Eval("id") %>'></asp:Label>
                </EditItemTemplate>
           </asp:TemplateField>
           <asp:TemplateField HeaderText="Action">
                <ItemTemplate>
                    <asp:LinkButtonID="EditButton" Text="Edit"
CommandName="Edit" runat="server" />
                </ItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="UpdateButton" Text="Update"
CommandName="Update" runat="server" />&nbsp;
                    <asp:LinkButton ID="CancelButton" Text="Cancel"
CommandName="Cancel" runat="server" />
                </ItemTemplate>
           </asp:TemplateField>
</asp:GridView>

Then in your DataSource, you do you insert and update.

> 2) how to delete the row from gridview?
yourGridView.DeleteRow(rowIndex)

Hope this helps :)

Reply via email to