Click here to Skip to main content
11,630,144 members (80,109 online)
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


Advertise | Privacy | Mobile
Web02 | 2.8.150723.1 | Last Updated 9 Dec 2012
Copyright © CodeProject, 1999-2015
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