JavaScript Triggering an Ext.net button click with JavaScript triggering button click event in javascript,triggering button click javascript,

I have an ext:button. I want to trigger it's OnClick event by JavaScript based on the condition of a confirm message.

My Button

<ext:Button ID="btnAddEsya" Text="text" runat="server" Icon="Add" >
    <DirectEvents>
        <Click OnEvent="btnAddEsya_Click" ViewStateMode="Enabled">
        </Click>
    </DirectEvents>
</ext:Button>

Code Behind (only relevant parts)

[DirectMethod]
    public void btnAddEsya_Click(object sender, EventArgs e)
    {
     if (/*Checking conditions here*/)
        {
            X.Msg.Confirm("Warning", "Save?", new JFunction { Fn = "SaveLine" }).Show();
        }

}

Java Script

<script language="javascript" type="text/javascript">
        var SaveLine = function (btn) {
            if (btn == 'yes') {
                alert('TEST YES');
                NewLine.click();
                document.getElementById('btnAddEsya').click();


            }
            else if (btn == 'no')
            { alert('TEST NO'); }
        };
            </script>

So far I tried this method, the __doPostBack('btnAddEsya','OnClick'); method and assigning the buttons to variables and calling them as variablename.click(). None of them worked.

Can it be about ext.net buttons Click OnEvent ?

Edit:

Recently I tried this too, and it didn't work either. Also

<script language="javascript" type="text/javascript">
        btnAddEsya = document.getElementById('<%= btnAddEsya.ClientID %>');
        var SaveLine = function (btn) {
            if (btn == 'yes') {
                alert('TEST YES');
                btnAddEsya.click();
                }
            else if (btn == 'no')
            { alert('TEST NO'); }
        };
            </script>
Answer:1

Could you try something like this?

#{btnAddEsya}.fireEvent("click");
Answer:2

I would like to use the page scroll effect so that only the content of the #right element is scrolled in the layout. A similar effect can be seen on Facebook when scrolling posts (posts are scrolled ...

I would like to use the page scroll effect so that only the content of the #right element is scrolled in the layout. A similar effect can be seen on Facebook when scrolling posts (posts are scrolled ...

Alright, so my question is how I can add a prop to a component programmatically, here is my case, I have this in my render() for example: <TextField name="password" ...

Alright, so my question is how I can add a prop to a component programmatically, here is my case, I have this in my render() for example: <TextField name="password" ...

  1. jquery adding property to element

I've got a button, that when I click executes a js code. Like this. jQuery( ".button" ).on('click', function(){ var page = jQuery(this).attr('data-href');//Get data-href with permalink. ...

I've got a button, that when I click executes a js code. Like this. jQuery( ".button" ).on('click', function(){ var page = jQuery(this).attr('data-href');//Get data-href with permalink. ...

  1. before content height
  2. before content height css

I want show the price of the product when the customer select the type and size using the radio buttons and select options. lets say customer select type "single" and size "75X36" price should be ...

I want show the price of the product when the customer select the type and size using the radio buttons and select options. lets say customer select type "single" and size "75X36" price should be ...

  1. jquery show hide