Posted on: 4/21/2011 1:02:03 PM | Views : 326

hi all...i need your help..
i'm using method to count total comment in my application.

This is my code : 

Comment.aspx
<asp:TemplateField HeaderText="Comment" ItemStyle-CssClass="GridviewItem" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="15%" ItemStyle-Wrap="false"> <ItemTemplate> <%#GetCountComment(Convert.ToString(Eval("IdTopic")))%> </ItemTemplate> <HeaderStyle Width="15%" /> <ItemStyle CssClass="GridviewItem" HorizontalAlign="Center" VerticalAlign="Top" Wrap="False" /> </asp:TemplateField>
Comment.aspx.cs
protected String GetCountComment(string IdTopik) { try { string value = String.Empty; DMSDataAccess db = new DMSDataAccess(); var comment = db.DMSDataContext.Comments.Where(p => Convert.ToString(p.IdTopic) == IdTopic); value = Con ...

Go to the complete details ...