Posted by : ஆனந்த் சதாசிவம் Saturday, May 25, 2013

WCF Function  in  ".aspx"  File:


<body>
    <form id="form1" runat="server">


************************************************************************

    <asp:ScriptManager ScriptMode="Release" LoadScriptsBeforeUI="false" ID="sct" runat="server">
        <Services>
            <asp:ServiceReference Path="~/wcfServices/Service1.svc" />
        </Services>
    </asp:ScriptManager>

****************************************************************

  <script language="javascript" type="text/javascript">
    
    function changestatus(val)
    {
  
   Service1.change_status(val, OnSuccess, OnFailed, "");
   return false;
    }
     function OnSuccess(res) {
        if (res != "") {

            
        }
        else {
        }
    }
    function OnFailed(res) {
    }

    
    </script>


**************************************************************
WCF File:
 service1:


<ServiceContract(Namespace:="")> _
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
Public Class Service1

    ' Add <WebGet()> attribute to use HTTP GET 
    <OperationContract()> _
    Public Sub DoWork()
        ' Add your operation implementation here
    End Sub



    <OperationContract()> _
   Public Function change_status(ByVal mid As String) As String
        Dim approveqry As String

        approveqry = "Update mailbox set status=0 where mailid=" & mid

        DBManager.ExecuteNonQuery(approveqry)
        Return "read"

    End Function



**********************************************************



Call The Function:

server side:


  Mail &= " <h3 onclick=" & "'return changestatus(" & dts.Rows(i)("mailid") & ")'" & ">" & dts.Rows(i)("subject") & "  <table align='right'><tr><td align='right'> " & dts.Rows(i)("activity") & "</td> </tr></table></h3>"
                Mail &= "<div><p>" & dts.Rows(i)("mailcontent") & " </p></div>"




Leave a Reply

Subscribe to Posts | Subscribe to Comments

Popular Post

Blogger templates

Labels

Search Box

Follow us on Facebook

- Copyright © .net -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -