I have a label within GridView and i want to Bind it with a query something like this..
select COUNT(*)
from tbl_like
inner join Scrap on tbl_like.scrapid=Scrap.Id
where tbl_like.likestatus=1 and tbl_like.scrapid='DataBinder.Eval(Container.DataItem,"ScrapId")'
I know the above code will not work, what can i do to make it work?
source code:
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# "Id of Scrap:"+DataBinder.Eval(Container.DataItem,"ScrapId") %>'></asp:Label>
</ItemTemplate>
Here is how to get this to work:
update your item template to look like this