Click here to Skip to main content
11,478,902 members (74,394 online)

Silverlight / WPF

 
GeneralRe: Converting WPF windows application to Web Application. Pin
Pete O'Hanlon22-Jan-13 0:22
protectorPete O'Hanlon22-Jan-13 0:22 
GeneralRe: Converting WPF windows application to Web Application. Pin
Hema Bairavan22-Jan-13 1:19
memberHema Bairavan22-Jan-13 1:19 
AnswerRe: Converting WPF windows application to Web Application. Pin
Abhinav S21-Jan-13 23:49
mvpAbhinav S21-Jan-13 23:49 
GeneralRe: Converting WPF windows application to Web Application. Pin
Hema Bairavan22-Jan-13 1:12
memberHema Bairavan22-Jan-13 1:12 
AnswerRe: Converting WPF windows application to Web Application. Pin
Abhinav S22-Jan-13 1:20
mvpAbhinav S22-Jan-13 1:20 
GeneralRe: Converting WPF windows application to Web Application. Pin
Hema Bairavan22-Jan-13 1:30
memberHema Bairavan22-Jan-13 1:30 
AnswerRe: Converting WPF windows application to Web Application. Pin
Abhinav S22-Jan-13 3:58
mvpAbhinav S22-Jan-13 3:58 
GeneralRe: Converting WPF windows application to Web Application. Pin
Hema Bairavan22-Jan-13 19:07
memberHema Bairavan22-Jan-13 19:07 
GeneralRe: Converting WPF windows application to Web Application. Pin
Paulo Zemek23-Jan-13 7:22
memberPaulo Zemek23-Jan-13 7:22 
GeneralRe: Converting WPF windows application to Web Application. Pin
Hema Bairavan24-Jan-13 6:30
memberHema Bairavan24-Jan-13 6:30 
AnswerRe: Converting WPF windows application to Web Application. Pin
Pete O'Hanlon22-Jan-13 0:27
protectorPete O'Hanlon22-Jan-13 0:27 
GeneralRe: Converting WPF windows application to Web Application. Pin
Hema Bairavan22-Jan-13 1:24
memberHema Bairavan22-Jan-13 1:24 
AnswerRe: Converting WPF windows application to Web Application. Pin
db7uk26-Jan-13 14:17
memberdb7uk26-Jan-13 14:17 
QuestionGetting sqlexception "The multi-part identifier "System.Data.DataRowView" could not be bound." Pin
Geert De Vylder21-Jan-13 5:51
memberGeert De Vylder21-Jan-13 5:51 
Hi all,

I'm working on a WPF solution where I have to populate a combobox depending on the selected item of another combobox. But I get an error.

The XAML code is:

<Window xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
        x:Class="ICP.Reporting.WPFReportViewer.Windows.Report_Script_Resultaten"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        xmlns:navigation="clr-namespace:Infragistics.Silverlight.SampleBrowser.Framework.Controls;assembly=Infragistics.Silverlight.SampleBrowser.Framework"
        xmlns:ig="http://schemas.infragistics.com/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:uri="clr-namespace:ICP.Reporting.WPFReportViewer.Resources.ReportUri"
        xmlns:res="clr-namespace:ICP.Reporting.WPFReportViewer.Resources.Pages"
        d:DesignHeight="500" d:DesignWidth="567" SizeToContent="WidthAndHeight"
        Title="Report Scripts Resultaten"
        WindowStartupLocation="CenterScreen" Icon="/ICP.Reporting.WPFReportViewer;component/Images/Report_New.ico">
 
    <Window.Resources>
        <uri:ReportLibraryUri x:Key="ReportLibraryUri" />
        <res:ParametersStrings x:Key="ParametersStrings" />        
    </Window.Resources>
 
    <Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"/>           
        </Grid.RowDefinitions>
 
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
 
        <StackPanel Name="stackPanelParameters" Orientation="Vertical" VerticalAlignment="Top" Height="Auto" HorizontalAlignment="Center" Width="170" Grid.Row="0" Grid.RowSpan="1" Grid.Column="0" Grid.ColumnSpan="1" Margin="10,5">
            
            <GroupBox Name="groupBoxBeginEindDatum" Header="Kies begin- en einddatum" Height="Auto" Width="Auto" Margin="0,5,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
                <StackPanel Name="stackPanelBeginEindDatum" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" Width="Auto" >
                    <!-- <Label Height="28" Content="{Binding Source={StaticResource ParametersStrings}, Path=Binding_StartDate}" Margin="15,10,5,10" Width="77"/> -->
                    <Label Height="20" Content="Begindatum:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
                    <!--<DatePicker Name="datePickerBeginDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="{x:Static sys:DateTime.Now}" Text="" SelectedDate="{x:Static sys:DateTime.Now}" Margin="5,0" Padding="2" />-->
                    <DatePicker Name="datePickerBeginDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="01-01-2012" Text="" SelectedDate="01-01-2012" Margin="5,0" Padding="2" />
                    <!-- <Label Height="28" Content="{Binding Source={StaticResource ParametersStrings}, Path=Binding_EndDate}" Margin="15,10,5,10" Width="70"/> -->
                    <Label Height="20" Content="Einddatum:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
                    <!--<DatePicker Name="datePickerEindDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="{x:Static sys:DateTime.Now}" Text="" SelectedDate="{x:Static sys:DateTime.Now}" Margin="5,0" Padding="2" />-->
                    <DatePicker Name="datePickerEindDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="12-31-2012" Text="" SelectedDate="12-31-2012" Margin="5,0" Padding="2" />
                </StackPanel>
            </GroupBox>
                        
            <GroupBox Name="groupBoxAuthoriteitScript" Header="En authoriteit en script" Height="Auto" Width="Auto" Margin="0,5,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
                <StackPanel Name="stackPanelAuthoriteitScript" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" Width="Auto">
                    <Label Height="20" Content="Authoriteit:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
                    <ComboBox Height="25" Name="comboBoxAuthoriteit" Margin="5,0" Padding="2" SelectedIndex="-1" ItemsSource="{Binding}" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True" SelectionChanged="comboBoxAuthoriteit_SelectionChanged" />
                    <Label Height="20" Content="Script:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
                    <ComboBox Height="25" Name="comboBoxScript" Margin="5,0" Padding="2" SelectedIndex="-1" ItemsSource="{Binding}" DisplayMemberPath="Name" />
                </StackPanel>
            </GroupBox>
 
            <GroupBox Name="groupBoxRapport" Header="Rapport" Height="Auto" Width="Auto" Margin="0,5,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
                <StackPanel Name="stackPanelRapport" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" Width="Auto">
                    <!-- <Button Content="{Binding Source={StaticResource ParametersStrings}, Path=Refresh}" Margin="20,5,10,5" Click="Button_Refresh_Click" Height="23" Width="61" /> -->
                    <Button Content="Genereer rapport" Margin="5" Click="Button_Refresh_Click" Height="23" Width="100" HorizontalAlignment="Center" VerticalAlignment="Center" />
                </StackPanel>
            </GroupBox>
            
        </StackPanel>
 
        <ig:XamReportViewer HorizontalAlignment="Center" Name="xamReportViewer1" VerticalAlignment="Bottom" PageFit="Width" UseLayoutRounding="True" MinWidth="380" MinHeight="445" PageMargin="0" AutoRender="True" Grid.Row="0" Grid.Column="1" Margin="0">
            <ig:XamReportViewer.RenderSettings>
                <ig:ClientRenderSettings DefinitionUri="/ICP.Reporting.ReportingClassLibrary;component/ReportDesigns/Report_Scripts_Resultaten.igr" />
            </ig:XamReportViewer.RenderSettings>
 
            <!-- Binding parameters -->
            <ig:XamReportViewer.Parameters>
                <ig:Parameter ParameterName="beginDatum" ParameterValue="{Binding ElementName=datePickerBeginDatum, Path=SelectedDate}"/>
                <ig:Parameter ParameterName="eindDatum" ParameterValue="{Binding ElementName=datePickerEindDatum, Path=SelectedDate}"/>
                <!--<ig:Parameter ParameterName="Maand" ParameterValue="{Binding ElementName=comboBoxMaand, Path=SelectedValue}"/>
                <ig:Parameter ParameterName="Jaar" ParameterValue="{Binding ElementName=comboBoxJaar, Path=SelectedValue}"/>
                <ig:Parameter ParameterName="Authoriteit" ParameterValue="{Binding ElementName=comboBoxAuthoriteit, Path=SelectedItem}"/>
                <ig:Parameter ParameterName="Script" ParameterValue="{Binding ElementName=comboBoxScript, Path=SelectedItem}"/>-->
            </ig:XamReportViewer.Parameters>
 
        </ig:XamReportViewer>
    </Grid>
    
</Window>

The code behind is:

using ICP.Reporting.ReportingClassLibrary;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Infragistics.Controls.Reports;
 
namespace ICP.Reporting.WPFReportViewer.Windows
{
    /// <summary>
    /// Interaction logic for Report_Script_Resultaten.xaml
    /// </summary>
    public partial class Report_Script_Resultaten : Window
    {
        public Report_Script_Resultaten()
        {
            InitializeComponent();
 
            CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);
            ci.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
            ci.DateTimeFormat.DateSeparator = "-";
            Thread.CurrentThread.CurrentCulture = ci;
 
