Gives solution for any Error occurs in any Programming Language, .Net Core 3.1, 3.0, C#,Asp.Net,Sqlserver,MVC,Java,Php,Html,Css,Jquery,errors and solutions,Latest News,Technology

Monday, 11 January 2016

Show or Hide a Image/Button DropDownList change using Jquery in ASP.NET

No comments :
Here I will explain about show or hide image,modalpopup,buttons,tables..etc on DropDownlist change using jquery. I use jquery change() method to show or hide an image,modalpopup,tables..etc.It will be working based on dropdownlist value.
ASP.NET
<asp:DropDownList ID="ddlType" runat="server">
    <asp:ListItem Text="Select" Value="0"></asp:ListItem>
    <asp:ListItem Text="Show" Value="S"></asp:ListItem>
    <asp:ListItem Text="Hide" Value="H"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnShow" runat="server" Text="Show/Hide"/>
jQuery
$(document).ready(function () {
            BredCrumb();
            $("[id*=ddlType]").change(function () {              
                var value = $("[id*=ddlType] option:selected").val();
                alert(value);
                if (value == "H")
                    $("[id*=btnShow]").hide();
                else if (value == "S")
                    $("[id*=btnShow]").show();
            });
        });

No comments :

Post a Comment