寫一個根據某列數值改變GridView中某行顏色的程式
阿新 • • 發佈:2018-12-22
<table style="height: 16px; width: 564px;" cellpadding =0 cellspacing>
<tr><td>
未預訂:草綠色 已預訂:黃色 已燒錄:蘭色 已審批:紅色 已回覆:黑色</td></tr>
<tr>
<td style="height: 250px;text-align: left; width:564px; "><asp:GridView ID="GvSubscribe" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource2" Width="580px" Height="1px" OnRowDataBound="GvSubscribe_RowDataBound">
<Columns>
<asp:BoundField DataField="PriId" HeaderText="優先順序" SortExpression="PriId"/>
<asp:BoundField DataField="WorkId" HeaderText="施工人員工號" SortExpression="WorkId"/>
<asp:BoundField DataField="SubscriptionTitle" HeaderText="預訂單標題" SortExpression ="SubscriptionTitle"/>
<asp:BoundField DataField="SubscriptionOrderContent" HeaderText="預約訂單內容" SortExpression="SubscriptionOrderContent"/>
<asp:BoundField DataField="WorkMaincontentId" HeaderText="施工工作事由Id號" SortExpression="WorkMaincontentId"/>
<asp:BoundField DataField="FlowId" HeaderText="流程號" SortExpression="FlowId"/>
<asp:BoundField DataField="AddDate" HeaderText="增加時間日期" SortExpression="AddDate"/>
<asp:BoundField DataField="DepartmentId" HeaderText="部門號" SortExpression="DepartmentId"/>
<asp:CommandField ShowEditButton="True"/>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:OnlineSuscribeSystemConnectionString3 %>"
SelectCommand="SELECT [SubscriptionTitle], [PriId], [WorkId], [SubscriptionOrderContent], [WorkMaincontentId], [FlowId], [AddDate], [DepartmentId] FROM [SubscriptionOrder]" DataSourceMode="DataSet">
</asp:SqlDataSource>
</td></tr>
</table>
<tr><td>
未預訂:草綠色 已預訂:黃色 已燒錄:蘭色 已審批:紅色 已回覆:黑色</td></tr>
<tr>
<td style="height: 250px;text-align: left; width:564px;
AutoGenerateColumns="False" DataSourceID="SqlDataSource2" Width="580px" Height="1px" OnRowDataBound="GvSubscribe_RowDataBound">
<Columns>
<asp:BoundField DataField="WorkId" HeaderText="施工人員工號" SortExpression="WorkId"/>
<asp:BoundField DataField="SubscriptionTitle" HeaderText="預訂單標題" SortExpression
<asp:BoundField DataField="SubscriptionOrderContent" HeaderText="預約訂單內容" SortExpression="SubscriptionOrderContent"/>
<asp:BoundField DataField="WorkMaincontentId" HeaderText="施工工作事由Id號" SortExpression="WorkMaincontentId"/>
<asp:BoundField DataField="FlowId" HeaderText="流程號" SortExpression="FlowId"/>
<asp:BoundField DataField="AddDate" HeaderText="增加時間日期" SortExpression="AddDate"/>
<asp:BoundField DataField="DepartmentId" HeaderText="部門號" SortExpression="DepartmentId"/>
<asp:CommandField ShowEditButton="True"/>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:OnlineSuscribeSystemConnectionString3 %>"
SelectCommand="SELECT [SubscriptionTitle], [PriId], [WorkId], [SubscriptionOrderContent], [WorkMaincontentId], [FlowId], [AddDate], [DepartmentId] FROM [SubscriptionOrder]" DataSourceMode="DataSet">
</asp:SqlDataSource>
</td></tr>
</table>