So i actually solved the problem below, it seems i cant access the WebMethod in app_code folder, is there any way to do it?
Im having a problem making this work. Here is my code.
C# Class
And here is my javascriptCode:public class GlobalFunctions { [WebMethod] public static string TextBoxCheck(string CurrentText) { if (string.IsNullOrWhiteSpace(CurrentText)) { CurrentText = string.Empty; return CurrentText; } else { CurrentText = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(CurrentText); return CurrentText; } } }
Code:function CheckTextbox(textBoxID){ var textBoxText = document.getElementById(textBoxID).value; PageMethods.SendForm(textBoxText, OnSucceeded, OnFailed); } function OnSucceeded() { alert(CurrentText); document.getElementById(textBoxID).value = CurrentText; } function OnFailed(error) { // Alert user to the error. //alert(error.get_message()); }
What happens is from my javascript, i pass the value of the textbox using the "onblur" and then after i run the WebMethod, it will return the result which i want to be passed to the textbox.
i was using the UpdatePanel control and Scriptmanager and page method is true, what i want is to minimize the data being passed, instead of getting and requesting the data of the whole panel, i only want to get the data of the textbox after running the code.
--------------------------------------------------
is it possible to run the code of the textbox in codebehind like "Textbox_TextChanged" and then retrieving the data using ajax and not update panel.


Reply With Quote
Bookmarks