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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Unable to bind a List of a [DataContract] class to a ListBox

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :WPF



I have a class who is used by Silverlight though RIA Services and who contains the [DataContract] and on its properties [DataMember].

That class is also used by my WPF Application and i have a List<myClass> which i want to bind it on ListBox.


The problem is when i bind the list, when i select an item in my listbox, the first item is always selected and the right-click doesn't work properly.

In fact, the behavior of UI is weird and badly refreshed.

But, before, the class didn't have DataContract/DataMember attributes and it worked fine.


Do you know, a workaround to continue to use that class and avoid to create an other class specially for databind ?





View Complete Post

More Related Resource Links

bind drop down list in content page from value from master page

Hi all, I have applied nested master page to some page. Now i want to bind drop downlist from value selected in dropdown list in master page of master applied to that page. the hierarchy of pages is  mypage.aspx -> main.aspx -> inner.master I want bind dropdown list in  mypage.aspx from  from value selected in dropdown list in  inner.master Please help me. 

Can serialize but not deserialize class containing an xs:list attribute using XmlSerializer

I have a simple serializable class along the lines of: [Serializable] [XmlType] public class MyClass { [XmlAttribute("values")] public int[] Values { get; set; } } If I create an instance of this class with Values set to an empty collection the XmlSerializer class produces this output as expected: <?xml version="1.0" encoding="utf-16" ?> <MyClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" values="" /> However, deserializing this exact output throws a System.FormatException: Input string was not in a correct format. Shouldn't the XmlSerializer be able to deserialize this, since it produced the xml string in the first place?

Unable to See List of Marked Transactions on New Server

I am trying to do a TFS test restore to new server following the TFS 2010 Backup and Restore processes below verbatim (SQL 2008 SP1): Backup TFS http://msdn.microsoft.com/en-us/library/ms253070.aspx Restore to Different Server http://msdn.microsoft.com/en-us/library/ms252516.aspx#RestoreDB Restore Single Server Deployment to New Hardware http://msdn.microsoft.com/en-us/library/ff459215.aspx I can restore the database to the restoring state on a new server; however, when applying the transaction log backup I don't see any marked transactions to restore to.  I don't even get a list to choose from.  I can restore the database to the original server successfully and can see list of marked transactions to restore to. Is there anything that we could keep me from seeing the list of marked transactions on the new server?  Does this have anything to do with the fact that the marks are stored in the msdb.dbo.logmarkhistory database? Thanks in Advance, Michael

Unable to create instance of proxy class in WCF

Hello, I created proxy class using svcutil.exe and added it in App_Webreference folder. I want to access objects and methods from this proxy. But I am unable to create instance of this proxy class. In inellisence, it is not showing this proxy class. What could be the problem ? I am using VS 2008 and Visual Basic.   Thanks in advance.  Amit Lohakare

Bind List&lt;&gt; to GridView

Can any body help how to update list through gridview

BCS Data List - Unable to Allow Filtering

Hello,   I'm using the BCS Data List to display values from the 'Contoso Inventory List' on the Microsoft SharePoint 2010 demo machine.  I'm unable to allow user filtering of data - the options appear grayed out.  Here's what I did: Dropped a BCS Data List web part on my page Selected my External Content Type Data appeared as expected I then clicked the 'Edit View' link to modify the BCS Data List view The selections under 'Items to Retrieve' are grayed out - with "Retrieve All Items" selected by default.   I had hoped to use 'Retrieve items specified by the user' which in SharePoint 2007 BDC gave the user filtering options.I'm hoping someone can help me understand what I'm doing wrong.     Thanks!   Steven   ps - I get the same behavior with different SharePoint sites and External Content Types, so I don't believe it's a problem with my SharePoint site.

Unable to load External list in Sharepoint Foundation - error due to trial period expired

I've created an external content type and external list on Sharepoint Foundation. Everything is OK when creating and viewing these items in create mode in sharepoint designer. When trying to view the external list in the browser I get error message "Unable to display this Web Part..." When I opened the same list in the mobile view url I get a more descriptive error message: "The shim execution failed unexpectedly - The trial period for this product has expired.." I have read and followed the instruction related to this thread concerning expired trial period bug, and iisreseted the server after change but I still can't display the list. http://social.technet.microsoft.com/Forums/en-US/sharepoint2010setup/thread/644ab342-4eaa-468c-95c1-f345a4f65f26#644ab342-4eaa-468c-95c1-f345a4f65f26 Any ideas anyone??

Unable to Bind a CheckBox to an Oracle column

The code below works great in SQL Server with a BIT column.  How do you get it to work in Oracle?  I've tried number(1), char(1)...etc but nothing works!  Using Eval is no good becuse that breaks the Update. <asp:CheckBox ID="cbxStatus" runat="server" Checked='<%# Bind("status") %>' /> Always get this error: System.InvalidCastException: "Specified cast is not valid".  Anyone know the trick to making this work with Bind? 

How to Bind ListBox to ComboBox's SelectedItem

I have a ComboBox bound to a list of custom objects (Person). Each Person has a Friends collection. I want a ListBox below the ComboBox to contain a list of Friends depending on the Person selected in the ComboBox above it.   Something like: <ComboBox x:Name="MyComboBox" ItemsSource="{Binding People}"/> <ListBox ItemsSource="{Binding Element=MyComboBox, Path=SelectedItem.Friends}"/>   It doesn't work (null reference, I'm assuming because the SelectedItem.Friends is the wrong syntax.   Any pointers?

How to bind a List of hybriddictionay to the dropdownlist

I have a List<HybridDictionary> _Reasons.I need to bind the list to a dropdown. I tried the code as try            {                this.ddlReason.DataSource = _Reasons;                ddlReason.DataValueField = "Key";                ddlReason.DataTextField = "Value";                this.ddlReason.DataBind();                           }            catch            {                //Log Entry            }            finally            {             } But it not work.Please sugges

Unable to Create Object Variable for Linq Data Class


For some unknown reason I suddenly am unable to create an object variable for a Linq Data Class. If I create a new project and try the process again with the same database everything works as advertized.

The code I am using is Dim db As New RoggDataContext  which gives me an error on the object variable "db": Overload resolution failed because no accessibility 'NEW'  accepts this number of arguments.

I have looked inside every file in the Web Project like the web config to check the connection string, gobal, and designer.vb looking for any errors whit no JOY.  I also tried to create a new form and code behind with a button and received the same error.

This is mind blowing because as I already stated, I can create a new Web Site and the problem goes away.

Any help is appreciated!



How to bind two different list to dropdown base on radiobutton selection

  I have radio button and dropdown column types in sharepoint list, and apart from this i have two list. I want to bind the data to data from the two list base on the selection of radio button. If i select 'Yes' i want to bind from the one of two list, and when i select i want to bind it to another list. Is it possible in sharepoint ?. If yes can you help me out in this

Unable to find Control in List



I'm trying to define the parameters of my data source using a stored procedure. My Stored Procedure Syntax is perfect and i'm happy with that, i've just got trouble with connecting my parameters to my controls. I have 19 Parameters, of which i've managed to connect 17 to controls within my ASP.Net form (some to text boxes, some to ddls etc...)

However, i'm trying to connect a particular parameter to a control, but when i drop down my list of controls it's not visible? The control is within a hidden panel so i've un-hidden it and it's still not there. I've even commented out the panel and tried that but i can't find this control! I just cant seem to get this control to appear in the list.

Has any one seen anything like this before at all?

If you need any more information please let me know. (for clarirty i've attached screen grab)

Control Not in list


Bind listbox to gridview on client side



I have a list box (that uses a SQlDataSource) that has a list of jobs. I have a grid view (that also uses a SQLDataSource) that has the items used in each job. I want to bind the list box value to the gridview on the client side, i.e. when the user clicks on a different job in the list view I want the grid to show the items for that job.

Also, at formload I want the gridview to show the details of the first job on the listview.

Please let me know how I can do this in the aspx page.


- Sankaran

how to bind object data source with bullited list


 i wanted to retrieve things from the data base and perform mathmatical operations on it then post it to the user, so i was told to use the bullited list and bind it to the object dataSource

how to perform such thing??

How to Data bind to a listbox on a wpf usercontrol ?


Hi ,

what i have is a Windows form and in that form i have a elementhost which hosts a wpf usercontrol. On that control is a wpf listbox. In the windows form i have a routine that fetches data form the db.

How can i bind that data to the list box using the "{Binding = ???} attribute in the XAML ?

Currently i bubble up an event and on the event in the windows form i call an action whcih binds to the listbox. is that the correct way to do it



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