            //datePickerBeginDatum.DisplayDate = DateTime.Today.AddDays(-7);
            //datePickerBeginDatum.SelectedDate = DateTime.Today.AddDays(-7);
            //datePickerEindDatum.DisplayDate = DateTime.Today.AddDays(-1);            
            //datePickerEindDatum.SelectedDate = DateTime.Today.AddDays(-1);

            BindComboBoxAuthoriteit(comboBoxAuthoriteit);            
        }
 
        private void Button_Refresh_Click(object sender, RoutedEventArgs e)
        {
            this.xamReportViewer1.Refresh();
        }
 
        public void BindComboBoxAuthoriteit(ComboBox comboBoxName)
        {
            string strConnectionAuthoriteit = ConfigurationManager.ConnectionStrings["ICP.Reporting.ReportingClassLibrary.Properties.Settings.sqlDS_Authorities"].ConnectionString;
            SqlConnection connectionAuthoriteit = new SqlConnection(strConnectionAuthoriteit);
            SqlDataAdapter daAuthoriteit = new SqlDataAdapter("SELECT Authority_ID, Description FROM Authorities ORDER BY Description", connectionAuthoriteit);
            DataSet dsAuthoriteit = new DataSet();
            daAuthoriteit.Fill(dsAuthoriteit, "Authorities");
            comboBoxName.ItemsSource = dsAuthoriteit.Tables[0].DefaultView;
            comboBoxName.DisplayMemberPath = dsAuthoriteit.Tables[0].Columns["Description"].ToString();
            comboBoxName.SelectedValuePath = dsAuthoriteit.Tables[0].Columns["Authority_ID"].ToString();
        }
 
        private void comboBoxAuthoriteit_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (comboBoxAuthoriteit.SelectedIndex > -1)
            {
                BindComboBoxScript(comboBoxScript);
            }
        }
 
        public void BindComboBoxScript(ComboBox comboBoxName)
        {
            string strqryScript = string.Format("SELECT Questionnaire_Id, Questionnaire_Name FROM Questionnaires WHERE (Authority_ID = {0}) ORDER BY Questionnaire_Name", comboBoxAuthoriteit.SelectedItem);
 
            string strConnectionScript = ConfigurationManager.ConnectionStrings["ICP.Reporting.ReportingClassLibrary.Properties.Settings.sqlDS_Scripts"].ConnectionString;
            SqlConnection connectionScript = new SqlConnection(strConnectionScript);            
            SqlDataAdapter daScript = new SqlDataAdapter(strqryScript, connectionScript);
            DataSet dsScript = new DataSet();
            //DataTable dtScript = new DataTable();
            daScript.Fill(dsScript, "Questionnaires");
 
            comboBoxName.ItemsSource = dsScript.Tables[0].DefaultView;
            comboBoxName.DisplayMemberPath = dsScript.Tables[0].Columns["Questionnaire_Name"].ToString();
            comboBoxName.SelectedValuePath = dsScript.Tables[0].Columns["Questionnaire_Id"].ToString();
 
            //foreach (DataRow drScript in dsScript.Tables)
            //{
            //comboBoxScript.Items.Add(drScript[0].ToString());

            //}
        }
    }    
}
When I run the solution I get the sqlexception "The multi-part identifier "System.Data.DataRowView" could not be bound."
on the following line:

daScript.Fill(dsScript, "Questionnaires");

Can someone tell me where I'm going wrong and what I have to correct?

Thank you very much for your help.

Greetings,

