Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DataGrid LoadingRow  with DataGridRowEventArgs

Posted on 2012-04-01
10
Medium Priority
?
2,098 Views
Last Modified: 2013-11-12
I've got a problem with the DataPager when I used LoadingRow.

        public void LoadFund(Object sender, DataGridRowEventArgs e)
        {
            MyBalance prod = e.Row.DataContext as MyBalance;
            prod.Balance = 90;
        }

If I use this DataGridRowEventArgs my DataPager won't work anymore. Why Please?
0
Comment
Question by:Whing Dela Cruz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 37794848
can u post the whole code?
0
 

Author Comment

by:Whing Dela Cruz
ID: 37794929
Hi! In xaml odes are follows;

<Grid x:Name="LayoutRoot" Background="White">
        <ScrollViewer BorderThickness="0"  VerticalScrollBarVisibility="Auto" Padding="12,0,12,0" Margin="-12">  
            <StackPanel Margin="0,12,0,12" Orientation="Vertical" >
                <StackPanel Margin="0,12,0,12" Orientation="Vertical" >
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="4,4,4,0" Height="32" Background="{StaticResource HoverHyperlinkForegroundColorBrush}">
                        <sdk:Label Height="22" x:Name="lblStart" Width="33" Content="Start" Foreground="Tomato" FontWeight="Bold"/>
                        <sdk:DatePicker Height="22" x:Name="datePicker1" Width="100" Background="WhiteSmoke" Foreground="Black"/>
                        <sdk:Label Height="22" x:Name="lblEnd" Width="33" Content="End" Foreground="Tomato" FontWeight="Bold"/>
                        <sdk:DatePicker Height="22" x:Name="datePicker2" Width="100" Background="WhiteSmoke" Foreground="Black"/>
                       
                        <data:DataPager Height="26" Name="dataPager1" PageSize="12" Source="{Binding Data, ElementName=employeeDataSource}"
                                        Width="200" AutoEllipsis="True" NumericButtonCount="3"/>
                        <Button x:Name="Add" Content="Add new" Click="Add_Click"></Button>
                        <Button x:Name="Edit" Content="Edit" Click="Edit_Click"></Button>
                        <Button x:Name="Ac" Content="ac" Click="Activate_Click"></Button>
                    </StackPanel>
                </StackPanel>
                <riaControls:DomainDataSource Name="employeeDataSource" LoadSize="100" QueryName="GetMyBalancesQuery"
                                AutoLoad="True">
                    <riaControls:DomainDataSource.DomainContext>
                        <ds:InOutOrganizationContext/>
                    </riaControls:DomainDataSource.DomainContext>

                </riaControls:DomainDataSource>

                <sdk:DataGrid MinHeight="100" IsReadOnly="True" AutoGenerateColumns="False" Margin="4,4,4,0" RowBackground="Cornsilk"              
                               AlternatingRowBackground="BlanchedAlmond" ItemsSource="{Binding Data, ElementName=employeeDataSource}"              
                               x:Name="BalanceGrid"  Background="White" Foreground="Black" LoadingRow="LoadFund">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Binding="{Binding TrxCode}" Header="Code" Width="80" />
                        <sdk:DataGridTextColumn Binding="{Binding TheDate, Mode=TwoWay, StringFormat=MMMM dd\, yyyy}" Header="Date" Foreground="Black"  Width="120" />
                        <sdk:DataGridTextColumn Binding="{Binding EncodersName}" Header="Encoded By:" Width="110" />
                        <sdk:DataGridTextColumn Binding="{Binding A_In, StringFormat=#\,##0.00}" Header="(+) In" Foreground="Blue" Width="75" />
                        <sdk:DataGridTextColumn Binding="{Binding A_Out}" Header="(-) Out" Foreground="Black"  Width="68" />
                        <sdk:DataGridTextColumn Binding="{Binding Balance, StringFormat=#\,##0.00}" Header="Balance" Foreground="Blue" Width="75"/>
                        <sdk:DataGridTextColumn Binding="{Binding ReceiptNo}" Header="Receipt no" Width="110" />
                        <sdk:DataGridTextColumn Binding="{Binding Purpose}" Header="Purpose:" Width="110" />
                       
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
                <TextBox Text="{Binding Path=SelectedRecord.Purpose, Mode=TwoWay}"></TextBox>
                <TextBox x:Name="MyText"></TextBox>
            </StackPanel>
        </ScrollViewer>

    </Grid>

while on xaml.cs codes are as follows;
        public void LoadFund(Object sender, DataGridRowEventArgs e)
        {
            MyBalance prod = e.Row.DataContext as MyBalance;
            if (prod.A_In > 0)
            {
                e.Row.Background = new SolidColorBrush(Color.FromArgb(255, 100, 100, 100));
                prod.Balance = 90;
            }
            else
            {
                e.Row.Background = new SolidColorBrush(Color.FromArgb(255, 200, 200, 200));
            }
        }

at the time that i use "prod.Balance = 90;" the pager will not work, but if I will not use that everything is working...
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 37795022
so the only problem is with this line:   prod.Balance = 90; ???
try this:
comment the following line in your xaml:
    <sdk:DataGridTextColumn Binding="{Binding Balance, StringFormat=#\,##0.00}" Header="Balance" Foreground="Blue" Width="75"/>

now run your app with prod.Balance = 90;
does the pager works now>?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Whing Dela Cruz
ID: 37795281
Hi! sedgwick, It doesn't work. I tried it but got the same result. The DataPager is not working so I could not move to another page...
0
 
LVL 4

Expert Comment

by:Sathish DV
ID: 37826933
Hi ERWIIN,

try the below code..

public void LoadFund(Object sender, DataGridRowEventArgs e)
        {
            MyBalance prod = e.Row.DataContext as MyBalance;
            prod.Balance = 90;
            BalanceGrid.DataContext = prod;
        }
0
 
LVL 7

Expert Comment

by:vbigham
ID: 37834051
Is the setter on prod.Balance throwing an exception?
0
 

Accepted Solution

by:
Whing Dela Cruz earned 0 total points
ID: 37905201
Hi all! Sorry for the late response. I've been in a long vacation. I may now trying all suggested answer given above. Thanks!
0
 

Author Closing Comment

by:Whing Dela Cruz
ID: 37940804
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question