Glolita,
I don't know about getting selected items at server-side, however personally I get the selected items in Javascript like this:
var ctx = SP.ClientContext.get_current();
var items = SP.ListOperation.Selection.getSelectedItems(ctx);
var myItems = '';
var i;
for (i in items)
{
myItems += '|' + items[i].id;
}
and assign this value to a Hidden Field in Javascript as:
document.getElementById("<%= HiddenField1.ClientID %>").value = myItems;
and then call server-side code by clicking a hidden button pro grammatically:
document.getElementById("buttonId").click();
OR Send this as Query String to the page which contains Visual Web Part and access the Query String at Server-side...
a similar question here
Please have a look at this post