TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kieky bouvier
NA
58
83.4k
How to return 0 value?
Apr 21 2011 10:07 AM
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 = Convert.ToString(comment.Count());
return value;
}
catch (Exception e)
{
return e.ToString();
}
}
i think my code is correct.. but it can't display "0" value.. Can u help me to fix it??
thanks before...
Reply
Answers (
33
)
Sending data from asp.net to php
How to delete root certifcate from Win CE device.