How to add the same checkbox column in the SPList to the SPGridView

777 Views Asked by At

I want to create, in Sharepoint 2010 using C# and ASP.NET, in a SPGridView binded by a SPList, the same checkbox who has the SPList. These checkbox select the splistitems and display the ribbon.

So, I have written something like that in my aspx:

<Sharepoint:SPGridView id="mySpGridVew" runat="server" AutogenerateColumns="false" OnRowCreated="GridViewRowEventHandler">
   <Columns>
      <asp:BoundField/>
      <asp:BoundField/>
   </Columns>
</Sharepoint:SPGridView>

I created my custom list manually in sharepoint, so every item has title, edit button, and the hidden checkbox to select them all or every single item. I have bind the SPGridView with the SPList and I have created the others fields with something like:

void MyGridView_RowCreated(Object sender, GridViewRowEventArgs e)
{
   SPList myList = SPContext.Current.web.Lists["MyList"];
   e.row.cells[1] = myList.Items.["title"];
}

I searched in forums and the Internet and I couldnt found the way to create a cell in my SPGridView with the same checkbox in my SPList to display the ribbon and select the items. How can I do that?

Thank you.

0

There are 0 best solutions below