Hi guys
while i was working with asp.net 2003 i used the datakeys property of datagrid to delete or update.Otherwise i use the boundcolumn and set its visible property false.Like
i want to show the customer name,salary but i want cust_no which i dont wanto show.
Cust_no(visible-false) Cust_nm salary- and write code in itemdatabound event like
custno=e.item.cell[0].Text;
custno=grid.datakeys[e.item.itemuindex];
But the same thing i cant use in asp.net 2005,there cust_no is avail only if it is visible otherwise empty value is passed to custno.
So i used datakey names property i set it with cust_no,
and the query is "select cust_no,cust_nm,salary from cust_mst"
and i set cust_nm,salary in the bound field
But i got the following error:
Specified
argument was out of the range of valid values. Parameter name: index
so i add the cust_no as boundfield and set its visible property false.
Its working.Any one please explain
My question is why it displays error when i didnt use cust_no as boundfield?Eventhough i added the field in datakeynames