Button click event not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hamayun Khan
    New Member
    • Aug 2007
    • 106

    Button click event not working

    Hi
    I want to code on the click event of the following button. but it did not work. If I remove the PostBackUrl then it start working. This button is in .ascx control which i used in default.aspx. the default.aspx and ***.ascx control are on root folder.
    <asp:Button ID="Button1" runat="server" Text="Search" UseSubmitBehavi or=true PostBackUrl="te achers/search_all.aspx " />
    what is the reason that the click event of button didn't work if i use postbackurl.
    Please help me
  • malav123
    New Member
    • Feb 2008
    • 217

    #2
    Hi,
    Why are you redirecting ? if you want to do something when button will be cliked than write the code in .vb page that is Button_click event.. it will deffinately works.... no need to write postbackurl... if your need is of to redirect in another page than you can also write it in .vb page.....

    Comment

    • Hamayun Khan
      New Member
      • Aug 2007
      • 106

      #3
      Originally posted by malav123
      Hi,
      Why are you redirecting ? if you want to do something when button will be cliked than write the code in .vb page that is Button_click event.. it will deffinately works.... no need to write postbackurl... if your need is of to redirect in another page than you can also write it in .vb page.....
      I want to do some coding on click event and then want to redirect to some other page. If i use the usepostbackurl of the button then click event is not triggered and if I remove the usepostbackurl then how i can redirect to the desired page.

      Comment

      • kunal pawar
        Contributor
        • Oct 2007
        • 297

        #4
        u can use Response.redire ct or server.transfer to redirect page in button on click event

        Comment

        • malav123
          New Member
          • Feb 2008
          • 217

          #5
          Hi,
          remove unnecessary attributes from the Button tag, just use the id and runat="server" and go to the vb page and write down all the code in Button_click event than use Response.redire ct to go to desired page.......



          -malav.

          Comment

          Working...