c# - Help open only one element with "dialog" function in JQuery (UI) in MVC environment -


hello , please forgive me in advance if leave details out first post here:

i have problem using dialog jquery command. more specifically, want button called "edit" (line 7 below) open 1 window opposed behind each other. below of code use right , short description of happens codde. thank in advance reading!

<!-- c# , 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 here--> $(".dialogbutton").dialog({ autoopen: false });             $(".dialogbutton").dialog({ buttons: { "ok": function () { $(this).dialog("close"); } } });             $(".dialogbutton").dialog({ show: 'fade' });             $('.opener').click(function () { $('.dialogbutton').dialog('open'); }); 

what application far loads table , has edit button next each row (line 7 above), when "edit" button pressed html.renderaction (line 8) pulls edit windows of items (item.id) on list instead of selected 1 row. means there 25 windows pop behind each other.

what want code far unable figure out open edit window selected row.

it has been suggested replace last line in code above (line 17, last) following code:

$('.opener').click(function () { $(this).next().dialog('open'); }); 

in theory suppose open 1 element not. please help!

thank again!

just put unique id each div class="dialogbutton" , button class="opener"

like div class="dialogbutton" id="dialogbutton_1" , button class="opener" id="opener_1. use item.id or else unique.

and call dialog plugin id

$('.opener').click(function () { $('#dialogbutton_'+$(this).attr('id')).dialog('open'); });

basically calling dialog coresponds opener way

hope sound logical you.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -