gridview 用法

<cc1:TigerDataGrid ID="TigerDataGrid1" 
        runat="server" 
        AllowPaging="True" 
        AutoGenerateColumns="False" 
        BodyHeight="400"  
        EnableModelValidation="True" 
        HeaderForeColor="White" 
        HightColor="#CAD3E4" 
        IsHighLight="True" 
        IsHighLightSortColumn="True" 
        ItemShowLength="0" 
        Overflow="scroll" 
        PopUpMenuId="" 
        SortColor="yellow" 
        SortColumnColor="#F5F5F6" 
        SortIndex="ASC" 
        UnVisableOverLength="False" 
        WithPopUpMenu="False" 
        HeaderCss="GridColumnHeading"
        ItemCss="GridItem" onpageindexchanging="TigerDataGrid1_PageIndexChanging" 
        OnRowCommand="TigerDataGrid1_RowCommand"
            PageSize="50" >
        <RowStyle Font-Size="13px" Height=50px BackColor=White></RowStyle>
        <PagerStyle HorizontalAlign="Left" Font-Size="13px"></PagerStyle>   
        <HeaderStyle Font-Size="13px" Font-Bold="True" ForeColor="White" Wrap="False" HorizontalAlign="Center">
    </HeaderStyle>
        <Columns>
            <asp:BoundField DataField="tsshop" HeaderText="店铺" 
                SortExpression="tsshop">
                <headerstyle width="120px" horizontalalign="Center" cssclass="GridColumnHeading" />
                    <itemstyle width="120px" horizontalalign="Center" VerticalAlign=Middle />
                </asp:BoundField>
            <asp:BoundField DataField="tstxdt" HeaderText="日期" DataFormatString="{0:yyyy-M-dd}"
                SortExpression="tstxdt" >
                <headerstyle width="100px" horizontalalign="Center" cssclass="GridColumnHeading" />
                    <itemstyle width="100px" horizontalalign="Center" VerticalAlign=Middle />
                </asp:BoundField>
            <asp:BoundField DataField="tsbran" HeaderText="brand" 
                SortExpression="tsbran" >
                <headerstyle width="100px" horizontalalign="Center" cssclass="GridColumnHeading" />
                    <itemstyle width="100px" horizontalalign="Center" VerticalAlign=Middle />
                </asp:BoundField>
            <asp:BoundField DataField="tsptyp" HeaderText="类型" 
                SortExpression="tsptyp">
                <headerstyle width="80px" horizontalalign="Center" cssclass="GridColumnHeading" />
                    <itemstyle width="80px" horizontalalign="Center" VerticalAlign=Middle />
                </asp:BoundField>
            <asp:BoundField DataField="tscomm" HeaderText="扣点" 
                SortExpression="tscomm" >
                <headerstyle width="100px" horizontalalign="Center" cssclass="GridColumnHeading" />
                    <itemstyle width="100px" horizontalalign="Center" VerticalAlign=Middle />
                </asp:BoundField>
                <asp:TemplateField HeaderText="编辑">
                    <headerstyle width="60px" horizontalalign="Center" cssclass="GridColumnHeading" />
                    <itemstyle width="60px" horizontalalign="Center" VerticalAlign=Middle />
                    <ItemTemplate>
                        <asp:ImageButton ID="edit" ImageUrl="~/images/editImage.gif" runat="server" CommandName="modify"
                            visible="true" />
                    </ItemTemplate>
                </asp:TemplateField>
        </Columns>
    </cc1:TigerDataGrid>


 

tigerDataGrid 其实就是从gridview 继承过来的,同gridview用法相同

 

private void BindData()
    {
        string sDate = calDate.FromDate.ToString();
        string eDate = calDate.ToDate.ToString();
        string type = ddl.SelectedValue;
        string region = dtv.SelectedRegion;
        string bran = _drpBrand.SelectedValue;

        TigerDataGrid1.DataSource = MyController.getKickBack(sDate, eDate, type, region, bran);
        TigerDataGrid1.DataBind();

        for(int i=0;i<TigerDataGrid1.Rows.Count;i++)
        {
            if (DateTime.Parse(TigerDataGrid1.Rows[i].Cells[1].Text).CompareTo(DateTime.Now)<0)
            {

                TigerDataGrid1.Rows[i].FindControl("edit").Visible = false;
                TigerDataGrid1.Rows[i].Cells[5].Enabled = false;
            }
                
        }
            

        
        
    }


数据绑定函数, myController.getKickBack() 函数返回dataTable

for循环体是根据日期是否大于当前日期,否则不允许编辑

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值