Search
MVC Online Training
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Forums Author
Sun, 21-Sep-2014 Authors
All Time Authors
Jayakumars
4170
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)
 Forum Post

Grid view bind method no repeated the fields?

Chandru_ra
Posted by Chandru_ra under ASP.NET on 2/8/2012 9:04:34 AM | Points: 10 | Views : 1110 | Status : [Member] | Replies : 9


Hi,

am using gridview bind method sql call from three tables joining but repeat the fields coming. i want dont repeated the fields.


i used query:
SELECT a.sno,a.menuname,b.submenuname,b.sno from submenu as b inner join topmenu as a on a.sno=b.menuid INNER JOIN Submenulist as c ON b.sno=c.submenuid

am send model screen shot. now am want example website manager dont repeat more time and website manager toblink another link example
domain manager sublink.

chandru

Posted by: Ogipansrk on: 2/8/2012 [Member] Starter | Points: 25

make auto generate colums to false !

Chandru_ra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 2/8/2012 [Member] Silver | Points: 25

can you attach sql query output here and attach the result screen ?

Thanks,
Sanjay

Chandru_ra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chandru_ra on: 2/9/2012 [Member] Starter | Points: 25

hi,

this is my sql query output...

1 Websit Manager Domain Manager 1
2 Table Reservation Restaurant Manager 1
3 Costomer Manager Team Manager 1
4 Urbane News & Events 1
5 Discover Careers 1
6 Vehicle Maintanance Customer Feedback 1
7 Sales Photo Gallery 1
8 Reports Manage Videos 1
9 Manage Users Health Tips 1
10 Websit Manager Food Menu Manager 1

chandru

Chandru_ra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 2/9/2012 [Member] Silver | Points: 25

can you also attach an image what you get as output and an image how you want your output be?

Thanks,
Sanjay

Chandru_ra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 2/9/2012 [Member] Bronze | Points: 25

Hi,
Do you want to combine website managers i.e shows one website manger and two sublinks, domian manager and food menu manager? if so Can you give your table structure

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Chandru_ra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sahoo2sunil on: 2/9/2012 [Member] Starter | Points: 25

You just modify your query then you can get no repeated data.
Your Modify query is
SELECT a.sno,a.menuname,b.submenuname,b.sno from submenu as b inner join topmenu as a on a.sno=b.menuid INNER JOIN Submenulist as c ON b.sno=c.submenuid group by a.sno,a.menuname,b.submenuname,b.sno

If you think still repeated rows coming on your Grid you just run the query on sql server and see there is different sno in your output.
So to Show on Grid You just remove a.sno and b.sno from your select statement.
Your Modify query is
SELECT a.menuname,b.submenuname from submenu as b inner join topmenu as a on a.sno=b.menuid INNER JOIN Submenulist as c ON b.sno=c.submenuid group by a.menuname,b.submenuname

Chandru_ra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chandru_ra on: 2/9/2012 [Member] Starter | Points: 25

hi,

i want no repeat websitemanager show.

example:

Mani menu: Websitemanager
submenu:
Domain Manager
Restaurant Manager
Team Manager
this type of output i want

Advance thanks to all

 Download source file

chandru

Chandru_ra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chandru_ra on: 2/9/2012 [Member] Starter | Points: 25

hi,
CREATE TABLE [dbo].[topmenu](
[sno] [int] IDENTITY(1,1) NOT NULL,
[menuname] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[status] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[submenu] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]

CREATE TABLE [dbo].[submenu](
[menuId] [int] IDENTITY(1,1) NOT NULL,
[sno] [nvarchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[submenuname] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[menuurl] [nvarchar](150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[status] [nvarchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[showmenu] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]

CREATE TABLE [dbo].[Submenulist](
[submenuId] [int] IDENTITY(1,1) NOT NULL,
[sno] [int] NULL,
[SubmenuList] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MenuUrl] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Status] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ShowMenu] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]

Advance Thanks to all

chandru

Chandru_ra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mageshinfo on: 2/9/2012 [Member] Starter | Points: 25

Hi

Which field was repeated.use distinct in front of the field.
Ex:

SELECT DISTINCT City FROM Persons

P.Magesh
Software Engineer
Colan Infotech

Chandru_ra, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response


Found interesting? Add this to: