好象没有问题,但就是运总是出以下问题
public void bindTreeView( )
{
string strNF;
string strNF1 = " ";
string strGroup;
string strYear;
bool isExpand = false;
TreeNode pNode = new TreeNode();
TreeNode cNode = new TreeNode();
strYear = DateTime.Now.ToString( "yyyy ");
DataTable dt = getCateorys().Tables[0];
tvMain.Nodes.Clear();
foreach (DataRow row in dt.Rows)
{
strNF = row[ "nf "].ToString();
strGroup = row[ "groupby "].ToString();
if (strNF == strNF1)
{
cNode.Text = strGroup;
cNode.Value = strGroup;
pNode.ChildNodes.Add(cNode);
strNF1 = strNF;
}
else
{
pNode.Text = strNF;
pNode.Value = strNF;
if (strNF == strYear)
{
isExpand = true;
&nb