Infragistics 中UltraWebGrid 单元格加入链接.

Infragistics 中UltraWebGrid 单元格加入链接.

扩展上一章中的
上一章请查看
http://blog.csdn.net/rjzou2006/archive/2008/08/07/2780255.aspx

在原有的BindView()方法上修改

  1.         private void BindView()
  2.         {
  3.             this.UltraWebGrid1.DisplayLayout.ColHeadersVisibleDefault = ShowMarginInfo.Yes;
  4.             UltraWebGrid1.ResetRows();
  5.             Guid curdept = Guid.Empty;
  6.             for (int i = 0; i < GridSource.Rows.Count; i++)
  7.             {
  8.                 curdept = new Guid(GridSource.Rows[i]["dept_id"].ToString());
  9.                 UltraWebGrid1.Rows.Add(new UltraGridRow());
  10.                 UltraWebGrid1.Rows[i].Cells[0].Value = GridSource.Rows[i]["dept_id"];
  11.                 UltraWebGrid1.Rows[i].Cells[1].Value =  GridSource.Rows[i]["dept_name"];
  12.                 UltraWebGrid1.Rows[i].Cells[2].Value = 
  13.                     this.FormatUrlForList(ConstValues.Instance.UrlNoneMake, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["nomakecount"]));//未处理扣分                
  14.                 UltraWebGrid1.Rows[i].Cells[3].Value = 
  15.                     this.FormatUrlForList(ConstValues.Instance.UrlTimeOver, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["overtimecount"]));//超时扣分
  16.                 UltraWebGrid1.Rows[i].Cells[4].Value = 
  17.                     this.FormatUrlForList(ConstValues.Instance.UrlDeptBuild, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["deptbuildcount"]));//组织建设扣分
  18.                 UltraWebGrid1.Rows[i].Cells[5].Value = 
  19.                     this.FormatUrlForList(ConstValues.Instance.UrlErrorCase, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["errorcasecount"]));//督办与错办案件扣分
  20.                 UltraWebGrid1.Rows[i].Cells[6].Value = 
  21.                     this.FormatUrlForList(ConstValues.Instance.Inspectionnosuccesscount, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["Inspectionnosuccesscount"]));//巡查未达标扣分
  22.                 UltraWebGrid1.Rows[i].Cells[7].Value = 
  23.                     this.FormatUrlForList(ConstValues.Instance.UrlCaseFrom, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["casefromcount"]));//公众投诉案件扣分
  24.                 UltraWebGrid1.Rows[i].Cells[8].Value = GridSource.Rows[i]["smallsum"];//总分
  25.                 UltraWebGrid1.Rows[i].Cells[9].Value = GridSource.Rows[i]["smallsumlist"];//排名
  26.             }
  27.             UltraWebGrid1.Bands.Add(new UltraGridBand());
  28.             for (int i = 0; i < UltraWebGrid1.Rows.Count; i++)
  29.             {
  30.                 UltraWebGrid1.Rows[i].ShowExpand = true;
  31.             }
  32.         }
  1.         /// <summary>
  2.         /// 格式化化url链接
  3.         /// </summary>
  4.         /// <param name="url">待格式化的url</param>
  5.         /// <param name="dept"></param>
  6.         /// <param name="ds"></param>
  7.         /// <param name="de"></param>
  8.         /// <param name="urlText">显示的文本内容</param>
  9.         /// <returns></returns>
  10.         private string FormatUrlForList(string url,Guid curDept,DateTime ds,DateTime de,int urlText)
  11.         {
  12.             if (urlText == 0)
  13.             {
  14.                // return urlText.ToString();
  15.             }
  16.             url = string.Format(url, curDept, ds.ToString("yyyy/MM/dd"), de.ToString("yyyy/MM/dd"), urlText);
  17.             return url;
  18.         }
上面就可在单元格中加入链接了.

end


外话:
在utraWebGrid中的事件 InitializeRow,InitializeLayout,Initialize...的事件都是在this.UltraWebGrid1..DataBind()时候执行的
我们上面是用for给UltraWebGrid填充进去的.
是不触发事件的
请记住.这一点让我找了很久.

谢谢大家观看.希望能给大家一点帮助.




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

rjzou2006

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值