Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Image Button Postback

Image Button Postback

Scheduled Pinned Locked Moved ASP.NET
javascripthelpquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anupbala
    wrote on last edited by
    #1

    i am having an image button and i need the click event of the image button to fire but postback should be prevented,is it possible.I tried several methods but didn't worked for me.I even replaced the image button with a image control and used javascript,but still it didn't worked for me. My requirement is that on the image button click i want to make another web control visible but i need to prevent postback once the click event is fired. Can any one help? Thanks in advance

    B V A 3 Replies Last reply
    0
    • A Anupbala

      i am having an image button and i need the click event of the image button to fire but postback should be prevented,is it possible.I tried several methods but didn't worked for me.I even replaced the image button with a image control and used javascript,but still it didn't worked for me. My requirement is that on the image button click i want to make another web control visible but i need to prevent postback once the click event is fired. Can any one help? Thanks in advance

      B Offline
      B Offline
      bokuceres
      wrote on last edited by
      #2

      why don't you use image html instead of asp:imagebutton ? on image html you can create onclick or onclientclick eventhandler to fire your method that will show your control. hope it helps

      A 1 Reply Last reply
      0
      • B bokuceres

        why don't you use image html instead of asp:imagebutton ? on image html you can create onclick or onclientclick eventhandler to fire your method that will show your control. hope it helps

        A Offline
        A Offline
        Anupbala
        wrote on last edited by
        #3

        i have tried with html control too but didn't worked for me.

        1 Reply Last reply
        0
        • A Anupbala

          i am having an image button and i need the click event of the image button to fire but postback should be prevented,is it possible.I tried several methods but didn't worked for me.I even replaced the image button with a image control and used javascript,but still it didn't worked for me. My requirement is that on the image button click i want to make another web control visible but i need to prevent postback once the click event is fired. Can any one help? Thanks in advance

          V Offline
          V Offline
          Venkatesh Mookkan
          wrote on last edited by
          #4

          Anupbala wrote:

          i am having an image button and i need the click event of the image button to fire but postback should be prevented,is it possible.

          Nope. As it is a server-side control, it would Postback.

          Anupbala wrote:

          My requirement is that on the image button click i want to make another web control visible but i need to prevent postback once the click event is fired.

          You can do it using JavaScript. But do not set the Visible Property of the Web Control to false. If you set it, the page would not render that control. So, you will not able to find the control using JavaScript. Use Style property to set the visibility/block. Then write your code to make it visible/hidden

          [Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot

          A 1 Reply Last reply
          0
          • V Venkatesh Mookkan

            Anupbala wrote:

            i am having an image button and i need the click event of the image button to fire but postback should be prevented,is it possible.

            Nope. As it is a server-side control, it would Postback.

            Anupbala wrote:

            My requirement is that on the image button click i want to make another web control visible but i need to prevent postback once the click event is fired.

            You can do it using JavaScript. But do not set the Visible Property of the Web Control to false. If you set it, the page would not render that control. So, you will not able to find the control using JavaScript. Use Style property to set the visibility/block. Then write your code to make it visible/hidden

            [Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot

            A Offline
            A Offline
            Anupbala
            wrote on last edited by
            #5

            i want to hide an asp:menu,how can that be done using style property?

            N 1 Reply Last reply
            0
            • A Anupbala

              i want to hide an asp:menu,how can that be done using style property?

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              ASP.NET render menu control as HTML table. So you can find this element and change visibility using JS.

              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

              1 Reply Last reply
              0
              • A Anupbala

                i am having an image button and i need the click event of the image button to fire but postback should be prevented,is it possible.I tried several methods but didn't worked for me.I even replaced the image button with a image control and used javascript,but still it didn't worked for me. My requirement is that on the image button click i want to make another web control visible but i need to prevent postback once the click event is fired. Can any one help? Thanks in advance

                A Offline
                A Offline
                Arun Jacob
                wrote on last edited by
                #7

                Call this function on event ONClienClick of image button.Menu1 is the ID of menu. function MakeVisible() { var menu=document.getElementById('Menu1'); menu.style.display='none'; return false; } html view for image button as below. <asp:ImageButton ID="ImageButton1" runat="server" OnClientClick="return MakeVisible()" /> For making visible,then give, menu.style.display=block;

                Arun J

                modified on Thursday, January 31, 2008 3:35:39 AM

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups