Can't open only one element with "dialog" function
Hello everyone and please forgive me in advance if I leave any details out as this is my first post here:
I have a problem using dialog JQ command. More specifically, I want the button called "Edit" (line 7 below) to open only 1 window as opposed to all behind each other. Below is some of the code I use right now and a short description of what happens with the codde. Thank you in advance for reading!
- <!-- C# and HTML code here-->
- <table>
- <tbody>
- <% foreach (var item in Model) { %>
- <tr>
- <td>
- <button class="opener">Edit</button>
- <div class="dialogButton" title="Something"><% Html.RenderAction("Something", "Admin", new { id = item.ID }); %></div>
- <td>Other values</td>
- </tr>
- </table>
- <!-- JQ script is here-->
- $(".dialogButton").dialog({ autoOpen: false });
- $(".dialogButton").dialog({ buttons: { "Ok": function () { $(this).dialog("close"); } } });
- $(".dialogButton").dialog({ show: 'fade' });
- $('.opener').click(function () { $('.dialogButton').dialog('open'); });
What the application does so far is it loads the table and has an edit button next to each row (line 7 above), however when the "Edit" button is pressed the Html.RenderAction (line 8) pulls up edit windows for all of the items (item.ID) on the list instead of only the selected one row. This means that there are currently about 25 windows that pop up behind each other.
What I want the code to do but so far was unable to figure out is only to open the edit window for selected row.
Thank you again!