.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

WPF problem binding to an object

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

Hi: I'm having a problem binding to an object I create. I'm a newbie to WPF.  Here's my Visual Basic code, followed by my XAML.  The code runs with no errors, but nothing appears in the Label1, when I expected to see the FirstName "Shirley".  What am I doing wrong?  Thanks,  Al

Imports System.Windows

Class MainWindow
  Public Class Person
    Public FirstName As String

    Public Sub New(ByVal fName As String)
      FirstName = fName
    End Sub
  End Class

  Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As Syste

View Complete Post

More Related Resource Links

ListBox object Binding Problem...?


hii guy's

i created a ListBox and i added Engine Class object into it...so i wana display Engine Class property "Name" into ListBox..so plz tell me how can i add property name of "Name" to ListBox of Class "Engine"





ListBox Object Binding Problem..??


hii guy's here i'm having small problem on Object DataBinding using ListBox.. i've a WCF class like..

	public class EngineInstanceStatus 
             public string Name
				return m_name;

so i wana add dis class object to my ListBox.. den it'll display its property name "Name" in ListBox whenever i added this class object ot ListBox..

so plz tell me with sample how can i do this one..



Problem in binding List<> object to Gridview



We I bind a list<> object to a gridview it calls an error like this:

Error: DataBinding: 'Default2+JobsList' does not contain a property with the name 'JobId'

Hear is my markup Codes:

<asp:GridView ID="GridView1" runat="server" DataKeyNames="JobId" AutoGenerateColumns="False"
                                <asp:BoundField DataField="JobName" .../>
                                <asp:BoundField DataField="JobExplain" .../>
                                <asp:ButtonField CommandName="DeleteJob" .../>

and Code behind:

public struct JobsList
        public int JobId;
        public string JobName, JobExplain;
        public JobsList(int id, string name, string explain)
            JobId = id;
            JobName = name;
            JobExplain = explain;

List<JobsList> list = new List<JobsList>();


list.Add(new JobsList(Approperiate Attributes..));
GridView1.DataSource = list;

passing object values from server to client problem


I get a message that x_login is not declared.  I added Dim login as String = "123", but that didn't help.  What's the problem?

code behind....

Dim Login = "123"
x_login.Value = loginID


<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<form id="simForm" runat="server" method='post' action='https://test.authorize.net/gateway/transact.dll'>
        <input id="HiddenValue" type="hidden" value="Initial Value" runat="server" />
        <input type='hidden' runat="server" name='x_login' id='x_login' />
        <input type='submit' runat="server" id='buttonLabel' />



Problem passing custom object returned by the same webservice among two separate projects

I am running into casting issue with this scenario: 1. I made a custom object lets call it EmployeeObject.  2. The Employee object is wrapped in the EmployeeWebservice.  3. I have a client application project lets call it EmployeeClientApplication and a class library called DoSomeWorkClassLibrary.  Both EmployeeClientApplication and DoSomeWorkClassLibrary reference the EmployeeWebService and need to be able to pass the EmployeeObject back and forth.  4. The EmployeeClientApplication also references the DoSomeWorkClassLibrary. 5. The employeeObject in the EmployeeClientApplication becomes EmployeeClientApplication.EmployeeWebService.EmployeeObject. 6. The employeeObject in the DoSomeWorkClassLibrary becomes DoSomeWorkClassLibrary.EmployeeWebService.EmployeeObject. 7. The DoSomeWorkClassLibrary has a method called DoSomeWork that takes an EmployeeObject. When I try to pass employeeObject from EmployeeClientApplication to DoSomeWorkClassLibrary by doing something like this: DoSomeWorkClassLibrary.DoSomeWork(EmployeeClientApplication.EmployeeWebService.EmployeeObject), I am getting Unable to convert EmployeeClientApplication.EmployeeWebService.EmployeeObject to DoSomeWorkClassLibrary.EmployeeWebService.EmployeeObject.  I have searched high and low to fix this issue, I have tried changing the namespace of the reference.cs file of the webservice in

wpf charting column series data binding problem

I'm trying to build a chart using the columnSeries from the wpf toolkit and I appear to be having trouble with the data binding. Here is the xaml: <Grid>    <chartingToolkit:ColumnSeries Height="18" HorizontalAlignment="Left" Margin="188,169,0,0" Name="columnSeries1" VerticalAlignment="Top" Width="18" IndependentValueBinding="{Binding Path=Date}" DependentValueBinding="{Binding Path=Value}" /></Grid> In the code behind, I'm calling a stored procedure and putting the result in a datatable like this: string connString = ConfigurationManager.ConnectionStrings["string"].ConnectionString;            using (SqlConnection cn = new SqlConnection(connString))            {                DataTable dt = new DataTable("T1");                cn.Open();                SqlCommand cmd = new SqlCommand("T1_sp", cn);                cmd.CommandType = CommandType.StoredProcedure;                  SqlDataAdapter da = new SqlDataAdapter(cmd);                da.Fill(dt);                columnSeries1.ItemsSource = dt.DefaultView;                cn.Close();            } No error is being generated but I'm not getting a column chart either. If I take the same command and put it into a datagrid, it works fine. What do I need to do to get this into my column chart? If it helps,

ajax combobox having problem in binding data

Hi i am using ajaxtoolkit:combobox and i tried to bind data to this control in code behind file. but it is taking 3 to 4 mints to bind data and display the page. what is the problem? I am providing my aspx code and code behind code here<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="Dashboards_TestPage" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="cphMain" Runat="Server"> <asp:ScriptManager runat="server" ID="scriptMgr"> </asp:ScriptManager> <table border="1"> <tr> <td> <ajaxToolkit:ComboBox ID="ddlProgram" runat="server" DropDownStyle="DropDownList" AutoCompleteMode="SuggestAppend" CaseSensitive="False" MaxLength="10"> </ajaxToolkit:ComboBox> </td> </tr> </table> </asp:Content>  Code behind code:public partial class Programs_TestPage : System.Web.UI.Page { ProgramData programData = new ProgramData(); protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack)

Symbol.Keyboard.KeyPad() object creation problem

on windows mobile 6.5 application running on Windows mobile 6 professional VGA emulator. I am trying to work on keyboard functionality like function key press events. I have coded the below line.   Symbol.Keyboard.KeyPad keypad = new Symbol.Keyboard.KeyPad();   keypad.KeyStateNotify +=new Symbol.Keyboard.KeyPad.KeyboardEventHandler(keypad_KeyStateNotify); keypad.AlphaNotify +=new Symbol.Keyboard.KeyPad.KeyboardEventHandler(keypad_AlphaNotify);   Its build successfully but raising exception at runtime. please help me out to run this code on emulator. because i don't have device.

Problem Binding DropdownList in a gridView to a datasource

I have a Dropdownlist in an itemTemplate in a gridview. My gridView binds to dataTable1 (from which the selected value for dropdown comes from) and dropDown binds to dataTable2 (i need to get DataValueField and DataTextField from here).<asp:TemplateField HeaderText="Category"> <ItemTemplate> <asp:DropDownList ID="Cat" runat="server" SelectedValue='<%#Bind("CATEGORY") %>' > </asp:DropDownList> </ItemTemplate> <FooterStyle BorderStyle="None" /> <HeaderStyle BorderStyle="None" /> <ItemStyle BorderStyle="None" /> </asp:TemplateField>How do I do that? thanks in advance!

Problem with listing records from table (object not found)

Hi everyone, I'm creating a website based on ASP.NET MVC 2 and SQL Server 2008 R2 Express for the database. After creating the table in database, I want to list all records in that table. For that, I use "scaffold'ing in ASP.NET to automatically generate the view file. But I encountered an error when loading that page. The error message was: [CODE] Server Error in '/' Application. Invalid object name 'dbo.Accommodations'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Accommodations'. Source Error: Line 41:         </tr> Line 42: Line 43:     <% foreach (var item in Model) { %> Line 44: Line 45:         <tr> Source File: d:\MyProject\Views\Accommodation\Index.aspx    Line: 43 Stack Trace: [SqlException (0x80131904): Invalid object name 'dbo.Accommodations'.]    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584 &n

WCF protocol binding on htttp://* problem

Hello, has anyone found a solution to this famous Visual Studio 2008 problem with WCF debugging? It's in other threads of the forum, http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/782a48a2-a44c-4ced-934b-715c2e4cb6a4 http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/41630af1-37ec-411f-969b-3e857f978279/ but it's never really been answered. I have been looking for a solution for some time, but I haven't found anything. The problem is always the same: The VS internal web server every now and then gives an error saying NO PROTOCOL BINDING MATCHES THE GIVEN ADDRESS '' and the only solution to the problem is to reboot the machine. Changing web.config doesn't work, restarting Visual Studio neither. Any ideas anybody?

Problem with Binding Dictionary to Combo Box Control

Hi All,I am trying to figure out how to bind <Key,Value> pair to Combo Box Control in WPF. By now i have found that the following code do not hold Keys in the comboBox:[vb Code]Dim MyDictionary as Dictionary(OF String,String)MyDictionary.Add("Key1","Value1")MyDictionary.Add("Key2","Value2") ..etc.'***** MyComboBox is ComboBox control ******MyComboBox.ItemSource =  MyDictionary.Values[xmal]<xmls:ComboBox x:Name="MyComboBox" />Doing the above process does not fulfill my purpose of capturing keys. Example if i want to get the "Key" for "selectedItem" then i cannot since i have not binded it.Can anyone suggest me a solution? If anyone can provide me with a xmal and code behind that would be great!!!THanks in Advance.

FormView custom data binding problem

Hi there,   I'm using VWD 2010 ASP.NET 4.0 and SQL Server 2008 Also I have login page with the ASP.NET configuration   one of my page has FormView with Update feature   Evryting works fine user login go to my FormView page and update the record.   Now I created a simple function   Protected Function GetUserName() As String        Return User.Identity.Name    End Function   and one of my coloumn call EditedBy   I replaced the Bind("EditedBy") field binding with   Custom binding GetUserName()   When user update it show the current user login name on the screen But it won't show in the table itself (it show null value when i do select statement)   I used to do this with ASP.NET 2.0 with no problem?   How do I fix that?   Thanks, Oded Dror  

Solution Deployment Problem (Administrative Framework Object Dependencies)

I'm having a problem with the deployment of a SharePoint workflow solution - hopefully someone can help me out.Here is the sequence of STSADM commands and their output from the console:C:\Workflows>stsadm -o deactivatefeature -name IL.SharePoint.Workflows -url http://localhost/ -forceOperation completed successfully.C:\Workflows>stsadm -o uninstallfeature -name IL.SharePoint.Workflows -forceOperation completed successfully.C:\Workflows>stsadm -o retractsolution -name IL.SharePoint.Workflows.wsp -localDeploymentSucceeded : server : The solution was successfully deployed.il.sharepoint.workflows.wsp: Operation completed with errors.C:\Workflows>stsadm -o deletesolution -name IL.SharePoint.Workflows.wspOperation completed successfully.C:\Workflows>stsadm -o addsolution -filename IL.SharePoint.Workflows.wspAn object in the SharePoint administrative framework, "SPSolutionLanguagePack Name=0 Parent=SPSolution Name=il.sharepoint.workflows.wsp", depends on other objects which do not exist.  Ensure that all of the objects dependencies are created and retry this operation.IL.SharePoint.Workflows.wsp: The Solution installation failed.Here is the related log info from the SharePoint logs:error-redacted.txtAs far as I can see, SP is attempting to insert a "SPSolutionLanguagePack" object into the configuration database, with an invalid foreign key reference

GridView column/row data binding problem

Hi All, I have a table with the following structure: Attribute------------- AttributeIdWeekNoDayNoAttribute1Attribute2Attribute3Attribute4Attribute5 ........ likewise. I want to display these data in a gridview in the following manner                                  Sunday    Monday Tuesday ............ (till Saturday) - should be gridview columns, I can retrieve this using dayno Attribute 1 Attribute 2 Attribute 3 Attribute 4 .......... like wise attributes should be taken in to rows.Is this possible in a gridview, if so how can I do that?

Problem binding business objects to custom user control properties

I have created a user control (supplierPicker) intended to allows a supplier database to be searched and a supplier selected. I want to be able to use this control in a number of other user controls, by binding the suppplierID property of the supplierPicker to a supplierID property in a business object, which is set as the datacontext of the parent user control. When I do this, and there is a supplierID specified in the business ofbject, the binding sets the supplierID in the supplierPicker control and it shows the correct supplier name in the textbox. However when the supplierID DependencyProperty is changed from within the supplierPicker the newly selected supplier name is shown in the TextBox, but the SupplierID does not propogate back to the business object. Other controls on the parent form work fine, so the binding to the business object seems to be ok. Any pointers as to what I'm doing wrong here would be grately appreciated.  This one has been driving me nuts for days! Snipped code for the supplier picker:         public partial class SupplierPicker : UserControl, INotifyPropertyChanged     {         public static DependencyProperty SupplierIDProperty;         public event PropertyChangedEventHandler PropertyChan

.NET Remoting Problem with Sponsor Renewal on CAO (Client Activated Object) Architecture

I have figured out a strange behaviour when using Client Activated Sponsorship and hope to get a hint from somebody who already got in touch with similar problems. The case is as follows: An Application is used by a server and a client. Both use (or try to use) the same objects after a user login. A lease of a session object on the server (serverSession) is initialised correctly with all of its regular remoting values in the lease for InitialLeaseTime (10) SponsorshipTimeout (5) RenewOnCallTime (10) In order to test the behaviour the values are set to seconds. It is easier to check the log every few seconds, than to wait some minutes until the Sponsorship Renewal call. If a client performs a login, the lease is according to its logged in state renewed each 10 seconds (or whatever the value is set to). So no problem so far. The lease will be alive as long as the client performs a logout, by the way it is used on a local network. Just compare the log (the renewal is firing every 10 seconds as expected): 2010-02-17 10:29:40.4338 Info Log5 SponsorObject:Renewal() 2010-02-17 10:29:50.4308 Info Log5 SponsorObject:Renewal() 2010-02-17 10:30:00.4328 Info Log5 SponsorObject:Renewal() 2010-02-17 10:30:10.4298 Info Log5 SponsorObject:Renewal() 2010-02-17 10:30:20.4318 Info Log5 SponsorObject:Renewal() 2010-02-17 10:30:30.4288 Info Log5 SponsorObject:Renewal() As soon as
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