Friday, April 27, 2012

Set Session using Jquery and Webservice


 <asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release">
            <Services>
                <asp:ServiceReference Path="~/DropdownWebService.asmx" />
            </Services>
        </asp:ScriptManager>



  <script type="text/javascript">
                function fungetFacilityId() {
                    var hdnFacilityID = document.getElementById('<%=ddFacility.ClientID %>').value;
                    $('#<%=hdnFacilityID.ClientID %>').val(hdnFacilityID);
                    HorvatCOS.DropdownWebService.get_lanefacilityId(hdnFacilityID);

                }           
 
            </script>





Imports System.Collections
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data.SqlClient
Imports System.Collections.Generic
Imports System.Collections.Specialized
Imports AjaxControlToolkit
Imports System.Configuration
Imports System.Data

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<System.Web.Script.Services.ScriptService()> _
Public Class DropdownWebService
    Inherits System.Web.Services.WebService
 
 
    <WebMethod(EnableSession:=True)> _
    Public Function get_lanefacilityId(ByVal lanefacilityId As String)
        Session("lanefacilityId") = lanefacilityId
        Return lanefacilityId
    End Function
 

End Class








No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...