Connecting Tech Pros Worldwide Help | Site Map

Error : There is no row at position 1, Using DataRowVersion

Newbie
 
Join Date: Sep 2009
Posts: 5
#1: Sep 15 '09
I am using a grid, in which dynamically creating some columns and rows and EDIT buttons. While Updating the rows I am comparing DataRowVersion.Original and DataRowVersion.Current .

Its working fine when I did it first time, but when do it second time for another Edit and Update button. It shows the similar problem.
"There is no row at position 1"
Here is the code in Update button.
Expand|Select|Wrap|Line Numbers
  1. showMessage(){
  2.   var message = document.getElementById('<%=Message.ClientID %>');
  3.   if(message)
  4.   {
  5.     message.style.display='block';
  6.   }
  7. }
  8. for (int i = 0;i < dtDataChange.Columns.Count;++i)
  9. {
  10.    if (Convert.ToString(dtDataChange.Rows[iIndex][i, DataRowVersion.Original]) != Convert.ToString(dtDataChange.Rows[iIndex][i, DataRowVersion.Current]))
  11.   {
  12.     String sCol = dtDataChange.Columns[i].ColumnName.ToString();
  13.     String sVal = dtDataChange.Rows[iIndex][i].ToString();
  14.  
  15.   }
  16. }

Thanks for helping hands in advance.
Alok
Newbie
 
Join Date: Sep 2009
Posts: 5
#2: Sep 16 '09

re: Error : There is no row at position 1, Using DataRowVersion


I got my answer this time from some other place.
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#3: Sep 16 '09

re: Error : There is no row at position 1, Using DataRowVersion


Alok,

You have mistakenly posted in the ASP Classic forum instead of the ASP.NET forum. I have moved your post for you. I am glad you found an answer. Is there any chance you could post it here?

Jared
Newbie
 
Join Date: Sep 2009
Posts: 5
#4: Sep 16 '09

re: Error : There is no row at position 1, Using DataRowVersion


Thank u Sir for correcting me. You are right, it was in wrong place.
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#5: Sep 16 '09

re: Error : There is no row at position 1, Using DataRowVersion


What was the answer?
Newbie
 
Join Date: Sep 2009
Posts: 5
#6: Sep 17 '09

re: Error : There is no row at position 1, Using DataRowVersion


I was using iIndexin above code, insetad of this I was to use only [0]. After that after clicking in any row I got all the correct values from the grid.

I was clicking first row UPDATE button first, all the time, so didnt get any error first time, because its Index was 0. But when next time I clicked UPDATE button of some another row, then it creates the problem.
Thanks & Regards
Alok
Reply