How to bind user defined data type object to DetailsView?

Hi I am having a class which contains user defined data type property. I have created an instance of that class. When I bind that object of that class to DetailsView it is showing all properties except user defined data type property. Here is the sample code.

public class Customer { public string CustomerName { get; set; } public int Age { get; set; } public Address CustomerAddress { get; set; } } Address class looks like public class Address { public string Line1 { get; set; } public string Line2 { get; set; } public string City { get; set; } } Creating an object of Customer class var cust = new Customer { CustomerName = "abc", Age = 25, CustomerAddress = new Address{ Line1 = "abc", Line2 = "abc", City = "abc" }}; Binding cust to Details View List<Customer> customerInfo = new List<Customer>(); customerInfo.Add(cust); DetailsView1.DataSource = custmerInfo; DetailsView1.DataBind(); In .aspx page <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"> <Fields> <asp:BoundField DataField="CustomerName" HeaderText="Customer Name"> <asp:BoundField DataField="Age" HeaderText="Customer Age"> <asp:BoundField DataField="CustomerAddress" HeaderText="Customer Address "> </Fields> </asp:DetailsView>

Above code is not displaying Customer Address. Can any one help me ?

Category:c# Views:1 Time:2010-12-13

Related post

  • Return a User Defined Data Type in an Excel Cell 2009-08-30

    I've searched the web and I've searched the questions here on stackoverflow, but I haven't been able to find a solution. Here is what I'd like to do: Suppose I have the following code in a class module named "MyClass" Option Explicit Dim var1 as inte

  • Value too large for defined data type 2010-12-16

    I am reading data from a special device that is producing around 20 MB/s /dev/dvb/adapter0/dvr0 I need to read the contents and copy to other fifos device_fd =, os.O_RDONLY) while True: if jobm.has_jobs(): chunk = d

  • user defined data type in mysql with java 2011-11-18

    lets say i have a class named myClass1 and i have another class myClass2 such that myClass1 contains a collection of myClass2... storing this in java is very easy. i was wondering how can we do that if the values needs to be stored in a table in mysq

  • built-in data type conversion to user defined data type c++ 2011-12-20

    My question is regarding data type conversion in c++. Does c++ provides a implicit conversion for built-in data types ( int, float) to user defined data types? In the following example, I am trying to add a double ( t4 = t3 + 1.0) with test object ty

  • SQL Server 2005 user-defined data type, tempdb and permissions 2012-03-04

    I have a DB running on SQL Server 2005 that has a user-defined data type. The user-defined data type is also implemented in the model database, so that when I create a temp table I can use the same user-defined data type. For instance, in AppDB I hav

  • T-SQL: How can I get user-defined data-type of the column by its ID? 2008-10-31

    I have a query like this: SELECT TABLE_NAME, COLUMN_NAME, IS_NULLABLE, DATA_TYPE FROM MY_DB.INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'OrderId' ORDER BY TABLE_NAME GO The OrderId column is of user-defined data type. But DATA_TYPE in the query sh

  • How to define a user-defined data type with addressable members? 2008-12-16

    I have an unusual situation to model in a MS SQL Server database: the primary key of a table is a multi-segment 'natural' key composed of 5 foreign keys (of fixed sizes). I'd like to be able to define a user-defined data type to implement the data st

  • How cool are User Defined Data Types in SQL Server? 2009-03-18

    Are User Defined Data Types in SQL Server something that a intermediate SQL user should know and use? What are pros and cons of using UDTs? --------------Solutions------------- Never use them is my advice. You are in a world of hurt if you ever have

  • cc1plus: error: include: Value too large for defined data type when compiling with g++ 2010-03-13

    I am making a project that should compile on Windows and Linux. I have made the project in Visual Studio and then made a makefile for linux. I created all the files in Windows with VS. It compiles and runs perfectly in VS but when I run the makefile

  • How can I store a dataset object into a package variable of data type object? 2010-05-21

    How can I store dataset object into a package variable of data type Object and assigning it back to another Dataset object from within a script task? --------------Solutions------------- Here is a code example from a previous answer of mine. It shows

  • Sql server 2008 user defined data types 2011-03-16

    Can anybody please tell me what user defined data type is in sql server and also how to create one. And can i create a user defined datatype which resembles a .net datatable and pass this datatable as parameter to a stored procedure. --------------So

  • How to store User defined data type through DataContext? 2011-04-08

    I used DataContractSerializer to save user data but now I want to use DataContext for my database design. But the system existed struture as below cannot be stored through DataContext. class Data { public DataType1; public DataType2; } It seems these

  • Debug stored procedure with user defined data type 2011-04-12

    Is it possible to debug a stored procedure with a user defined data type as a parameter? Edit: which is the syntax to call it? (exec ....) My type: CREATE TYPE [dbo].[FacturaInspeccion] AS TABLE( [sIdServicio] [nvarchar](3) NOT NULL, [nIdTipoInspecci

  • Is it possible to create User-Defined Data Types when using EF 4.1 Code First? 2011-11-10

    When using EF 4.1 Code First, is it possible to create User-Defined Data Types for your schema? --------------Solutions------------- Simple answer is no. Longer answer: Current EF implementation leads to multiple issues when trying to use user define

  • "Value too large for defined data type" with "tar" on some devices 2012-02-20

    I've got an application on the Market that can send application data from one device to another. To do that I create a .tar archive of the app's data and then send that to the other device over WiFi. The application is working great on most devices,

  • error opening file for reading: Value too large for defined data type 2014-04-29

    #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <sys/mman.h> #include <iostream> using namespace std; #define FILEPATH

  • Is it necessary to double define data type? 2010-12-24

    In the code.... NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); is it actually necessary to define the data type twice? --------------Solutions------------- I would argue that you aren't defining it twice, but d

  • JAX-WS @WebMethod Return User-Defined Data Type 2012-03-19

    I'm trying to create a jax-ws web service that would query a mysql database and return user-defined datatype from the @WebMethod. I first tried returning a sql.ResultSet which is provided by the sql import. However, JAXB couldn't bind it. So I tried

  • Using vector of user defined class type objects 2012-04-02

    Working on solving a simple problem in C++, want to understand how I could use vector of objects of user defined class type without fixed(worst case) number of elements allocated while instantiating that vector of objects. i.e. Currently I have to us

Copyright (C), All Rights Reserved.

processed in 0.155 (s). 11 q(s)