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








VB.NET function for Stored Procedures


 Public Shared Function proc(ByVal prcname As String, ByVal prcnames() As String, ByVal prcvalues() As String) As String
        Dim id As String = ""
        Dim cmd As New SqlCommand
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = prcname

        Dim i As Integer = 0
        For i = 0 To prcnames.Length - 1
            cmd.Parameters.AddWithValue(prcnames(i).ToString(), prcvalues(i).ToString())
            cmd.Parameters(prcnames(0)).Direction = ParameterDirection.InputOutput
        Next
        DataConnect.GetInstance.ExecuteNonQuery(cmd)
        id = cmd.Parameters(prcnames(0)).Value
        Return id
    End Function

VB.NET method for dropdownlist binding


 Public Shared Sub combofill(ByVal cmm As SqlCommand, ByVal dropdown As DropDownList, ByVal valuefield As String, ByVal textfield As String)
        dropdown.Items.Clear()
        Dim dt As DataTable
        dt = DataConnect.GetInstance.GetDt(cmm)
        dt.TableName = "dt"
        Dim dr As DataRow
        dr = dt.NewRow()
        dr(valuefield) = 0
        dr(textfield) = "Select"
        dt.Rows.Add(dr)
        dt.AcceptChanges()

        Dim dw As New DataView
        dw = New DataView
        dw.Table = dt
        dw.Sort = valuefield & " asc"

        dropdown.DataSource = dw
        dropdown.DataTextField = textfield
        dropdown.DataValueField = valuefield
        dropdown.DataBind()

        dropdown.SelectedValue = 0
        dropdown.DataSource = dw
        dropdown.DataTextField = textfield
        dropdown.DataValueField = valuefield
        dropdown.DataBind()
        dropdown.SelectedValue = 0
    End Sub

Dynamic Controls in VB.NET



Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
       
                If Not Page.IsPostBack Then
   If hdnFacilityID.Value <> "" Then
                   LoadLaneAssigmnentDoors(Convert.ToInt64(hdnFacilityID.Value))
    End If
                End If
         

                End If

        Catch ex As Exception
            pnlGlobalMessage.Visible = True
            lblGlobalMessage.Text = "A technical issue has occurred.  A message has been sent to the development team.  Sorry for the inconvenience."
            lblGlobalMessage.Visible = True
            Dim dt As DataTable = Session("user_session")
            Worker.HandleError(ex, "Lane Assignment", Int64.Parse(dt.Rows(0)("user_id")), Request.Browser.Browser.ToString())
        End Try
    End Sub




