Here we have a simple trick.
I'll introduce my objects first.
Nothing to worry about. If I show you the XML view of the User[], it should looks like below.
Now we can assign this to a GridView.
Code:
GridView1.DataSource = UserList;
GridView1.DataBind();
Design:
Dont forget to import the objects namespaces in the page header in the HTML view.
........
........
Explanation:
I'm using to show the child object property values in to the grid.
What we are doing here is to match the Parent object property name Home to access the child object. Actually it is a object of Address type. So that I can cast the object to Address type and access the child property Country.
Monday, July 30, 2007
Thursday, July 19, 2007
Assign object list to a GridView in asp.net 2.0
Simply follow the scenario below.
1. Drag a GridView control to the page.
2. Assign the Object list into the grid as below.
// c# - Bind data to the drop down
GridView1.DataSource = userList;
GridView1.DataBind();
3. Run the application. That's all.
If you need to show only few columns, do the following.
1. Go to GridView Properties.
2. Open the "columns" property.
3. Uncheck the check box "Auto-Generate fields".
4. Add any type of fields and set the "DataField" to a property in your object for the selected field. For example "UserName".
1. Drag a GridView control to the page.
2. Assign the Object list into the grid as below.
// c# - Bind data to the drop down
GridView1.DataSource = userList;
GridView1.DataBind();
3. Run the application. That's all.
If you need to show only few columns, do the following.
1. Go to GridView Properties.
2. Open the "columns" property.
3. Uncheck the check box "Auto-Generate fields".
4. Add any type of fields and set the "DataField" to a property in your object for the selected field. For example "UserName".
Out source developments
We have a set of teams accepting out sourced development projects (small to medium in complexity). They are always ready to provide you the best with a good design, robust application and a good support after the delivery.
Monday, July 9, 2007
Use multiple log4net outputs from one application
Who are interested in resolving this for your project, refer the following article i wrote to code project.
Log4net
Log4net
Thursday, July 5, 2007
Subscribe to:
Posts (Atom)