首页 新闻 会员 周边 捐助

后台拼接HTML合并行

0
[已关闭问题] 关闭于 2012-09-21 17:56

     public string GetDptIdeasData()        

{             StringBuilder temp = new StringBuilder();

            for (int i = 0; i < mainIdeas.Rows.Count; i++)     

        {                 string strJSON = WCFHelper.GetWCFValue(mainIdeas.Rows[i]["部门"].ToString(), ConfigurationManager.AppSettings["GetWFUserByID"]);                 WFUser wfuser = JsonConvert.DeserializeObject<WFUser>(strJSON);

                temp.Append(@"<div id=" + mainIdeas.Rows[i]["UserID"].ToString() + " fid=0> ");               

  temp.Append(@"<table border=0 style='border-collapse: collapse; font-size: 12px; width: 100%;'>                   

    <colgroup>          

                 <col width='15%' />                 

                  <col width='15%' />        

                   <col width='70%' />                     

   </colgroup>                     

  <tr style='text-align: left' onmouseover='TrOnMouseOver(this)' onmouseout='TrOnMouseOut(this)'>  ");         

        temp.Append(@"<td>      <img id=imgsign fid='" + mainIdeas.Rows[i]["UserID"].ToString() + "' onclick='ImageClick(" + mainIdeas.Rows[i]["UserID"].ToString() + wfuser.DptId.ToString() + ",this)' src='../Images/p.gif' align=middle />&nbsp;" + wfuser.DptName.ToString()); 

temp.Append(@"</td>  <td>" + mainIdeas.Rows[i]["处理人"].ToString());                 temp.Append(@"</td>  <td>");

                for (int j = 0; j < Dsource.Rows.Count; j++)//每个人的所有处理意见                 {  string strJSONs = WCFHelper.GetWCFValue(Dsource.Rows[j]["部门"].ToString(), ConfigurationManager.AppSettings["GetWFUserByID"]);

                    WFUser wfusers = JsonConvert.DeserializeObject<WFUser(strJSON);                     if (wfusers.DptId.ToString() == wfusers.DptId.ToString() && mainIdeas.Rows[i]["UserID"].ToString() == Dsource.Rows[j]["UserID"].ToString())                     {                         temp.Append(Dsource.Rows[j]["处理意见"].ToString() + "<br/>");                    

                      }               

                 }                

         temp.Append("</td></tr></table>");  

           temp.Append("</div>");

                temp.Append("<div id=" + mainIdeas.Rows[i]["UserID"].ToString() + wfuser.DptId.ToString() + " fid='1' style='display:none;'>");                 temp.Append(@"<table border=0 style='border-collapse: collapse; font-size: 12px; width: 100%;'>");    

  temp.Append(@"<colgroup>          

                 <col width='15%' />                          

                <col width='15%' />                          

                <col width='70%' />                     

                    </colgroup>");              

          for (int k = 0; k < Dsource.Rows.Count; k++)//每条处理意见                             {        string strJSONs = WCFHelper.GetWCFValue(Dsource.Rows[k]["部门"].ToString(), ConfigurationManager.AppSettings["GetWFUserByID"]);       

              WFUser wfusers = JsonConvert.DeserializeObject<WFUser>(strJSON);                     if (wfuser.DptId.ToString() == wfusers.DptId.ToString())                     {

                        temp.Append("<tr style='text-align: left' onmouseover='TrOnMouseOver(this)' onmouseout='TrOnMouseOut(this)'>");                         temp.Append(@"<td>   &nbsp;" + wfusers.DptName.ToString());                         temp.Append(@"</td> <td>" + Dsource.Rows[k]["处人"].ToString());                         temp.Append(@"</td> <td>");

                        temp.Append(Dsource.Rows[k]["处理意见"].ToString());

                        temp.Append(@"</td></tr>");                  

                  }              

         }                

       temp.Append(@"</table></div>");       

      }             return temp.ToString();

  }上面代码实现的效果

 

部门相同时合并(达到下面的效果,点记加号展开全部)

hxkk的主页 hxkk | 初学一级 | 园豆:181
提问于:2012-09-19 18:08
< >
分享
所有回答(1)
0

其实这些操作还不如放到前台去做呢

chenping2008 | 园豆:9836 (大侠五级) | 2012-09-19 21:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册