Public Sub LoadLaneAssigmnentDoors(ByVal facility_ID As Int64)
        If facility_ID <> 0 Then
            hdnfacilitylineid.Value = ""
            Dim dt As New DataTable
            Dim cmd As New SqlCommand
            cmd.CommandType = CommandType.Text
            cmd.CommandText = "select * from facility_lane where facility_ID=" & facility_ID
            dt = DataConnect.GetInstance.GetDt(cmd)
            Dim tcl As New TableCell()
            Dim trl As New TableRow()
            Dim tbmain As New Table()
            Dim trmain As New TableRow()
            Dim trmain1 As New TableRow
            Dim tb As New Table()
            tb.BorderColor = Drawing.Color.SkyBlue
            tb.BorderWidth = 1
            Dim i As Int64 = 0
            Dim j As Int64 = 0
            If dt.Rows.Count <> 0 Then
                For i = 1 To dt.Rows.Count
                    If j = 10 Then
                        j = 5
                    End If
                    j = j + 1
                    Dim tr As New TableRow()
                    Dim tr1 As New TableRow()
                    Dim tr2 As New TableRow()
                    Dim tr3 As New TableRow()
                    Dim tr4 As New TableRow()
                    Dim tr5 As New TableRow()
                    Dim tr6 As New TableRow()
                    Dim tr7 As New TableRow()

                    If hdnfacilitylineid.Value = "" Then
                        hdnfacilitylineid.Value = i & "," & dt.Rows(i - 1)("facility_lane_ID") & "|"
                    Else
                        hdnfacilitylineid.Value = hdnfacilitylineid.Value & i & "," & dt.Rows(i - 1)("facility_lane_ID") & "|"
                    End If


                    Dim lbldoor As New Label()
                    lbldoor.Text = "Door #:"
                    Dim tc As New TableCell()
                    tc.Controls.Add(lbldoor)

                    Dim lbldoor1 As New Label()
                    lbldoor1.ID = "lbldoor1" & i.ToString()
                    lbldoor1.Text = dt.Rows(i - 1)("door_no")
                    lbldoor1.Width = 125
                    Dim tc1 As New TableCell()
                    tc1.Controls.Add(lbldoor1)

                    Dim lbldoorname As New Label()
                    lbldoorname.Text = "Name:"
                    Dim tc15 As New TableCell()
                    tc15.Controls.Add(lbldoorname)

                    Dim lbldoorname1 As New Label()
                    lbldoorname1.ID = "lbldoorname1" & i.ToString()
                    lbldoorname1.Width = 125
                    lbldoorname1.Text = dt.Rows(i - 1)("door_name")
                    Dim tc16 As New TableCell()
                    tc16.Controls.Add(lbldoorname1)

                    Dim lbldirection As New Label()
                    lbldirection.Text = "Direction:"
                    Dim tc2 As New TableCell()
                    tc2.Controls.Add(lbldirection)

                    Dim rdArriving As New RadioButton()
                    rdArriving.Text = "In"
                    rdArriving.ID = "rdArriving" & i.ToString()
                    rdArriving.GroupName = "rd"
                    Dim rdDeparting As New RadioButton()
                    rdDeparting.Text = "Out"
                    rdDeparting.ID = "rdDeparting" & i.ToString()
                    rdDeparting.GroupName = "rd"
                    Dim tc3 As New TableCell()
                    tc3.Controls.Add(rdArriving)
                    tc3.Controls.Add(rdDeparting)

                    Dim lblTrailer As New Label()
                    lblTrailer.Text = "Trailer:"
                    Dim tc4 As New TableCell()
                    tc4.Controls.Add(lblTrailer)

                    Dim txtTrailer As New TextBox()
                    txtTrailer.ID = "txtTrailer" & i.ToString()
                    txtTrailer.Width = 125
                    Dim tc5 As New TableCell()
                    tc5.Controls.Add(txtTrailer)

                    Dim lblCarrier As New Label()
                    lblCarrier.Text = "Carrier:"
                    Dim tc6 As New TableCell()
                    tc6.Controls.Add(lblCarrier)

                    Dim txtCarrier As New TextBox()
                    txtCarrier.ID = "txtCarrier" & i.ToString()
                    txtCarrier.Width = 125
                    Dim tc7 As New TableCell()
                    tc7.Controls.Add(txtCarrier)

                    Dim lblGoingto As New Label()
                    lblGoingto.Text = "Destination:"
                    Dim tc8 As New TableCell()
                    tc8.Controls.Add(lblGoingto)

                    Dim ddGoingto As New DropDownList()
                    ddGoingto.ID = "ddGoingto" & i.ToString()
                    ddGoingto.AutoPostBack = True
                    AddHandler ddGoingto.SelectedIndexChanged, AddressOf OnSelectIndexChanged
                    Dim lst As New ListItem()
                    Dim lst1 As New ListItem()
                    Dim lst2 As New ListItem()
                    lst.Text = "Select"
                    lst.Value = "0"
                    lst1.Text = "Supplier"
                    lst1.Value = "1"
                    lst2.Text = "Customer"
                    lst2.Value = "2"
                    ddGoingto.Items.Add(lst)
                    ddGoingto.Items.Add(lst1)
                    ddGoingto.Items.Add(lst2)
                    ddGoingto.Width = 130
                    Dim tc9 As New TableCell()
                    tc9.Controls.Add(ddGoingto)

                    Dim lblLocationsc As New Label()
                    lblLocationsc.ID = "lblLocationsc" & i.ToString()
                    lblLocationsc.Text = "Company"
                    Dim tc10 As New TableCell()
                    tc10.Controls.Add(lblLocationsc)



                    Dim ddSC As New DropDownList()
                    ddSC.ID = "ddSC" & i.ToString()
                    'ddSC.AutoPostBack = True
                    'AddHandler ddSC.SelectedIndexChanged, AddressOf OnSelectIndexChanged1
                    Dim lstt As New ListItem()
                    lstt.Text = "Select"
                    lstt.Value = "0"
                    ddSC.Items.Add(lstt)
                    ddSC.Width = 130
                    Dim tc11 As New TableCell()
                    tc11.Controls.Add(ddSC)


                    Dim btnsubmit As New Button()
                    btnsubmit.Text = "Submit"
                    btnsubmit.ID = "btnsubmit" & i.ToString()
                    AddHandler btnsubmit.Click, AddressOf btnsubmit_click
                    Dim tc12 As New TableCell()
                    tc12.Controls.Add(btnsubmit)



                    tr.Controls.Add(tc)
                    tr.Controls.Add(tc1)

                    tr7.Controls.Add(tc15)
                    tr7.Controls.Add(tc16)

                    tr1.Controls.Add(tc2)
                    tr1.Controls.Add(tc3)

                    tr2.Controls.Add(tc4)
                    tr2.Controls.Add(tc5)

                    tr3.Controls.Add(tc6)
                    tr3.Controls.Add(tc7)

                    tr4.Controls.Add(tc8)
                    tr4.Controls.Add(tc9)

                    tr5.Controls.Add(tc10)
                    tr5.Controls.Add(tc11)

                    Dim tc14 As New TableCell()
                    tr6.Controls.Add(tc14)
                    tr6.Controls.Add(tc12)

                    tb.Controls.Add(tr)
                    tb.Controls.Add(tr7)
                    tb.Controls.Add(tr1)
                    tb.Controls.Add(tr2)
                    tb.Controls.Add(tr3)
                    tb.Controls.Add(tr4)
                    tb.Controls.Add(tr5)
                    tb.Controls.Add(tr6)

                    Dim tcc As New TableCell()
                    tcc.Controls.Add(tb)
                    If j > 5 And j < 11 Then
                        If j = 11 Or j = 6 Then
                            trmain1 = New TableRow()
                        End If
                        trmain1.Controls.Add(tcc)
                        tbmain.Controls.Add(trmain1)
                    Else
                        trmain.Controls.Add(tcc)
                        tbmain.Controls.Add(trmain)
                    End If
                    tb = New Table()
                    tb.BorderColor = Drawing.Color.SkyBlue
                    tb.BorderWidth = 1
                    tcl.Controls.Add(tbmain)
                    trl.Cells.Add(tcl)
                    tbl.Rows.Add(trl)
                    tbl.EnableViewState = True
                    ViewState("tbl") = True
                Next

            End If
        End If
    End Sub