Geert De Vylder
AnswerRe: Getting sqlexception "The multi-part identifier "System.Data.DataRowView" could not be bound." Pin
Mycroft Holmes21-Jan-13 19:36
memberMycroft Holmes21-Jan-13 19:36 
GeneralRe: Getting sqlexception "The multi-part identifier "System.Data.DataRowView" could not be bound." Pin
Geert De Vylder21-Jan-13 21:55
memberGeert De Vylder21-Jan-13 21:55 
QuestionBinding to attached property Pin
savbace20-Jan-13 22:22
membersavbace20-Jan-13 22:22 
QuestionRoot element is not valid for navigation Pin
Vuyiswa Maseko19-Jan-13 20:18
memberVuyiswa Maseko19-Jan-13 20:18 
AnswerRe: Root element is not valid for navigation Pin
Richard Deeming21-Jan-13 2:55
memberRichard Deeming21-Jan-13 2:55 
GeneralRe: Root element is not valid for navigation Pin
Vuyiswa Maseko21-Jan-13 5:49
memberVuyiswa Maseko21-Jan-13 5:49 
QuestionRandom Image with array Pin
Tikha17-Jan-13 12:23
memberTikha17-Jan-13 12:23 
AnswerRe: Random Image with array Pin
Pete O'Hanlon17-Jan-13 22:21
protectorPete O'Hanlon17-Jan-13 22:21 
AnswerRe: Random Image with array Pin
Abhinav S19-Jan-13 3:24
mvpAbhinav S19-Jan-13 3:24 
GeneralRe: Random Image with array Pin
Tikha21-Jan-13 18:09
memberTikha21-Jan-13 18:09 
GeneralRe: Random Image with array Pin
Dave Kreskowiak21-Jan-13 18:54
mvpDave Kreskowiak21-Jan-13 18:54 
QuestionDispatcherTimer Tick event not fired Pin
Praveen Raghuvanshi17-Jan-13 5:54
memberPraveen Raghuvanshi17-Jan-13 5:54 
AnswerRe: DispatcherTimer Tick event not fired Pin
Paulo Zemek23-Jan-13 7:28
memberPaulo Zemek23-Jan-13 7:28 
QuestionWhich way to load entity child collections? Pin
UCLAdam16-Jan-13 6:11
memberUCLAdam16-Jan-13 6:11 
QuestionWPF with Web Pin
Rishabh Kumar14-Jan-13 9:42
memberRishabh Kumar14-Jan-13 9:42 
AnswerRe: WPF with Web Pin
Abhishek Pant14-Jan-13 10:17
memberAbhishek Pant14-Jan-13 10:17 
AnswerRe: WPF with Web Pin
Abhinav S16-Jan-13 18:20
mvpAbhinav S16-Jan-13 18:20 
QuestionWPF - Bind IsEnabled To Method On VM Pin
Kevin Marois13-Jan-13 12:06
memberKevin Marois13-Jan-13 12:06 
AnswerRe: WPF - Bind IsEnabled To Method On VM Pin
Wayne Gaylard14-Jan-13 1:55
mentorWayne Gaylard14-Jan-13 1:55 
AnswerRe: WPF - Bind IsEnabled To Method On VM Pin
Richard Deeming14-Jan-13 3:13
memberRichard Deeming14-Jan-13 3:13 
GeneralRe: WPF - Bind IsEnabled To Method On VM Pin
Kevin Marois14-Jan-13 11:40
memberKevin Marois14-Jan-13 11:40 
GeneralRe: WPF - Bind IsEnabled To Method On VM Pin
Kevin Marois20-Jan-13 9:47
memberKevin Marois20-Jan-13 9:47 
QuestionWPF - Sync Combox [modified] Pin
Kevin Marois12-Jan-13 16:19
memberKevin Marois12-Jan-13 16:19 
AnswerRe: WPF - Sync Combox Pin
Mycroft Holmes13-Jan-13 1:50
memberMycroft Holmes13-Jan-13 1:50 
GeneralRe: WPF - Sync Combox Pin
Kevin Marois13-Jan-13 18:24
memberKevin Marois13-Jan-13 18:24 
GeneralRe: WPF - Sync Combox Pin
Mycroft Holmes14-Jan-13 1:11
memberMycroft Holmes14-Jan-13 1:11 
GeneralRe: WPF - Sync Combox Pin
Kevin Marois14-Jan-13 6:25
memberKevin Marois14-Jan-13 6:25 
GeneralRe: WPF - Sync Combox Pin
SledgeHammer0114-Jan-13 10:34
memberSledgeHammer0114-Jan-13 10:34 
GeneralRe: WPF - Sync Combox Pin
Kevin Marois23-Jan-13 18:41
memberKevin Marois23-Jan-13 18:41 
QuestionStyle From Resource File Not Being Applied Pin
Kevin Marois12-Jan-13 11:20
memberKevin Marois12-Jan-13 11:20 
AnswerRe: Style From Resource File Not Being Applied Pin
Richard MacCutchan13-Jan-13 0:44
mvpRichard MacCutchan13-Jan-13 0:44 
GeneralRe: Style From Resource File Not Being Applied Pin
Mycroft Holmes13-Jan-13 1:45
memberMycroft Holmes13-Jan-13 1:45 
GeneralRe: Style From Resource File Not Being Applied Pin
Richard MacCutchan13-Jan-13 2:24
mvpRichard MacCutchan13-Jan-13 2:24 
GeneralRe: Style From Resource File Not Being Applied Pin
Kevin Marois13-Jan-13 11:58
memberKevin Marois13-Jan-13 11:58 
QuestionRoutedEvent vs AttachedEvent - Syntax difference only? Confused [modified] Pin
devvvy9-Jan-13 21:05
memberdevvvy9-Jan-13 21:05 
QuestionHow to play an Audio File After another has Finished in WPF MediaElement Pin
Vuyiswa Maseko4-Jan-13 4:58
memberVuyiswa Maseko4-Jan-13 4:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 22 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid