Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
i have gridview and i want show no of photos according to profile id..I used following but it gives error:
 
<asp:BoundField DataField="ADD_USER_ID" HeaderText="Profile Id"/>
   <asp:BoundField DataField="PHOTO_ID" HeaderText=" Uploaded Photos" />
 

cs code:
SysATGlobal.DB.ExecuteSelectQueryForGridView("SELECT ADD_USER_ID,COUNT(PHOTO_ID) FROM DSActor.DTL_PHOTOS GROUP BY ADD_USER_ID", ref GrdATviewdata);
 
it gives error:
"A field or property with the name 'PHOTO_ID' was not found on the selected data source."
 
plz help me?
Posted 7-Dec-12 19:44pm
Edited 7-Dec-12 20:26pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi,
 
Use this query
 
"SELECT ADD_USER_ID,COUNT(PHOTO_ID) as 'PHOTO_ID' FROM DSActor.DTL_PHOTOS GROUP BY ADD_USER_ID"
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

try this
 
SELECT ADD_USER_ID,COUNT(PHOTO_ID) as ID FROM DSActor.DTL_PHOTOS GROUP BY ADD_USER_ID
 
and in gridview
 

<asp:boundfield datafield="ADD_USER_ID" headertext="Profile Id"  />
   <asp:boundfield datafield="ID" headertext=" Uploaded Photos" />
 
Hope this solution will Work for you Smile | :)
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 550
1 mhegazy94 460
2 Ravi Bhavnani 230
3 Kornfeld Eliyahu Peter 185
4 Shemeemsha RA 160
0 Sergey Alexandrovich Kryukov 7,295
1 OriginalGriff 6,841
2 CPallini 5,420
3 George Jonsson 3,654
4 Gihan Liyanage 2,797


Advertise | Privacy | Mobile
Web02 | 2.8.140922.1 | Last Updated 9 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100