Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 11th, 2007, 11:22 PM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default custome display in grid view

i have table having three columns state,city and address

a state have multiple cities and there are many records for one city.

i fetch all the data from database by datareader. or when i get city i get all records for that city in dataset.

my main trouble is how to display data in required form. i want to display data in following form:

State1 (one time)

City1 (one time)

Address1

Address2

Address3

City 2

Address1

Address2

Address3

Please help me.



thanks......
__________________
thanks......
 
Old November 12th, 2007, 12:54 AM
Authorized User
 
Join Date: Jan 2007
Location: Islamabad, Punjab, Pakistan.
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aliirfan84
Default

Dear,
    You have to make parent child relationship in dataset. First you have to get each tables data from Database into new table and then add this table to common dataset.
    DataSet has methods as shown below:

     dsObject.Relations.Add("relationName",dsObject.Tab les("table1").Columns("colName"),dsObject.Tables(" table2").Columns("colName")

This will create Parent-Child relationship.

Now in ur .aspx, take databinding control of ur choice(Grid,Repeater,DataList). Put another data control inside another. For example, if u take GridView then add another girdview/reapter control in using template column.

In ur .cs/.vb file, set dataSource property of parent databinding control to .dsObject. U just need to set child control datasource property to dsObject.CreatChilView("relationName").

Hope it will help.

Regards


Regards,
Ali Irfan
Software Engineer
 
Old November 12th, 2007, 01:49 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

my all data is present in one table.
are you saying that i should issue three queries and store it in three tables. No.
am i confuse
can you explain it in littele more from syntax point of view.
i will be extremely thankful to you.


thanks......
 
Old November 14th, 2007, 10:11 PM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

well i solve this problem by taking a table control in aspx page and creating table rows and cells in code file and put controls and text into that.


thanks......
 
Old November 16th, 2007, 09:13 AM
Authorized User
 
Join Date: Jan 2007
Location: Islamabad, Punjab, Pakistan.
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aliirfan84
Default

Yes dear, You have to made three SQL queries and then store in same dataset.
Rest is as I mentioned in last post. Sorry for late reply.



Regards,
Ali Irfan
 
Old November 16th, 2007, 11:45 PM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

yes, i solved it thanks for all help.

thanks......




Similar Threads
Thread Thread Starter Forum Replies Last Post
Grid view roopeshmkatlive.in ASP.NET 1.0 and 1.1 Professional 1 August 1st, 2008 01:03 PM
Help Grid View Drop Down List, view all jskinner123 ASP.NET 2.0 Basics 0 November 25th, 2007 06:25 PM
grid view komalpriya .NET Framework 2.0 3 November 7th, 2007 10:34 AM
grid view MunishBhatia ASP.NET 2.0 Professional 1 May 25th, 2007 07:26 AM
How to display data into Grid View? Somesh ASP.NET 2.0 Professional 5 May 25th, 2007 07:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.