Private Sub OnSelectIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        Try
            Dim ddl As DropDownList = DirectCast(sender, DropDownList)
            Dim ID As String = ""
            ID = ddl.ID
            Dim cid As String = ""
            cid = ddl.ID.Replace("ddGoingto", "")
            Dim type As Int64 = 0
            type = ddl.SelectedValue

            Dim ddSC As New DropDownList()
            ddSC = CType(pnllane.FindControl("ddSC" & cid), DropDownList)
            If type = "1" Then
                Dim cmd As New SqlCommand
                cmd.CommandType = CommandType.Text
                cmd.CommandText = "select Supplier_id,Supplier_name from Supplier where client_id=" & Convert.ToInt64(Session("laneclientId"))
                Worker.combofill(cmd, ddSC, "Supplier_id", "Supplier_name")
            Else
                Dim cmd As New SqlCommand
                cmd.CommandType = CommandType.Text
                cmd.CommandText = "select customer_id,customer_name from customer where Client_id=" & Convert.ToInt64(Session("laneclientId"))
                Worker.combofill(cmd, ddSC, "customer_id", "customer_name")
            End If
            'End If
        Catch ex As Exception
            pnlGlobalMessage.Visible = True
            lblGlobalMessage.Text = "A technical issue has occurred.  A message has been sent to the development team.  Sorry for the inconvenience."
            lblGlobalMessage.Visible = True
            Dim dt As DataTable = Session("user_session")
            Worker.HandleError(ex, "Lane Assignment", Int64.Parse(dt.Rows(0)("user_id")), Request.Browser.Browser.ToString())
        End Try
    End Sub




