mendhak
I sure you can help me,
and I know that my english hard to understand
now I just in the begining.
I want to built forum like tree
father1
son 1
grandson
son 2
grandson
grandson
I take all the father message
and insert into grid view
here the exapmle http://212.199.43.15/forum/showmessage.aspx
now the hard part is to take the sons and the greandsons etc'
here I need a recursive function.
I try write this:
and in the grid view I call the function:Code:} protected string ShowSun(string mid) { string h = ""; string strSQL; strSQL = "select * from forum where fID = " + mid; OleDbConnection cn = new OleDbConnection(ConfigurationManager.ConnectionStrings["conn"].ToString()); cn.Open(); OleDbDataReader reader; cmd.Connection = cn; cmd.CommandText = strSQL; reader = cmd.ExecuteReader(); while (reader.Read()) { h += "<BR>" + reader["subject"].ToString(); h += "ShowSun(" + reader["mid"].ToString() + ")"; ShowSun(reader["mid"].ToString()); } return h; }
but this function doesnt work, it take just the sons and not the grandsons.Code:<%# ShowSun(Eval("mID").ToString())%>
if you have an idea how to fix it, or another way to do it,
it will help me so much
thanks!




Reply With Quote