Infragistics 中UltraWebGrid 单元格加入链接.
扩展上一章中的
上一章请查看
http://blog.csdn.net/rjzou2006/archive/2008/08/07/2780255.aspx
在原有的BindView()方法上修改
上面就可在单元格中加入链接了.
end
外话:
在utraWebGrid中的事件 InitializeRow,InitializeLayout,Initialize...的事件都是在this.UltraWebGrid1..DataBind()时候执行的
我们上面是用for给UltraWebGrid填充进去的.
是不触发事件的
请记住.这一点让我找了很久.
谢谢大家观看.希望能给大家一点帮助.
扩展上一章中的
上一章请查看
http://blog.csdn.net/rjzou2006/archive/2008/08/07/2780255.aspx
在原有的BindView()方法上修改
- private void BindView()
- {
- this.UltraWebGrid1.DisplayLayout.ColHeadersVisibleDefault = ShowMarginInfo.Yes;
- UltraWebGrid1.ResetRows();
- Guid curdept = Guid.Empty;
- for (int i = 0; i < GridSource.Rows.Count; i++)
- {
- curdept = new Guid(GridSource.Rows[i]["dept_id"].ToString());
- UltraWebGrid1.Rows.Add(new UltraGridRow());
- UltraWebGrid1.Rows[i].Cells[0].Value = GridSource.Rows[i]["dept_id"];
- UltraWebGrid1.Rows[i].Cells[1].Value = GridSource.Rows[i]["dept_name"];
- UltraWebGrid1.Rows[i].Cells[2].Value =
- this.FormatUrlForList(ConstValues.Instance.UrlNoneMake, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["nomakecount"]));//未处理扣分
- UltraWebGrid1.Rows[i].Cells[3].Value =
- this.FormatUrlForList(ConstValues.Instance.UrlTimeOver, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["overtimecount"]));//超时扣分
- UltraWebGrid1.Rows[i].Cells[4].Value =
- this.FormatUrlForList(ConstValues.Instance.UrlDeptBuild, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["deptbuildcount"]));//组织建设扣分
- UltraWebGrid1.Rows[i].Cells[5].Value =
- this.FormatUrlForList(ConstValues.Instance.UrlErrorCase, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["errorcasecount"]));//督办与错办案件扣分
- UltraWebGrid1.Rows[i].Cells[6].Value =
- this.FormatUrlForList(ConstValues.Instance.Inspectionnosuccesscount, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["Inspectionnosuccesscount"]));//巡查未达标扣分
- UltraWebGrid1.Rows[i].Cells[7].Value =
- this.FormatUrlForList(ConstValues.Instance.UrlCaseFrom, curdept, this.dstart, this.dend, Convert.ToInt32(GridSource.Rows[i]["casefromcount"]));//公众投诉案件扣分
- UltraWebGrid1.Rows[i].Cells[8].Value = GridSource.Rows[i]["smallsum"];//总分
- UltraWebGrid1.Rows[i].Cells[9].Value = GridSource.Rows[i]["smallsumlist"];//排名
- }
- UltraWebGrid1.Bands.Add(new UltraGridBand());
- for (int i = 0; i < UltraWebGrid1.Rows.Count; i++)
- {
- UltraWebGrid1.Rows[i].ShowExpand = true;
- }
- }
- /// <summary>
- /// 格式化化url链接
- /// </summary>
- /// <param name="url">待格式化的url</param>
- /// <param name="dept"></param>
- /// <param name="ds"></param>
- /// <param name="de"></param>
- /// <param name="urlText">显示的文本内容</param>
- /// <returns></returns>
- private string FormatUrlForList(string url,Guid curDept,DateTime ds,DateTime de,int urlText)
- {
- if (urlText == 0)
- {
- // return urlText.ToString();
- }
- url = string.Format(url, curDept, ds.ToString("yyyy/MM/dd"), de.ToString("yyyy/MM/dd"), urlText);
- return url;
- }
end
外话:
在utraWebGrid中的事件 InitializeRow,InitializeLayout,Initialize...的事件都是在this.UltraWebGrid1..DataBind()时候执行的
我们上面是用for给UltraWebGrid填充进去的.
是不触发事件的
请记住.这一点让我找了很久.
谢谢大家观看.希望能给大家一点帮助.