473,324 Members | 2,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

C#: 'There is no row at position 0'

42
I have a DataGrid and am attempting to have in-grid data editing. At the moment I'm working with a single DropDownList:

Expand|Select|Wrap|Line Numbers
  1. public void roleList_Update(Object sender, DataGridCommandEventArgs e)
  2. {
  3.     int newRoleID = 666;
  4.  
  5.     DropDownList ddl = (DropDownList) e.Item.FindControl("ddlRoleEdit");
  6.  
  7.     if (ddl != null)
  8.         newRoleID = int.Parse(ddl.SelectedValue);
  9.  
  10.             roleListRowSQLAdapter.SelectCommand.Parameters["@currentRow"].Value = (int) roleList.DataKeys[e.Item.ItemIndex];
  11.  
  12.     roleListRowSQLAdapter.Fill(roleListRowDataSet);
  13.  
  14.     roleListRowDataSet.ContactRoleDetailRow crd = roleListRowDataSet.ContactRoleDetail[0]; /* BOOM! */
  15.     crd.Role = ddl.SelectedValue;
  16.         roleListRowSQLAdapter.Update(roleListRowDataSet.ContactRoleDetail);
  17. }
The commented line above is where the code breaks; the page complains that 'There is no row at position 0.' Now, I understand this to mean rowListRowDataSet is empty. But why? It was generated from an SQL adapter and a SELECT statement I'm sure works. The parameter @currentRow is valid, too. Isn't the 'Generate Dataset...' command all that's needed to make a functioning DataSet? I'm picking this stuff up by myself, so I may be missing some crucial idea.

Thanks!
Dec 13 '07 #1
0 1912

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Peter Abel | last post by:
Hi all, I'm working under W2k with Python 2.2.2 (#37, Oct 14 2002, 17:02:34) on win32 I have a file *test_data.txt* with the following content: 0123456789 0123456789 abcdefghi...
1
by: Felix Natter | last post by:
hi, I have a structure like: <topic name="xxx"> <subtopic name="subxxx"> <subsubtopic name="subsubxxx"> </subsubtopic> </subtopic> </topic>
16
by: Konrad Viltersten | last post by:
Suppose you got a really long page and you'd like to enable the user (supposedly, there's only one but if it's not to difficult we could extend that to any number) not to have to scroll to the...
4
by: Guy | last post by:
Hi, I read an XML file to an XMLDocument and iterate through its nodes. How do I get the XPath position (index) of a certain element? For example If I on the second "b" node I want to get "2": ...
6
by: Gérard Talbot | last post by:
Hello fellow stylers, When trying this page http://www.gtalbot.org/BrowserBugsSection/PercentualRelativePositioning.html I get different rendered layouts with IE 6, IE 7 beta 2, Firefox...
3
by: horusprim | last post by:
Is there a CSS absolute positioning rendering bug in FF1.02 and IE 6? I have been experimenting with precision absolute positioning in CSS. The following test content was used in the...
0
by: lucretia | last post by:
Hi, I've created a layout for an Ajax side that is "single paged" in that when the browser is resized, so is the page. The header is locked to the top, the right panel is locked to the right...
2
by: agbee1 | last post by:
Hello: I've finally made the effort to ween myself from overly using tables and use CSS for my positioning. However, I am having a problem with my navigational menu properly aligning in Firefox,...
0
by: crisscross27 | last post by:
Hi, I found a page called "myflashfetish" where you chan choose mp3 players for my space, well the problem is this, I wanted to place 2 or more players in myspace in a particular place, I read...
1
by: spynx | last post by:
import javax.swing.JOptionPane; import java.io.*; import java.util.Arrays; public class election5 { public static void main( String args ) {
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.