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 OriginalGriff 278
1 Maciej Los 245
2 Nguyen.H.H.Dang 230
3 Peter Leow 195
4 arvind mepani 187


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