第三方控件netadvantage UltraWebGrid总结

1.个人习惯前台绑定好实体字段,禁止自动生成;一些属性设置:AutoGenerateColumns="false"

 

 <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" Style="left: 0px; top: 0px;

                            height: 100%;" Width="100%" OnPageIndexChanged="UltraWebGrid1_PageIndexChanged"

                            OnInitializeLayout="UltraWebGrid1_InitializeLayout">

                            <DisplayLayout AutoGenerateColumns="false" ViewType="Hierarchical" AllowColSizingDefault="Free"

                                AllowDeleteDefault="Yes" HeaderClickActionDefault="SortMulti" Name="ctl02xUltraWebGrid1"

                                RowHeightDefault="20px" SelectTypeRowDefault="Extended" StationaryMargins="Header"

                                StationaryMarginsOutlookGroupBy="True" TableLayout="Fixed" Version="4.00" SelectTypeCellDefault="Single">

                                <HeaderStyleDefault HorizontalAlign="Center" TextOverflow="Ellipsis" VerticalAlign="Middle"

                                    BackColor="#BBEAF9" BorderStyle="Solid">

                                    <BorderDetails ColorLeft="#BBEAF9" ColorTop="#BBEAF9" WidthLeft="1px" WidthTop="1px">

                                    </BorderDetails>

                                </HeaderStyleDefault>

                                <RowStyleDefault TextOverflow="Ellipsis" BackColor="Window" BorderColor="Silver"

                                    BorderWidth="1px" BorderStyle="Solid" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt">

                                    <Padding Left="3px"></Padding>

                                    <BorderDetails ColorLeft="Window" ColorTop="Window"></BorderDetails>

                                </RowStyleDefault>

                            </DisplayLayout>

 

------案例

 

 <igtbl:UltraGridColumn BaseColumnName="Id" HeaderText="Id" Key="Id" Hidden="true">

 </igtbl:UltraGridColumn>

 

如果实体嵌套实体就是包含关联实体的话不能像上面这样绑定了需要最原始的那种绑定:

 

 <igtbl:TemplatedColumn>

                                            <Header>

                                                <RowLayoutColumnInfo OriginX="1" OriginY="0" SpanY="4" />

                                            </Header>

                                            <HeaderTemplate>

                                                工程名称

                                            </HeaderTemplate>

                                            <CellTemplate>

                                                <%# DataBinder.Eval(Container.DataItem, "OutConId.PName")%>

                                            </CellTemplate>

   </igtbl:TemplatedColumn>

 

------------------设置跳转和下载模板列

 

    <CellTemplate>

                                <a href='<%# TranPath(DataBinder.Eval(Container.DataItem,"EleFile")) %>'>

                                    <%# TranName(DataBinder.Eval(Container.DataItem,"EleFile")) %></a>

    </CellTemplate>

 

-------------------修改需要绑定asp.net控件的话:通过这种方式获取设置值;

 

    Infragistics.WebUI.UltraWebGrid.TemplatedColumn tcum3 = (Infragistics.WebUI.UltraWebGrid.TemplatedColumn)this.UltraWebGrid1.Rows[i].Cells[5].Column;

                    Infragistics.WebUI.UltraWebGrid.CellItem citcum3 = (Infragistics.WebUI.UltraWebGrid.CellItem)tcum3.CellItems[i];

                    TextBox boxZRRQ3 = citcum3.FindControl("txtRestDateQ") as TextBox;

                    pbc.RestDateQ = boxZRRQ3.Text.Trim();

 

 

--------------------前台的一些js方法:

 

--------全选::::

  function SelectAll(colIndex)

    {

    var u2=document.getElementById("cbSelectAll");

    var checked=u2.checked;

    for (i = 0; i < oGrid.Rows.length; i++)

    {

       oGrid.Rows.getRow(i).getCell(colIndex).setValue(checked);

    }

    }

---------------函数:

  function validDJType()

    {

      var grid=igtbl_getGridById("UltraWebGrid2");

      var row=grid.getActiveRow();

      if(row==null)

      {

       alert("请选择要编辑的单据!");

       return false;

      }else

      {

            if(row.Band.Index!=0)

      {

       alert("请选择主数据行!");

        return false;

      }

      var washId= row.getCell(2).getValue();

       if(washId!=null&&washId!=0)

            {

             alert("冲账单不能编辑!");

             return false;

            }

             var ydrkdjxtbh= row.getCell(10).getValue();

       if(ydrkdjxtbh!=null&&ydrkdjxtbh!=0)

            {

             alert("预点完成的入库单不能编辑!");

             return false;

            }

      }

      return true;

    }

-----------------------------

  function validateDel()

    {

     var grid=igtbl_getGridById("UltraWebGrid2");

     var row=grid.getActiveRow();

     if(row!=null)

     {

           if(row.Band.Index!=0)

      {

       alert("请选择主数据行!");

        return false;

      }

         var ydrkdjxtbh= row.getCell(10).getValue();

       if(ydrkdjxtbh!=null&&ydrkdjxtbh!=0)

            {

             alert("预点完成的入库单不能删除!");

             return false;

            }else

            {

               if(confirm('确定删除?'))

               {

                 return true;

               }else

               {

                return false;

               }

           }

     }else

     {

       alert("请选择要删除的数据!");

       return false;

     }

    } 

---------------

    function goPage(event)

        {

             igtbl_pageGrid(event,'UltraWebGrid2',document.getElementById("PageNum").value);

        }    

----

 

-------------选择数据行案例:

 //选择id项;

    protected int GetRowsId()

    {

        if (UltraWebGrid1.DisplayLayout.SelectedCells[0] != null)

        {

            if (UltraWebGrid1.DisplayLayout.SelectedCells[0].Row != null)

            {

                return Convert.ToInt32(UltraWebGrid1.DisplayLayout.SelectedCells[0].Row.Cells[0].Text);

            }

            else

            {

                Messabox.ShowError(this, "请选择要操作的列");

            }

        }

        else

        {

            if (this.UltraWebGrid1.DisplayLayout.SelectedRows[0] != null)

            {

                return Convert.ToInt32(this.UltraWebGrid1.DisplayLayout.SelectedRows[0].Cells[0].Text.Trim());

            }

            else

            {

                Messabox.ShowError(this, "请选择要操作的列");

            }

        }

        return 0;

    }

你可能感兴趣的:(grid)