Monday, 19 May 2014

Serversite function in ClientSite

 <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

3 comments:

  1. Good article.. thanks Sujoy Santra.. It helped me lot...

    ReplyDelete
  2. public System.Drawing.Color GetMenuColor(string act, string chk)
    {
    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;
    }

    ReplyDelete