Running a click using jQuery to use a code function that does not work in 1.4. Work done in 1.3.2

I have a gridview in the update panel and I use the jQuery dialog to add records.

The AJAX / JSON function is called in the dialog box, which adds the entry. Upon successful execution of this function, I have a jQuery trigger with a mouse button on a hidden button

   ... 
       success: function(msg) {
             $("[id$='_btnUpdateGrid']").trigger('click');
             $("#new_dialog").dialog('close');
         },
   ...

which the event handler in the code must hit in order to update the data source and update the gridview.

<asp:Button ID="btnUpdateGrid" runat="server"  OnClick="btnUpdateGrid_Click" 
Text=" " Width="1px" Height="1px" Style="background-color:#F5F3E5; border:none;"  />

This works great with 1.3.2. Updated to 1.4.1, and it no longer gets into the code. AJAX still works, but I need to refresh the page manually to refresh the grid.

, (, OnClientClick = "alert ('hello')" ), , - . jquery, . , script .

, ?

+3
3

, . , 1.3 , , .

 ... 
   success: function(msg) {
         $("#new_dialog").dialog('close');
         $("[id$='_btnUpdateGrid']").trigger('click');
     },
 ...

.

0

ID id . .

0

Maybe try binding the event handler to the buttons using JavaScript, instead of doing this with the onClick attribute in HTML. jQuery allows you to do this with real-time event bindings:

$ ("[id $ = '_ btnUpdateGrid']"). live ("click", btnUpdateGrid_Click);

I'm not sure that I will do everything to solve the problem, but it's worth a try.

0
source

Source: https://habr.com/ru/post/1746478/


All Articles