Thursday 13 June 2013

Widgets

Show Hide Image Programmatically in Asp.net.

Description:- Dear Friends in My some previous article We Learned about JQuery Javascript Some Tutorial Like as easeOut Effect in JQueryHow To make Slider in JavaScript,Wait for Downloading Counter,Highlight Searched Text in Gridview,Dropdown list atteched with Selection of another DropDown and many more Article on Asp.net,Css,JavaScript,Html,Jquery.Now In this Article We Learn That how to Show hide Image or any other control programmatically in Asp.net.


Demo:-



Coding:-

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Image1.Visible = false;
    }
    protected void Button2_Click(object sender, System.EventArgs e)
    {
        Image1.Visible = true;
    }
</script>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to show, hide, visible TextBox programmatically</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style=" background-color:orange; color :white; width: 321px; height: 27px;">Show Hide controls in Asp.net </h2>
         
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         
        <asp:Image ID="Image1" runat="server" ImageUrl="~/1.jpg" Height="281px"
            Width="274px" />
        <br /><br />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button  
             ID="Button1"  
             runat="server" BackColor="OrangeRed"  
             ForeColor="White"
             Text="Hide Love"
             OnClick="Button1_Click"
             Font-Bold="true"
             />
        <asp:Button  
             ID="Button2"  
             runat="server" BackColor="OrangeRed"  
             Font-Bold="true"
             ForeColor="White"
             Text="Show Love"
             OnClick="Button2_Click"
             />
    </div>
    </form>
</body>
</html>  

0 comments:

Post a Comment