priyamsc 0 Light Poster

Hi,

I am doing forum project. I have a doubt, tat how to count the value. that is, all the data which displays in gridview. in tat i need to show the reply value [count the value from database].it means in database i hv field lke pid,pstreplyid,uid,tit,sub ...., in tat wen i create new msg it ll save in database giving pid automaticaly and in pstreplyid if its newmsg it creates 0 if its reply ten it takes pid value.

in gridview what i wud lke to display is, the reply value, if the pid(2) has 3 reply means, the field of reply shud show 3.

but i hv given query which displays only the new msg tat is pstreplyid=0.
i need to display new msg at the same time it should display the replyvalue also.

but i dnt knw how to count tat value so pls help me to do.
you just give me the suggestion to overcome the issue.

this is the gridview coding
============================

page load()
{
string k = "select *,(select uname from login where login.uid=thread.uid)as uname from thread where pstreplyid=0";
adp = new SqlDataAdapter(k, con);
DataSet ds = new DataSet();
adp.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}

HTML
====

<asp:TemplateField HeaderText="Thread">

<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("tit") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
< 
<asp:LinkButton ID="LinkButton1" runat="server" Text='<% # Eval("tit") %>' CommandName ="viewmsg" CommandArgument ='<%# DataBinder.Eval(Container.DataItem,"pid")%>' >LinkButton</asp:LinkButton>
<br />
<%#Eval("sub") %> 
</ItemTemplate>
<asp:BoundField HeaderText="Replies" DataField="pstreplyid"/>
<asp:BoundField DataField="pdate" HeaderText="Post Date" />
<asp:BoundField DataField="rdate" HeaderText="Reply Date" />
<asp:TemplateField HeaderText="Posted By">

Thank you in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.