ultrawebgrid使用方法

Infragistics系列控件是一套很好,很强大的控件,前些日子公司买的正版的asp.net版本的..好像800多美元一套...最新版本的7.3....感觉很好..现在自己做项目也用..却发现网上没有一套中文的教程,中文资料都很少..在这里就把自己的研究心得写下来...
首先安装,一步一步装就可以了..完成之后,有几点说明的
1.安装完之后开始-程序的菜单里有Create Visual Studio Toolbox Tab.要执行一下.在vs的工具箱里生成infragistics的标签..不然连控件都找不到哦...菜单里还有一个sample...能实现的效果大部分都在里面了...根据你自己的需求,可以在里面找....菜单里还有个document..里面有各个控件的'指南','例子'.还有api和客户端脚本api...
2.安装程序会在C:/Inetpub/wwwroot/aspnet_client/infragistics下生成一个包含运行时资源文件夹(包括图片,css等文件)..所以这个文件夹比较重要(在你没有appstle的情况下)...后面会说
3.然后在安装目录下有dll文件的打包.我这里是C:/Program Files/Infragistics/NetAdvantage for .NET 2007 Vol. 3 CLR 2.0/ASP.NET/Bin - Signed这个文件夹.网站发布时.要把这个rar文件解压到bin文件夹下.不然没有dll文件怎么执行啊..
4.还附送了一个appstylelist的小软件,可以设置空间外观,有了这个就不用去学习,设置那些复杂的外观属性了.非常方便..而且用了这个,2里提到的那个文件夹几乎就没用了...
5.在你第一次拖动一个控件到页面时..会在你得根目录下生成一个licenses.licx文件..不要删了哦..
6.可以在虚拟主机下运行,看到网上有得文章说还要手动iis虚拟路径之类的..不需要..只要把相关文件(图片和dll)考到项目里的相关附录就可以了..
前言部分就这么多了..之后会说说控件..每种控件的功能,用法,代码控制的方法..

转于http://blog.csdn.net/jingshuaizh/archive/2008/07/22/2689440.aspx

 

 

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
 
 
 
Infragistics NetAdvantage UltraWebGrid使用之一
 

在一个UltraWebGrid的第一个column(Template Column)放了一個Checkbox ,检查整个UltraWebGrid中的勾取情況,然后执行相关的操作。

foreach(datarow row in grid.rows)
{
checkbox c = (checkbox)row.columns[0].findcontrol("checkbox");
if(c.checked)
{
//do shomething by row data
}
}

//取得全部的TemplateColumn,她把第一个列(column)数据都放在一个列表中
UltraWebGrid.TemplatedColumn tcol = (WebUI.UltraWebGrid.TemplatedColumn)UltraWebGrid1.Bands[0].Columns[0];
//取得每一個column的Cell內容
foreach (Infragistics.WebUI.UltraWebGrid.CellItem item in tcol.CellItems)
{
CheckBox chkIsHaveRight = (CheckBox)item.FindControl("chkIsSendEmail");
if (chkIsHaveRight.Checked == true)
{
//通過訪問父對象取得其他資料
//item->cell->row->cell[4]->內容;在這過程中cell是item的父對象,row是cell的父對象,再訪問row下面的每4個Cell,再取得該Cell的內容。
string info = item.Cell.Row.Cells[4].Text;
}
}

 

1. UltraWebGrid添加模板列:
      先选择UltraWebGrid --属性--columns--勾选Templated column 即可
      
       <igtbl:TemplatedColumn AllowResize="Free" BaseColumnName="BT" ChangeLinksColor="True"
                            HeaderText="标题" Key="BT" Type="HyperLink">
                            <CellTemplate>
                                <asp:LinkButton ID="LinkButton1" CssClass="WordBreak" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"AQJYGXID") %>' Text='<%# DataBinder.Eval(Container.DataItem,"BT") %>' ToolTip='<%# DataBinder.Eval(Container.DataItem,"BT") %>' CommandName="showdetail" runat="server" Font-Underline="false"></asp:LinkButton>
                            </CellTemplate>
                            <Header Caption="标题">
                                <RowLayoutColumnInfo OriginX="2" />
                            </Header>
                            <Footer>
                                <RowLayoutColumnInfo OriginX="2" />
                            </Footer>
                        </igtbl:TemplatedColumn>


2. UltraWebGrid日期列:
      设置日期列的 Format属性:yyyy-MM-dd(Date)
      DataType属性为System.DateTime


3。取某行的某列(列名:BIDPRICE)的值:  
UltraWebGrid1.Rows[i].Cells.FromKey("BIDPRICE").Value或者UltraWebGrid1.Rows[i].Cells[j].Value  
取某列:UltraWebGrid1.Columns.FromKey("BIDPRICE").Value


4。标题行居中显示:
      <HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid" HorizontalAlign="Center">
                 </HeaderStyleDefault>
   
对应项居中    <CellStyle HorizontalAlign="Center"></CellStyle>

5.UltraWebGrid的固定列功能
    具体步骤:
        (1) 在UltraWebGrid下的DisplayLayout中把TableLayout属性设为:Fixed ; UseFixedHeaders设为:True //这是指定Grid允许固定列
StationaryMargins="Header" //这使Header始终在最上面显示
(2) 设定列固定: Header下面的Fixed设置为true。这样就可以实现ID固定了,但效果图中还有一个功能就是,点击后面的任何一个列后的“图钉”图标,就可以任意进行多列固定了。如下图为我点击了“ContactName”的效果:这种功能的实现,只要修改一个属性:FixedHeaderIndicatorDefault="Button"就可以了。

6。UltraWebGrid 最下面线显示问题:
       选择UltraWebGrid点击》选择Bands And Columns的DefaultrowHeight设置高度 即可。


7.   选择一行以后获得选定行指定列的值
if (e.InnerCommandEventArgs.CommandName == "showdetail")
        {
            int id = Con

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值