<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循环体是根据日期是否大于当前日期,否则不允许编辑