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 - jqgrid - refresh a grid after an ajax file upload -


how refresh jqgrid based grid outside of grid itself? within code grid exists option call reloadgrid. however, want reload grid after doing ajax file upload, outside of jqgrid code. how call reloadgrid in context?

i realize can reload entire page like: location.reload(); reloads whole lot , puts me first page of results grid , kind of defeats purpose of using ajax upload file in first place.

some code:

reloadgrid called within jqgrid follows:

$("#thegrid").trigger("reloadgrid");

but nothing when called within ajaxupload:

        oncomplete: function(file, response) {             if (response == 'success') {                         //location.reload();                         $("#thegrid").trigger("reloadgrid");                     }else if (response == 'error') {                         alert("doh!");                     } 

if uncomment location.reload(), page reloads trigger uncommented (as in above example) nothing happens @ all. how reload grid?

i see no problem in using of $("#thegrid").trigger("reloadgrid") outside of jqgrid. problem in relation between oncomplete ajaxupload , $("#thegrid") @ all.

for example can define external button on same page jqgrid <table> element having id="thegrid" , use

$("#button").click(function() {     if ($("#thegrid").length === 0) {         alert("no element id='thegrid' found");     }     if ($.isfunction($("#thegrid").jqgrid) !== true) {         alert("$('#thegrid') not jqgrid");     }     var e = $("#thegrid").data("events");     if (typeof(e) !== "undefined" && typeof(e.reloadgrid) !== "undefined") {         $("#thegrid").trigger("reloadgrid");     } else {         alert("$('#thegrid') not bound 'reloadgrid' function");     } } 

you see the code work without alerts. can include same code inside of oncomplete handler of ajaxupload.

to verify 'reloadgrid' function work can use loadcomplete:

loadcomplete: function() {     alert("grid loaded/reloaded"); } 

updated: starting jquery 1.8 1 should use $._data($("#thegrid")[0], "events"); instead of $("#thegrid").data("events") list of events of grid.


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 -