.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Strange DataGridColumn Binding issue

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :WPF
 

Hi all,

I'm looking for a way to debug this problem I'm having with binding expressions in my DataGrid.

I've got a data grid that I create columns for on the fly in c# code.  I create DataGridTemplateColumns based on a data class that has an internal dictionary and implements ICustomTypeDescriptor.  I create columns for each of the dictionary's keys.  This all works just dandy, except for one thing.  My output window gets a bunch of these (one for each property):

System.Windows.Data Error: 39 : BindingExpression path error: 'ID' property not found on 'object' 'Object' (HashCode=17704875)'. BindingExpression:Path=ID; DataItem='Object' (HashCode=17704875); target element is 'TextBlock' (Name='); target property is 'Text' (type 'String')

To debug, I created a converter and removed the Path.  Usually, when I stop the debugger in the converter, the "object" parameter is what I would expect - an instance of my data object.  However, sometimes (as above), the "object" is just an "object" with no further defined type (thus causing this debug output).  I'm a bit at a loss as to why the "object" in the converter is not an instance of my data object. 

Again, all the code seems to work fine.  The data g


View Complete Post


More Related Resource Links

Command binding issue with using CommandReference and CommandGroup

  
I'm trying to write an app using the MVVM pattern but I'm running into an command binding issue. I'm trying to bind a button to multiple commands. To do this I'm using the CommandReference class (this is from the MVVM toolkit) and the CommandGroup class (I found this CodeProject). Here is a simplified version of my xaml: <Window.Resources> <c:CommandReference x:Key="TestCommand" Command="{Binding Path=TestCommand}"/> <c:CommandGroup x:Key="TestCommandGroup"> <c:CommandReference Command="{StaticResource TestCommand}"/> <c:CommandReference Command="{StaticResource TestCommand}"/> </c:CommandGroup> </Window.Resources> <Grid> <Button Content="Command Test" Command="{StaticResource TestCommandGroup}"/> </Grid> If I set the DataContext of the window to itself, this works just fine and the TestCommand will execute twice. The problem occurs when I want to follow the MVVM pattern and I set the DataContext of the window to a ViewModel. When I do this the button becomes disabled (I don't see any binding errors in the output window). I tried debugging this to see what was going on. If I set a breakpoint on the PropertyChangedCallback for the Command, I noticed the sequence this gets called is diff

Data binding - strange error message

  
Hi, I am getting an inexplicable error message on attempting to run a simple WPF data binding application based on an example with video downloaded from MSDN. VB / VS 2008 Pro / .NET 3.5 SP1 / XP SP3 The error (ex.Message) is "The specified registry key does not exist" in response to an attempt to define the data context to populate a listbox, but no explicit registry operation is involved at all. The code is: Private taTable1 As New D1DataSetTableAdapters.Table1TableAdapter Private D1Data As New D1DataSet . . . Try     Me.taTable1.Fill(Me.D1Data.Table1)     Me.DataContext = Me.D1Data.Table1        ' this statement generates the exception Catch ex As Exception The error message is giving no obvious clue.  What is going on? P.S. The MSDN sample application uses the following code to sort the listbox items: Me.DataContext = From p In Me.dsProduct.Product Order By p.Name This construct does not work when I try to use it - VS 2008 reports that "'Name' is not a member of 'System.Data.DataRow'".  How may this error be avoided? JPL

RSS Viewer Web Part Bug or Strange Issue?

  
This started out as a simple proof of concept but may be a bug.  I have added 3 RSS Viewer web parts to a page with the following URLs http://feeds.feedburner.com/sharepointteamblog?format=xml http://msdn.microsoft.com/en-us/subscriptions/subscription-downloads.rss http://rss.news.yahoo.com/rss/yahoonewsroom and everything works perfectly / each part renders as expected. I then added each of these URLs to a links list and then added the links list web part to the page.  I selected one of the RSS Viewer parts, chose connections -> “Get Feed URL from” -> “Links List” and then chose URL as the connection field.  What is happening is that the SharePoint Team Blog link works great, the MSDN link throws a SecurityException and the Yahoo link does nothing (no error in the log and nothing displayed).  I tried this on two different servers on different network & ISPs both with no firewalls in the way.  This appears to be an issue with how the web part handles a connection compared to the straight web part property. Any thoughts or someone else verifying the issue on their server would be appreciated. Regards,-James

Binding ISSUE??? How To Bind Dictionary of Dictionary

  

Hi All I have Problem in binding 

i have object of Dictionary of Dictionary

like this 

ObservableSortedDictionary<string,Dictionary<string,string>>  coll = new ObservableSortedDictionary<string,Dictionary<string,string>>();

Dictionary<string,string> InnerData = new Dictionationry<string,string>():

innderData.add ( "Item1","Data1");

innderData.add ( "Item2","Data2");

coll.Add("ParentItem1",Data);

i want to bind the inner dictionary (Data) into a GRIDVIEW 

can any one help me to Bind This Object??

ASAP please


INotifyCollectionChanged binding issue

  

I have an Observable Collection bound to a Datgrid. I want to be able to edit the contents of the Grid and have the bound Collection updated. I understand that I need to make the controls editable and implement INotifyCollectionChanged.

 

As ever I cannot find a Visual Basic version of this on the web (Express 2010) to unravel so as to understand the syntax. (Below is a working code example how far I have got with this)

 

I would appreciate any help on this.

Endpoint Binding Issue

  

Hello,

      I have a create on wcf service. Which contains one operation contract named getEmployees(); which return me a list<Employee> collection.

     Than i have create a WCF Servive Application and host above WCF Service.

    Now i create a ASP.NET WebApplication and try to call getEmployees() method but i can't.

    I am using WsHttpbinding and configure a Client Endpoint address but still i am having same problem that my client can not able to connect that service.

    Can any one tell me what is the issue?

 


Ashish Patel, MCTS Software Engineer [Level - 2]

Simple WPF ListView Binding Issue

  

I've uploaded a very simple test project with the issue here: http://www.2shared.com/file/sRVEBh42/KvpTest.html (or here)

 

The basic problem is, I have a ListView bound to a property on my class. The property is of type ObservableCollection<ObservableKeyValuePair<string, string>>.

I created the ObservableKeyValuePair so I can do two-way binding.

 

My ListView has 2 columns, Key, and Value. The Value column has a custom DataTemplate which is simply a TextBox, with its Text property setup with a two-way binding (so the user can edit the values of the ObservableCollection<ObservableKeyValuePair<string, string>>.

In my property's setter, I place a breakpoint however it never gets it. The setter of the ObservableKeyValuePair<string, string> is getting hit instead. This seems right, but I need to also propagate that change to the class property my ListView is bound to so I can simply pass the property through to another class and it would contain the changes.

Any ideas how I can achieve this? The sample project is very simple and small if you don't mind downloading it.

 

-Catch


NLB - Strange Time out issue with 2 WFEs MOSS 2007 ?

  

Hi, 

 I am having a MOSS 2007 environment with the follo.

     

Having  Two front end servers – each individual  Hyper-V  and   1 Index Server.

These WFEs  are Virtual Servers with Windows 2008 64 bit OS.

I configured the Windows Load balancing.

Very strange issue.

  

HI,

I have my textbox under tabpanel.

But when page created i can see the textbox id come very long containing the whole controls id lik:

<input id="TabContainerContent1_Basic_txtNumber" value="33333333333" maxlength="12" type="text" name="TabContainerContent1$Basic$txtNumber" />

I am doing it with xslt as belwo.

<field id="txtNumber" type = "Number" default="" >  </field>

here is xslt.

<xsl:if test="@type='Number'">
                        <asp:TextBox id="{@id}" value="{@default}"  runat="server"  />
 </xsl:if>


Please suggest me what is wrong with it?




Strange issue with a huge SSRS 2008 report (supposed to return 3 million records)

  

Hi,

NOTE: The strange part (as mentioned in title) will come in the end.

I am running a SSRS 2008 report which fetches 3 million records from a remote server. After around 1 hour the report processing stops and I see an error icon on the lft bottom of the browser window. When I click on that to see the error details it shows some PageRequestManagerSQLErrorException with an unknown error message with code 12029 (sometimes 12002).

When I see the reportserver logs there is an error message logged in it which says "Microsoft.ReportingServices.Library.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. ---> Microsoft.ReportingServices.Library.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. ---> System.InvalidOperationException: Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached."

The <DatabaseQueryTimeOut> value in the report server configuration file is already having a value set to 7200 seconds(2 hours).<

Strange Calendar issue - Missing Data, only on last day of month

  

Hi. I'm using Sharepoint 2007 and we're experiencing a strange issue. In the Month view, if I look at the month of September, September 30th appears to have 15 items.  Clicking on the date displays these 15 items, but there should be considerably more. The entire day's schedule stops at 6:30 am. If I view the month of October, and look at the September 30th date, it indicates that there are 36 items, which is the correct number.  This pattern happens regardless of which month I'm looking at. It's always the last day of the month affected. The number of missing items varies from month to month, generally around 20 items. I'm baffled, and haven't got a clue how to attempt to troubleshoot this issue.

I would greatly appreciate any suggestions on how to attempt to resolve this!


Binding Issue

  

Hey guys,

I'm using the Microsoft Fluent Ribbon in an app I'm writing with a great deal of success...that said; I'm little by little moving my code to MVVM and really liking some of the benefits but at the same time running into some walls in the process...here's my issue:

The MS Fluent Ribbon's Ribbon Control has a SelectedTabIndex property which I'm trying to use in order to bind a TabControl's SelectedIndex property...problem is, the TabControl never changes value when I change tabs on the ribbon.  Apparently the Ribbon control sets its SelectedTabIndex to -1 between switching tab values, and as a result (just guessing) my binding isn't working.  I tried using a FallbackValue but it's had no effect (or doesn't accomplish what I want anyway)...does anyone have any possible suggestions?

Thanks!

Aj


If at first you don't succeed, skydiving is definitely not for you!

Very strange behaviour from WPF binding

  

 

I am currently using markup like the following:

 <Binding diagnostics:PresentationTraceSources.TraceLevel="High" RelativeSource="{RelativeSource Self}" Path="(PatientControls:Entity

Very strange DllImport / LoadLibrary Issue

  

Hi all,

Please bear with me, as the description of the problem is fairly involved :)

I've got a strange issue when I am calling a function in an MFC C DLL declared with a DllImport from a .Net user control.

When I display the user control in a standalone application it works fine. I have migrated the component to our main product, which launches a new process, dynamically loads the assembly containing my user control (loading using the Assembly.Load passing in the bytes), hosts the component on a windows forms and displays it.

When run in this context, the first time one of the DLLs methods is called I get a message box saying "<PATH>\<COMPONENT_FULL_TYPE_NAME> was not found" where <PATH> is the root path of the application that initially lauched the process (in our cases this is two processes down Launcher -> Application -> Hosting Process). <COMPONENT_FULL_TYPE_NAME> is the name of the .Net user control that is calling the method in the DLL).  The same behavior occurs if I try to load the DLL using LoadLibrary. It doesn't occur with other DLLs I call or load in a similar way.

This had me scratching my head for a while until I started ProcessExplorer (ex-sysinternal thing) and it showed that when the LoadLibrary is called then a read is attempted for this file it is complaini

Strange time issue on simple select statement

  

Hi, I have a strange time out issue on a simple select statement.
This is my select statement:

Select * from DyGeJournal where ord>=4609635 and Fracsec>=31

The ord and Fracsec is the primary key.
When I ask for the actual excecution plan, he is using a an index seek.
It takes more than 1,5 minutes to get a result back.

When I shrink my database, everyting is running as expected, the query above runs in milliseconds.
After a while (2 weeks) it start agian running very slow.

I have the same logic on other tables, but I don't have the problem on those tables.
What can cause this problem?


combo box custom template and binding issue

  

i have a custom styled combo box binding with an enum, issue is that when i select the item from the combo box the interface dnt get refereshed and evern after selection the dropdown list remains there. and if i remove the style it works fine.. 

below is the custom style i am using. can you please let me know 

 

 

    <Style TargetType="ComboBoxItem">

        <Setter Property="Background" Value="Transparent" />

        <Setter Property="HorizontalContentAlignment" Value="Left" />

        <Setter Property="Padding" Value="6,4" />

        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />

        <Setter Property="VerticalContentAlignment" Value="Top" />

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="ComboBoxItem">

          

combo box custom template and binding issue

  

i have a custom styled combo box binding with an enum, issue is that when i select the item from the combo box the interface dnt get refereshed and evern after selection the dropdown list remains there. and if i remove the style it works fine.. 

below is the custom style i am using. can you please let me know 

 

 

    <Style TargetType="ComboBoxItem">

        <Setter Property="Background" Value="Transparent" />

        <Setter Property="HorizontalContentAlignment" Value="Left" />

        <Setter Property="Padding" Value="6,4" />

        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />

        <Setter Property="VerticalContentAlignment" Value="Top" />

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="ComboBoxItem">

          

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend