DataTable row Selection Error: There is no row at position 0

Last Reply 8 months ago By pandeyism

Posted 8 months ago

i am selecting row from gridview, then exception is coming that is There is not row at position 0

In row following item name is coming which is below mentioned and populating in gridivew.

Adult Sleeveless Jacket B
Line 281:            string SesnId1 = dm.GetData("select SecID from dbo.Sections where Secnam='" + GVPrd.SelectedRow.Cells[11].Text.Trim() + "'").Rows[0][0].ToString();
Line 282:
Line 283:            string SesnId2 = dm.GetData("select Codeitem from dbo.ItemMasterFile where Descriptionitem=replace(REPLACE('" + GVPrd.SelectedRow.Cells[2].Text.Trim() + "','amp;',''),''','''')").Rows[0][0].ToString();
Line 284:            DDSecbas.SelectedValue = SesnId1;
Line 285:            ddpitem.SelectedValue = SesnId2;

Please guide

Posted 8 months ago

Hi akhter,

Your GetData is not returning value for that resason error is coming debug your code and check your query and result set.