Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How Could I do deleting, and Editing Element in Sharepoint List by using Grid View ?

I menage to show all elements on the list, but how Can I do editing and deleting elements?

<div id="GridView">
<asp:GridView ID="GridView1" runat="server" CellPadding="4" 
    EnableModelValidation="True" ForeColor="#333333" GridLines="None">
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    <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" />
    <Columns>
        <asp:BoundField DataField="Kontrakt" HeaderText="Szansa/Oferta/Kontrakt" />
        <asp:BoundField DataField="Pracownik" HeaderText="Domena Pracownika" />  
        <asp:BoundField DataField="Dzien" HeaderText="DzieƄ" />
        <asp:BoundField DataField="Procent" HeaderText="Procent Zaangarzowania" /> 
    </Columns>
</asp:GridView>

And CS file on PageLoad is:

  SPWeb witryna = SPContext.Current.Web;

        SPList list = witryna.Lists["Szczegoly"];
        SPListItemCollection items = list.Items;
        GridView1.DataSource = items.GetDataTable();
        GridView1.DataBind();
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.