Infragistics ASP.NET控件用法总结
一、UltraWebGrid的基本用法
1、 如何手工增加列
第一步:将ControlSetting->DisplayOut->AutoGenerate置为False:表示不让控件自动添加列;
第二步:添加自己需要的列:BaseColumnName即你要梆定的字段名; Key:指定该列的别人,方便以后寻找该列的值; Header->Caption: 表头文字
2、 冻结某列
this.UltraWebGrid1.DisplayLayout.UseFixedHeaders = true;
this.UltraWebGrid1.Bands[0].Columns.FromKey("Edit").Header.Fixed = true;
3、 向表格中添加其它控件
ControlSetting->Columns->选中你要操作的列->EditorControlID->选择你要梆定的控件名
4、 表格中添加一列Button按钮
ControlSettings->Columns->选中要修改为安按钮的行->Type->Button
5、 合并单元格
Control Settings->Columns->
列名->Header->RowLayoutColumnInfo;
SpanX:
跨几列 OriginX:哪一列开始
//增加一个带图片的表头
foreach(Infragistics.WebUI.UltraWebGrid.UltraGridColumn c in e.Layout.Bands[0].Columns)
{
c.Header.RowLayoutColumnInfo.OriginY = 1;
}
// 添加一个大的表头
Infragistics.WebUI.UltraWebGridColumnHeader ch = new Infragistics.WebUI.UltraWeb
GridColumnHeader(true);
ch.Caption = “大表头的名字”
ch.RowLayoutColumnInfo.OriginY = 0; //设置添加表头的Y轴位置
ch.RowLayoutColumnInfo.SpanX = 3;
//设置要跨的列数
ch.Image.Url ="./images/bankingbtn.gif"; //添加图片
ch.Image.AlternateText = "Employee Name Grouping";
e.Layout.Bands[0].HeaderLayout.Add(ch); //将上面的设置添加到该表中
6、 添加一数字控件,并设置为可点击累加数字
第一步:将控件WebNumericEdit->SpinButtons->Display设置为:OnRight
第二步:将UltraWebGrid中要梆定该控件的那一列的Type设置为:Custom
* 设置某列只读; Allupdate = no
7、 隐藏表头顶端的那一行
DisplayLayout->GroupByBox->Hidden = true
8、 固定Header那一行
this
.UltraWebGrid1.DisplayLayout.StationaryMargins = Infragistics.WebUI.UltraWebGrid. StationaryMargins.Header;
9、 指定列头中字体的显示位置
Control Settings->Band[0]->HeaderStyle->HorizontalAlign = Center
10、指定表格中字体的显示位置
Control Settings->Band[0]->RowStyle->HorizontalAlign = Center
//全部
Control Settings->Columns->列名->CellStyle->HorizontalAlign = Center //设订某一列
11、整张表不允许编辑
Control Settings->Band[0]->AllUpdate = no
12、选择一行
Control Settings->Band[0]->CellClickAction = RowSelect
13、增加一行
UltraWebGrid.DisplayLayout.Row.Add();
14、确认对话框事件
指定客户端事件:UltraWebGrid1->DisplayLayout->ClientSizeEvents-> ClickCellButtonHandler:CellButtonClick
函数的定义:
function CellButtonClick(gridName, cellId)
{
if (cellId.substring(cellId.lastIndexOf("_") + 1, cellId.lastIndexOf("_") + 3) == "8")
{
return !confirm("确信要删除此行数据吗?");
}
}
15、分页处理
UltraWebGrid1->DisplayOut->Pager->AllowPaging=True,然后是PageSize等设置。
Pattern设置:这个模板就是用来自定义显示效果的
<table width=100%><tr> [page:1:首页] 第[currentpageindex]页 共[pagecount]页 [prev] [next]</td><td align=right> [default]<td></tr></table>
二、WebCombo的基本用法
1、 实现可输可选的下拉表格
Editable->True
2、 将下拉表格加载到UltraWebGrid中去
UltraWebGrid1.Columns[1].Type = ColumnType.DropDownList;
UltraWebGrid1.Columns[1].ValueList.WebCombo = WebComboGood;