Protected Overrides Function SaveViewState() As Object
        Dim newViewState As Object() = New Object(1) {}

        Dim txtValues As New List(Of String)()

        For Each row As TableRow In tbl.Controls
            For Each cell As TableCell In row.Controls
                For Each tb As Table In cell.Controls
                    For Each rw As TableRow In tb.Controls
                        For Each cl As TableCell In rw.Controls
                            For Each tbb As Table In cl.Controls
                                For Each rww As TableRow In tbb.Controls
                                    For Each cll As TableCell In rww.Controls
                                        If cll.Controls.Count <> 0 Then
                                            If TypeOf cll.Controls(0) Is DropDownList Then
                                                txtValues.Add(DirectCast(cll.Controls(0), DropDownList).SelectedIndex.ToString())
                                            End If
                                        End If
                                    Next
                                Next
                            Next
                        Next
                    Next
                Next
            Next
        Next

        newViewState(0) = txtValues.ToArray()
        newViewState(1) = MyBase.SaveViewState()
        Return newViewState
    End Function
    Protected Overrides Sub LoadViewState(ByVal savedState As Object)

        'if we can identify the custom view state as defined in the override for SaveViewState
        If TypeOf savedState Is Object() AndAlso DirectCast(savedState, Object()).Length = 2 AndAlso TypeOf DirectCast(savedState, Object())(0) Is String() Then
            Dim newViewState As Object() = DirectCast(savedState, Object())
            Dim txtValues As String() = DirectCast(newViewState(0), String())
            If txtValues.Length > 0 Then
                're-load tables
                If Session("lanefacilityId") IsNot Nothing Then
                    LoadLaneAssigmnentDoors(Convert.ToInt64(Session("lanefacilityId")))
                    Dim i As Integer = 0
                    For Each row As TableRow In tbl.Controls
                        For Each cell As TableCell In row.Controls
                            For Each tb As Table In cell.Controls
                                For Each rw As TableRow In tb.Controls
                                    For Each cl As TableCell In rw.Controls
                                        For Each tbb As Table In cl.Controls
                                            For Each rww As TableRow In tbb.Controls
                                                For Each cll As TableCell In rww.Controls
                                                    If cll.Controls.Count <> 0 Then
                                                        If TypeOf cll.Controls(0) Is DropDownList AndAlso i < txtValues.Length - 1 Then
                                                            DirectCast(cll.Controls(0), DropDownList).SelectedIndex = Convert.ToInt32(txtValues(System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)))
                                                        End If
                                                    End If
                                                Next
                                            Next
                                        Next
                                    Next
                                Next
                            Next
                        Next
                    Next
                End If

            End If
            'load the ViewState normally
            MyBase.LoadViewState(newViewState(1))
        Else
            MyBase.LoadViewState(savedState)
        End If
    End Sub


Image Upload and Display in VB.NET


<ajaxToolkit:AsyncFileUpload ID="pfepimage" Width="205px" runat="server" UploaderStyle="Modern"
                                                                    ThrobberID="pfeploader" OnClientUploadStarted="uploadStarted1" />
                                                                <asp:Image ID="pfeploader" runat="server" ImageUrl="~/Images/al_loading.gif" Height="15"
                                                                    Width="15" />
                                                                <asp:UpdatePanel ID="UpdImgDisplay" runat="server">
                                                                    <ContentTemplate>
                                                                        <asp:Image runat="server" AlternateText="No Image" ID="imgFirst" Height="50" Width="50" />
                                                                    </ContentTemplate>
                                                                </asp:UpdatePanel>
                                                                <asp:Label runat="server" ID="lblImageError" Text="*" ForeColor="Red" Visible="false"></asp:Label>



  <script type="text/javascript">
            function uploadStarted1() {
            }
 
        </script>






Private Sub pfepimage_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles pfepimage.UploadedComplete

        Session("imagefile") = sender
        Dim extn As String
        Dim fStrm As Stream
        Dim FileContent As Byte()
        extn = Path.GetExtension(pfepimage.PostedFile.FileName)
        fStrm = pfepimage.PostedFile.InputStream

        Dim FullFileContent As Byte()
        FullFileContent = New Byte(pfepimage.PostedFile.ContentLength - 1) {}
        fStrm.Read(FullFileContent, 0, pfepimage.PostedFile.ContentLength)

        FileContent = createThumbNail(fStrm, 100, 100)
        Session("imageFileName") = pfepimage.PostedFile.FileName.ToString()
        Session("imageContent") = FileContent

        Dim savePath As String = MapPath("~/PFEPlabels/" & System.IO.Path.GetFileName(e.FileName))
        pfepimage.SaveAs(savePath)
        ScriptManager.RegisterClientScriptBlock(Me, Me.[GetType](), "image", "top.$get(""" + imgFirst.ClientID & """).src = 'PFEPlabels/" & System.IO.Path.GetFileName(e.FileName) & "';", True)
        ScriptManager.RegisterClientScriptBlock(Me, Me.[GetType](), "size", "top.$get(""" + lblImageError.ClientID & """).innerHTML = 'Uploaded';", True)

        ModalUnitLoadDataSheet.Show()

    End Sub
    Private Function createThumbNail(ByVal ImageStream As Stream, ByVal tWidth As Double, ByVal tHeight As Double) As Byte()
        Dim g As System.Drawing.Image = System.Drawing.Image.FromStream(ImageStream)
        Dim thumbSize As System.Drawing.Size = New System.Drawing.Size
        thumbSize = NewThumbSize(g.Width, g.Height, tWidth, tHeight)
        Dim imgOutput As New System.Drawing.Bitmap(g, thumbSize.Width, thumbSize.Height)
        Dim imgStream As MemoryStream = New MemoryStream
        Dim thisFormat As System.Drawing.Imaging.ImageFormat = g.RawFormat
        imgOutput.Save(imgStream, thisFormat)
        Dim imgBinLength As Integer = CType(imgStream.Length, Integer)
        Dim imgBin() As Byte = New Byte((imgBinLength) - 1) {}
        imgStream.Position = 0
        Dim n As Integer = imgStream.Read(imgBin, 0, imgBinLength)
        g.Dispose()
        imgOutput.Dispose()
        Return imgBin
    End Function

    Private Function NewThumbSize(ByVal currentwidth As Double, ByVal currentheight As Double, ByVal newWidth As Double, ByVal newHeight As Double) As System.Drawing.Size
        Dim tempMultiplier As Double

        If currentheight > currentwidth Then
            tempMultiplier = newHeight / currentheight
        Else
            tempMultiplier = newWidth / currentwidth
        End If
        Dim NewSize As New System.Drawing.Size(Convert.ToInt16(currentwidth * tempMultiplier), Convert.ToInt16(currentheight * tempMultiplier))
        Return NewSize

    End Function

    Private Sub savePFEPLabel(ByVal pfepId As Integer)
        Dim cmd As New SqlCommand
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "sp_PFEP_Cont_Label_Img_addUpdate"

        If hdnPFEPLabel.Value = "" Then
            cmd.Parameters.Add("@Label_Img_ID", SqlDbType.BigInt, 0).Value = -1
        Else
            cmd.Parameters.Add("@Label_Img_ID", SqlDbType.BigInt, 0).Value = Convert.ToInt64(hdnPFEPLabel.Value)
        End If
        cmd.Parameters("@Label_Img_ID").Direction = ParameterDirection.InputOutput
        cmd.Parameters.Add("@PFEP_ID", SqlDbType.Int, 0).Value = pfepId
        cmd.Parameters.Add("@Container_ID", SqlDbType.BigInt, 0).Value = Convert.ToInt64(comboContainer1.SelectedValue.ToString())
        cmd.Parameters.Add("@FileName", SqlDbType.VarChar, 100).Value = Session("imageFileName")
        cmd.Parameters.Add("@FileContent", SqlDbType.Image).Value = Session("imagecontent")
        _dtLoggedInUser = Session("user_session")
        Dim dt As DataTable
        dt = Session("user_session")
        cmd.Parameters.Add("@Created_ID", SqlDbType.BigInt, 0).Value = Convert.ToInt64(dt.Rows(0)("user_id").ToString())
        cmd.Parameters.Add("Update_ID", SqlDbType.BigInt, 0).Value = Convert.ToInt64(dt.Rows(0)("user_id").ToString())

        DataConnect.GetInstance.ExecuteNonQuery(cmd)
        hdnPFEPLabel.Value = cmd.Parameters("@Label_Img_ID").Value.ToString()

        If File.Exists(Server.MapPath("~/PFEPlabels/") + "img.jpg") Then
            File.Delete(Server.MapPath("~/PFEPlabels/") + "img.jpg")
        End If
    End Sub
    Private Sub showImage(ByVal pfepId As Integer)
        Dim dt As New DataTable
        dt = DataConnect.GetInstance.GetDt("SELECT * FROM PFEP_Cont_Label_Img WHERE PFEP_ID=" & pfepId)
        If dt.Rows.Count > 0 Then
            Session("imageFileName") = dt.Rows(0)("FileName")
            Session("imageContent") = DirectCast(dt.Rows(0)("FileContent"), [Byte]())

        End If
        imgFirst.ImageUrl = "imgHandle.ashx?id=" & pfepId

    End Sub





Imports System.Web
Imports System.Web.Services
Imports System.Data.SqlClient

Public Class imgHandle
    Implements System.Web.IHttpHandler

    Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        Try
            Dim pfep_id As String = ""
            pfep_id = context.Request.QueryString("id")
            If pfep_id <> "" Then
                Dim dt As DataTable
                dt = DataConnect.GetInstance.GetDt("SELECT * FROM PFEP_Cont_Label_Img WHERE PFEP_ID=" & pfep_id)
                context.Response.Clear()
                If dt.Rows.Count > 0 Then
                    context.Response.BinaryWrite(DirectCast(dt.Rows(0)("FileContent"), [Byte]()))
                Else
                    context.Response.Write("sss")
                End If
                context.Response.End()
                context.Response.Flush()
            End If
        Catch ex As Exception
            context.Response.End()
        End Try
    End Sub

    ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property

End Class



Hide and enable controls using Javascript


  function hide_N_enable() {
                var hdnfacid = $('#<%=comboFacility.ClientID%>').val()
                $("#<%= hdnfacid.ClientID %>").val(hdnfacid);
                var hval = document.getElementById('<%=hdnfacid.ClientID %>').value;

                var hdndistid = $('#<%=comboDistributionCenter.ClientID%>').val()
                $("#<%= hdndistid.ClientID %>").val(hdndistid);
                var hval = document.getElementById('<%=hdndistid.ClientID %>').value;


                document.getElementById('<%=btnSaveDATASheet.ClientID %>').disabled = false;
                document.getElementById('<%=lblDuplicate.ClientID %>').style.visibility = "hidden";
            }

Thursday, April 26, 2012

Label ToolTip using Jquery


<style type="text/css">
            /* HOVER STYLES */
            div#question
            {
                display: none;
                position: absolute;
                width: 200px;
                padding: 10px;
                background: Ivory;
                color: #000000;
                border: 1px solid skyblue;
                font-size: 90%;
            }
            .thumbnail-item
            {
                /* position relative so that we can use position absolute for the tooltip */
                position: relative;
                float: left;
                margin: 0px 5px;
            }
        </style>
        <script type="text/javascript">
            Sys.Application.add_load(function () {
                var moveLeft = 2;
                var moveDown = 10;

                $('a#trigger').hover(function (e) {
                    $('div#question').show();
                }, function () {
                    $('div#question').hide();
                });

                $('a#trigger').mousemove(function (e) {
                    $("div#question").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
                });

            });
        </script>




   <asp:Label runat="server" Style="text-align: center" ID="lblReturnRatio" Text="Return Ratio">
                                            </asp:Label>
                                            <a href="#" id="trigger" tabindex="100">
                                                <img alt="help" src="Images/question.jpg" height="13px" width="13px" />
                                            </a>:
                                            <!-- TOOLTIP -->
                                            <div id="question">
                                                <p>
                                                    This is the tool tip for Return Ratio and will be replaced by surgere definition.
                                                </p>
                                            </div>

Using Authorization with Swagger in ASP.NET Core

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