Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clear and fill a dataset not pointing to 1st row
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00736627
Message ID:
00737596
Views:
23
Hi Cathi,

Really appreciate your help.

I think I figured it out.

I used me.dgListing.CurrentRowIndex = 0

That seems to work.

Thanks
Roland

===========================================================

>Roland,
>
>Try adding the following after you Clear the DataSet (towards the top of your sample code):
>
>
>Me.dgPersonnel.DataBindings.Clear()
>
>
>Before you set databindings, you should clear them.
>
>>Hi Cathi,
>>
>>I tried the following and it did not work.
>>
>> 'Attempt to load the dataset with Source Data.
>> Me.Personnel01_Ds1.Clear()
>> 'Intialize Dataset for Personnel - Default values
>> Me.SqlDataAdapter1.FillSchema(Personnel01_Ds1, SchemaType.Source, "Personnel")
>> Me.SqlDataAdapter1.Fill(Personnel01_Ds1, "Personnel")
>> If Personnel01_Ds1.Tables("Personnel").Rows.Count > 0 Then
>> Me.dgPersonnel.SetDataBinding(Personnel01_Ds1, "Personnel")
>> Me.BindingContext(Me.Personnel01_Ds1, "Personnel").Position = 0
>> Else
>> Me.dgPersonnel.DataBindings.Clear()
>> End If
>> Me.SqlDataAdapter2.Fill(Personnel01_Ds1, "JobType")
>>
>>Any other suggestions?
>>
>>Thanks you Cathi and Bonnie.
>>Roland
>>
>>====================================================================
>>>Bonnie,
>>>
>>>Thanks for pointing this out. My mistake in the code I posted.
>>>
>>>>Roland,
>>>>
>>>>I haven't used a grid, but I've data bound enough controls ... try setting the BindingContext Postion after you've set the DataBinding.
>>>>
>>>>~~Bonnie
>>>>
>>>>
>>>>>Hi Cathi,
>>>>>
>>>>>I tried the following and it did not seem to work.
>>>>>
>>>>> Me.SqlDataAdapter1.Fill(Personnel01_Ds1, "Personnel")
>>>>> Me.BindingContext(Me.Personnel01_Ds1, "Personnel").Position = 0
>>>>> If Personnel01_Ds1.Tables("Personnel").Rows.Count > 0 Then
>>>>> Me.dgPersonnel.SetDataBinding(Personnel01_Ds1, "Personnel")
>>>>> Else
>>>>> Me.dgPersonnel.DataBindings.Clear()
>>>>> End If
>>>>>
>>>>>The datagrid row position (the row > selector) still was on another position down the grid. Not on the first row.
>>>>>
>>>>>Any suggestions?
>>>>>
>>>>>Hope you had a good New Year!
>>>>>
>>>>>Thanks
>>>>>Roland
>>>>>
Previous
Reply
Map
View

Click here to load this message in the networking platform