I have a code in which I have to get the properties of selected item
string ID= QueryString["Id"]//this value is taken from url created dynamically and never be null
SPList list = web.Lists["MyList"];
SPListItem item= list.Items.GetItemById(Convert.ToInt32(ID));
But GetItemById() throws exception that the value doesn't fall in expected range. Please let me now why this happening as the ID is fetch from the item while making the url. Can content DB will help me out in this case?
UPDATE
The above code is working for some items.