Making a button click and process using javascript with Asp.Net

Posted by user944919 on Stack Overflow See other posts from Stack Overflow or by user944919
Published on 2011-11-21T17:47:16Z Indexed on 2011/11/21 17:50 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

I'm having two buttons and one button is hidden. Now when I click the visible button I need to do two things

1.Open Iframe.

2.Automatically make the 2nd Button(Hidden)to be clicked.

When the second button is clicked I need to display the message on top of the IFrame which I have mentioned as function showStickySuccessToast()

Now I am able to open IFrame but I'm unable to make the Hidden button clicked automatically.

This is what I'm having:

      <script type="text/javascript">
       $(document).ready(function(){
        $("#<%=Button1.ClientID%>").click(function(event){
            $('#<%=TextBox1.ClientID%>').change(function () {
                $('#various3').attr('href', $(this).val());
            });
    });
       function showStickySuccessToast() {
        $().toastmessage('showToast', {
            text: 'Finished Processing!',
            sticky: false,
            position: 'middle-center',
            type: 'success',
            closeText: '',
            close: function () {

            }
        });
    }
    }) 
    </script>

Here are my two buttons how I'm working with:

<a id="various3" href="#"><asp:Button ID="Button1" 
runat="server" Text="Button" OnClientClick="Button2_Click"/></a>

<asp:Button ID="Button2" 
runat="server" Text="Button" Visible="False" OnClick="Button2_Click"/>

And in the button2_Click event:

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
       System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "Script", "showStickySuccessToast();", True)
    End Sub

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ASP.NET