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 - ajax post method not working in vb.net -


i using jquery using ajax post data, reason when click on submit, page doesnt go aspx aspx.vb on side. here's code -

 $(document).ready(function() {       $("#btnsave").click(function() {           var firstname = $("#" + '<%=firstname.clientid%>').val();            $.ajax({               type: "post",               url: "student.aspx/new_class",               data: "firstname="+ firstname + ";",               contenttype: "application/json; charset=utf-8",               datatype: "json",               success: function() {                                    }           });       });   }); 

new_class webmethod in vb.net side. if put alert in btnsave onclick function, see firstname value in alert. page not call new_class function after that. ideas i'm going wrong?

that url incorrect mapping method on server-side code.

i assume you're trying call method called new_class in student.aspx.vb. correct?

what you'll want create separate page request. maybe student_ajax.aspx or of nature. how organize you. simplest way go doing you're trying have new_class logic page_load logic in new page. in method you'll generate json (which i'm assuming you're doing manually , correctly, that's different question if comes up) return client.

note, however, in page you'll need trickery. first, rid of of html in page itself. want return only json, not wrapped in html. then, when you're generating response string in code-behind logic, you'll want set header proper headers , output string:

response.clear() response.contenttype = "application/json" response.write(myjsonstring) response.end() 

note freehand, there may detail or 2 missing in implementation. , know there more elegant ways this. i'm sure can find tutorial or 2 on google. you're trying create custom handler on server ajax request returns json data.


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 -