Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

jQuery problem on hyperlink click -


in 2 different views have following 2 pieces of code.

first

<table class="table-list">    <tr class="gridrow">       <td>david gilmour</td>       <td style="width:16px">          <a href="#" rel="/xyz/contact/edit/26965" class="editcontactlink" title="modifica">             <img alt="" src="/xyz/_assets/images/edit.png">          </a>       </td>    </tr>    <tr class="gridrow">       <td>paco de lucia</td>       <td style="width:16px">          <a href="#" rel="/xyz/contact/edit/26966" class="editcontactlink" title="modifica">             <img alt="" src="/xyz/_assets/images/edit.png">          </a>       </td>    </tr> </table> 

second

<div>     <a href="#" rel="/xyz/contact/edit/26965" class="editcontactlink" title="modifica">david gilmour</a> </div> <div>     <a href="#" rel="/xyz/contact/edit/26966" class="editcontactlink" title="modifica">paco de lucia</a> </div> 

in both cases use following jquery snippet

$("a.editcontactlink").click(function (event) {     event.preventdefault();     //use $(this).attr("rel") go edit page of related contact element }); 

in first case have 1 ajax call server while in second have two ajax calls both going same address

where wrong?

make sure code here:

$("a.editcontactlink").click(function (event) {     event.preventdefault();     //... }); 

isn't running twice, whether being inside event, or included twice begin with, etc. example if it's loaded ajax, change $("a.editcontactlink") $("a.editcontactlink", data) (data being response), or use .live() or .delegate() handler, example:

$("#container").delegate("a.editcontactlink", "click", function(event) {     event.preventdefault();     //... }); 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -