This is a migrated thread and some comments may be shown as answers.

[Solved] Finding new row

12 Answers 204 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael Salzlechner
Top achievements
Rank 1
Michael Salzlechner asked on 04 Jul 2010, 07:38 PM
in an appliation we have a GridView and a new row is added via a popup window

after the popup closes i would like to show that new row in the GridView

any pointers on how to get this done ?

thanks

Mike

12 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 05 Jul 2010, 06:24 AM
Hello Michael Salzlechner,

You can call the RadGridView.BeginInsert method . You can subscribe to the RadGridView.AddingNewDataItem event  in order to pre-populate the new row.

Greetings,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael Salzlechner
Top achievements
Rank 1
answered on 05 Jul 2010, 11:46 AM
What if the record is created somewhere else and i dont know until it has been created ?

i also dont want to grid to show anything until it is actually saved

what i would like is to sit on the SubmittedChanges event and when i know it has been saved i would like to refresh the gridview showing that row.

thanks

Mike
    
0
Pavel Pavlov
Telerik team
answered on 05 Jul 2010, 11:52 AM
Hi Michael Salzlechner,

In such case you may just add the item to the ItemsSource collection and when you need the UI updated , you just call the RadGridView.Rebind() method.

In case your ItemsSource is ObservableCollection  or any INotifyCollectionChanged collection , there is no need to call the Rebind() method.

All the best,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael Salzlechner
Top achievements
Rank 1
answered on 05 Jul 2010, 01:00 PM
I am using a domain data source as itemssource.

in another part which is actually a modal wizard type popup i create a entity new and fill the entity with data and call SubmitChanges. That record does not automatically show up in the RadGridView. I have to switch pages for it to show up.

What i would like is for that record to be the current row in the RadGridView

thanks again

Mike
    

0
Pavel Pavlov
Telerik team
answered on 05 Jul 2010, 01:25 PM
Hello Michael Salzlechner,

In such case you will need to set the item as current ,

this.RadGridView1.CurrentItem =  MyItem,

and bring the item itno view :

this.RadGridView1.ScrollIntoView(MyItem)

Hope that helps.
Greetings,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael Salzlechner
Top achievements
Rank 1
answered on 05 Jul 2010, 02:32 PM
Pavel

thanks but it doesnt seem to work

to test this without much else i added a button to the screen with the gridview

in  the button i do this

 

// create entity   
C3SYROUT route = new C3SYROUT();  
// add entity to domain context  
dc.C3SYROUTs.Add(route);  
// Submit Changes  
c3SYROUT_pmDomainDataSource.SubmitChanges();  
 

and in submittedchanges

void SubmittedChangesCallback(object sender, System.Windows.Controls.SubmittedChangesEventArgs e)  
{  
   if (!e.HasError)  
   {  
       RouteCodeList.CurrentItem = curroute;  
       RouteCodeList.ScrollIntoView(curroute);  
   }  

but the list doesnt show the row until i change pages

0
Pavel Pavlov
Telerik team
answered on 05 Jul 2010, 02:35 PM
Hello Michael Salzlechner,

Sorry, I forgot to mention that  you should write some  code to explicitly calculate the position of the item in pages and switch to a specific page .

In case you find dificulties implementing this, you can paste me some code(XAML/C#)  so I can have an idea how your paging is set. Then I will be able to prepare a small sample illustrating the approach in action.

Regards,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael Salzlechner
Top achievements
Rank 1
answered on 05 Jul 2010, 03:22 PM
Pavel

i tried the test with items that should appear on the current page as well as items that would appear on other pages

the test program i have currently has pages with 8 items. in my test the current page (1st page) shows all 8 items already so the item would actually be inserted.

After the submitchanges if i page to the second page and then back the new row appears where it should

this is the sample domaindata source

<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:C3SYROUT, CreateList=true}" Height="0"   
       Name="c3SYROUT_pmDomainDataSource" QueryName="GetC3SYROUT" Width="0" 
       PageSize="8" LoadedData="c3SYROUT_pmDomainDataSource_LoadedData">  
            <riaControls:DomainDataSource.DomainContext> 
                <my:myDomainContext /> 
            </riaControls:DomainDataSource.DomainContext> 
        </riaControls:DomainDataSource> 
 

and then it is used for binding on the GridView as well as a RadDataPager
0
Michael Salzlechner
Top achievements
Rank 1
answered on 06 Jul 2010, 04:41 PM
Still no luck with this. Any other ideas ?

thanks

Mike
0
Pavel Pavlov
Telerik team
answered on 08 Jul 2010, 01:37 PM
Hello Michael Salzlechner,

Since I do not have your code  and it is a bit difficult to find what is causing the trouble, can you please send me your test application , and I will make the changes required for you.

* To be able to attach the zip , you will need to open a support ticket . Please mention the forum thread ID 324862 when opening the ticket , so I could further assist you.

Best wishes,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
uku
Top achievements
Rank 1
answered on 22 Aug 2010, 03:15 PM
Hello Pavel,

did you find a solution for this issue. I do have exactly the same one.

My GridView is designed like this.
<telGrid:RadGridView x:Name="OrderList" ItemsSource="{Binding Data, ElementName=dds}" 
                           IsReadOnly="True" AutoGenerateColumns="False" 
                           ShowGroupPanel="False" Margin="0"
                           RowIndicatorVisibility="Collapsed"
                           SelectionChanged="OrderList_SelectionChanged"   
                           Grid.Row="0"
                           >

In the UI there are two RadioButton to filter either the open or closed orders. If the radio button is checked filtering is done in code like this.
private void ShowOpenOrders()
{
  busyIndicator.IsBusy = true;
  dds.FilterDescriptors.Clear();
  if (OpenOrder.IsChecked == true)
  {
   dds.FilterDescriptors.Add(new FilterDescriptor("OrderStatus", FilterOperator.IsEqualTo, 4));
  }
}
 For test reasons I've inserted a button which creates a new order.
dds.DomainContext.EntityContainer.GetEntitySet<Order>().Add( 
    new Order() 
    
        OrderID = 0, 
        OrderStatus = 4, 
        OrderDate = DateTime.Parse("2010-08-20"), 
        CustomerName = "Test-Customer", 
    
); 
    
dds.SubmitChanges(); 

After SubmitChanges the order is written to the db but the grid is not refreshed. I have to click on the pager, although currently there are just 2 orders within the grid, or I have to switch the filtering with the radio buttons to refresh the grid.

Hopefully there is a trick to do the refresh automatically

Bye and thanks for your support

Uwe
0
Pavel Pavlov
Telerik team
answered on 25 Aug 2010, 10:12 AM
Hi uku,

You may try to call the Rebind().  Method when you need your grid to refresh .


Sincerely yours,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Michael Salzlechner
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Michael Salzlechner
Top achievements
Rank 1
uku
Top achievements
Rank 1
Share this question
or