Click here to Skip to main content
15,888,116 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: URGENT, Web base data logger Pin
Paddy Boyd3-Feb-09 2:06
Paddy Boyd3-Feb-09 2:06 
QuestionHow can i call C# function Through javascript on aspx page Pin
gautamamit82-Feb-09 23:20
gautamamit82-Feb-09 23:20 
AnswerRe: How can i call C# function Through javascript on aspx page Pin
sarang_k2-Feb-09 23:38
sarang_k2-Feb-09 23:38 
GeneralRe: How can i call C# function Through javascript on aspx page Pin
gautamamit82-Feb-09 23:56
gautamamit82-Feb-09 23:56 
AnswerRe: How can i call C# function Through javascript on aspx page Pin
N a v a n e e t h2-Feb-09 23:42
N a v a n e e t h2-Feb-09 23:42 
GeneralRe: How can i call C# function Through javascript on aspx page Pin
gautamamit82-Feb-09 23:58
gautamamit82-Feb-09 23:58 
GeneralRe: How can i call C# function Through javascript on aspx page Pin
J4amieC3-Feb-09 2:23
J4amieC3-Feb-09 2:23 
AnswerRe: How can i call C# function Through javascript on aspx page Pin
vaghelabhavesh3-Feb-09 4:24
vaghelabhavesh3-Feb-09 4:24 
I would prefer you to use AJAX but here is one other solution.

From javascript make a call to dopostback method with eventtarget and arguments (if reuqired) and in Page Load method check for the event target and call the C# method. Remember this is dirty trick.

JavaScript (JS File)
__doPostBack('CALL_MY_METHID','');


ASPX Code Behind

void Page_Load(object sender, EventArgs e)
{
....
....

// Insure that the __doPostBack() JavaScript method is created...
this.GetPostBackEventReference(this, string.Empty);

string eventTarget = (this.Request["__EVENTTARGET"] == null) ? string.Empty : this.Request["__EVENTTARGET"];
if (eventTarget == "CALL_MY_METHID")
{
  // Call your C# method here and return
  CallMyMethod();
  return;
}
....
....
}


Be careful, there is no Undo Button(Ctrl+Z) in life.

GeneralRe: How can i call C# function Through javascript on aspx page Pin
Ranjit Viswakumar3-Feb-09 9:34
Ranjit Viswakumar3-Feb-09 9:34 
QuestionPageMethods vs HTTP Handlers Pin
Anurag Gandhi2-Feb-09 23:03
professionalAnurag Gandhi2-Feb-09 23:03 
AnswerRe: PageMethods vs HTTP Handlers Pin
N a v a n e e t h2-Feb-09 23:40
N a v a n e e t h2-Feb-09 23:40 
GeneralRe: PageMethods vs HTTP Handlers Pin
Anurag Gandhi3-Feb-09 0:07
professionalAnurag Gandhi3-Feb-09 0:07 
GeneralRe: PageMethods vs HTTP Handlers Pin
N a v a n e e t h3-Feb-09 4:41
N a v a n e e t h3-Feb-09 4:41 
GeneralRe: PageMethods vs HTTP Handlers Pin
Jon Rista3-Feb-09 10:27
Jon Rista3-Feb-09 10:27 
AnswerRe: PageMethods vs HTTP Handlers Pin
Jon Rista3-Feb-09 10:26
Jon Rista3-Feb-09 10:26 
QuestionHTML Tabs - Help Required Pin
Jay_se2-Feb-09 22:49
Jay_se2-Feb-09 22:49 
AnswerRe: HTML Tabs - Help Required Pin
mr_muskurahat3-Feb-09 2:19
mr_muskurahat3-Feb-09 2:19 
QuestionRe: HTML Tabs - Help Required Pin
Jay_se3-Feb-09 19:11
Jay_se3-Feb-09 19:11 
AnswerRe: HTML Tabs - Help Required Pin
mr_muskurahat3-Feb-09 19:23
mr_muskurahat3-Feb-09 19:23 
GeneralRe: HTML Tabs - Help Required Pin
Jay_se3-Feb-09 23:44
Jay_se3-Feb-09 23:44 
GeneralRe: HTML Tabs - Help Required Pin
mr_muskurahat4-Feb-09 7:36
mr_muskurahat4-Feb-09 7:36 
GeneralRe: HTML Tabs - Help Required Pin
mr_muskurahat4-Feb-09 7:40
mr_muskurahat4-Feb-09 7:40 
QuestionAjax problem in internetexplorer 6 & firefox Pin
mr_muskurahat2-Feb-09 22:21
mr_muskurahat2-Feb-09 22:21 
AnswerRe: Ajax problem in internetexplorer 6 & firefox Pin
Christian Graus2-Feb-09 22:30
protectorChristian Graus2-Feb-09 22:30 
AnswerRe: Ajax problem in internetexplorer 6 & firefox Pin
sarang_k2-Feb-09 22:48
sarang_k2-Feb-09 22:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.