<asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"
ItemStyle-Width="10%">
<ItemTemplate>
<asp:Label ID="lblDR_Action" runat="server" Text=' <%# GetLabelTextHistory(Eval("DR_Action"))%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Public Function GetLabelTextHistory(dataItem As Object) As String
Dim text As String = ""
Dim val As String = TryCast(dataItem, String)
Select Case val
Case "A"
text = "Accept"
Exit Select
Case "R"
text = "Reject"
Exit Select
Case "P"
text = "Partly Accept"
Exit Select
Case "N"
text = "Pending"
Exit Select
'Case Else
' text = "Pending"
' Exit Select
End Select
Return text
End Function
ItemStyle-Width="10%">
<ItemTemplate>
<asp:Label ID="lblDR_Action" runat="server" Text=' <%# GetLabelTextHistory(Eval("DR_Action"))%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Public Function GetLabelTextHistory(dataItem As Object) As String
Dim text As String = ""
Dim val As String = TryCast(dataItem, String)
Select Case val
Case "A"
text = "Accept"
Exit Select
Case "R"
text = "Reject"
Exit Select
Case "P"
text = "Partly Accept"
Exit Select
Case "N"
text = "Pending"
Exit Select
'Case Else
' text = "Pending"
' Exit Select
End Select
Return text
End Function
Good article.. thanks Sujoy Santra.. It helped me lot...
ReplyDeletepublic System.Drawing.Color GetMenuColor(string act, string chk)
ReplyDelete{
System.Drawing.Color functionReturnValue = default(System.Drawing.Color);
if ((chk == "Y")) {
if ((act == "Y")) {
functionReturnValue = System.Drawing.Color.Red;
}
} else {
}
if ((act == "Y")) {
functionReturnValue = System.Drawing.Color.Red;
} else {
functionReturnValue = System.Drawing.Color.Green;
}
return functionReturnValue;
}
Change Color Runtime
ReplyDelete