Click here to Skip to main content
13,250,043 members (67,827 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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 20:44pm
Updated 7-Dec-12 21: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 :)
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 9 Dec 2012
Copyright © CodeProject, 1999-2017
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