Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error in DataGrid
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00770387
Message ID:
00771916
Vues:
15
Ahmad,

Based on what you are saying you need to do, I would say that your textboxes are using a different CurrencyManager than the DataGrid. Wouldn't you want all the controls bound to the same CurrencyManager? That way when you move the position, all the controls are updated.

>Do you see any logical mistakes in the steps I am doing?
>
>
>>Ahmad,
>>
>>To get the number of rows in the DataGrid, just use the Count property of the CurrencyManager for the DataGrid.
>>
>>>Cathi,
>>>
>>>What you said is exactly what I am doing.
>>>In addition to that, I had to change the datagrid.CurrentRowIndex to point to the new added row, otherwise if I didn't do this the textboxes will display the current row information not the new one & for that after changing the CurrentRowIndex I disable the datagrid to not allow the user to click on there and miss the data, but after updating the DA I enable it again.
>>>By the way the problem happen only if I clicked on the datagrid after the above procedures !!.
>>>Is there a way to count the all the rows in the datagrid not the displayed ones ?
>>>
>>>
>>>
>>>>Ahmad,
>>>>
>>>>If the textboxes are bound to the child table, then add a new row to the empty child table before allowing the user to enter information to the controls.
>>>>
>>>>>I don't use the datagrid directly, under the datagrid in the window form I have some textboxs binded to the datasource/datarelation, all the data changes doen in these textboxs. and after updating the DataAdapter the datagrid gets updated.
>>>>>
>>>>>That's how I'm doing it.
>>>>>
>>>>>
>>>>>>Ahmad,
>>>>>>
>>>>>>Try adding a new row to your child datarelation without using the datagrid and make sure it updates as expected.
>>>>>>
>>>>>>>Hi Cathi,
>>>>>>>
>>>>>>>Sorry for the dealy, it's the situation here as you know...
>>>>>>>
>>>>>>>Well I am not using filter, I am using a DataRelation, and mostly I face this problem if the child table has no data to be displayed in the datagrid then when I add data to it & try to update the DA I got this error, some times if the child table has a data I don't see the error.
>>>>>>>
>>>>>>>I already tryed to set the .CurrentRowIndex, but no effect.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Ahmad,
>>>>>>>>
>>>>>>>>By chance are you using a filter? If so, then right before you change your filter, try setting the DataGrid.CurrentRowIndex to zero so it will not be outside the limits of the grid after the filter.
>>>>>>>>
>>>>>>>>
>>>>>>>>>Dear All,
>>>>>>>>>
>>>>>>>>>I am having a strange error:
>>>>>>>>>((An unhandled exception has occurred in your application. if you click
>>>>>>>>>continue, the application will ignore this error and attempt to continue
>>>>>>>>>if you click quit. the application will be shut down immediately.
>>>>>>>>>
>>>>>>>>>Index was outside the bounds of the array.))
>>>>>>>>>
>>>>>>>>>This error fires, when I add a new row to my data grid.
>>>>>>>>>
>>>>>>>>>Any idea what could be the problem?
>>>>>>>>>
>>>>>>>>>Thanks in advance.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform