System.IndexOutOfRangeException: UnitID error occur when displaying data in a gridview using Joining data is configured by object datasource
class file
public static List<Item> GetAllItem()
{
List<Item> listItems = new List<Item>();
string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
{
SqlCommand cmdSelectQuery = new SqlCommand("spJoinItem_MasterAndUnitAndBrand", con);
cmdSelectQuery.CommandType = CommandType.StoredProcedure;
con.Open();
SqlDataReader rdr = cmdSelectQuery.ExecuteReader();
while (rdr.Read())
{
Item item = new Item();
item.ItemID = Convert.ToInt32(rdr["ItemID"]);
item.ItemNam ...
Go to the complete details ...