It's quite straightforward using the __doPostBack call from Javascript.
In the Page_Load function in your code behind, put:
protected void Page_Load(object sender, EventArgs e)
{
// ensure page always includes the __doPostBack function
// (best to put this in your Master Page, if you have one)
Page.ClientScript.GetPostBackEventReference(this, string.Empty);
// now test if a postback event occurred
if (Page.IsPostBack)
{
// postback occurred, so determine which function name was called
switch (Request.Form["__EVENTTARGET"])
{
case "myProcedure1":
{
// go and call your function
doMyProcedure1(Request.Form["__EVENTARGUMENT"]);
break;
}
}
}
}
Then further down in your code behind, create the C# function you wish to call:
protected void doMyProcedure1(String someVar)
{
// do your function code here
String passedVar = someVar;
}
Then finally in your Javascript, do the postback that calls the C# function:
function callMyFunction()
{
__doPostBack('myProcedure1', 'some string');
}