The only ways to call a server-side method from client-side is to do a PostBack or use AJAX. Here are some options for executing a PostBack:
If update_week is a button event handler you could do this:
<script type="text/javascript">
<!--
function updateWeekClientSide()
{
document.getElementById('<%= Button1.ClientID %>').click();
// Or: document.getElementById('<%= Button1.ClientID %>').fireEvent('onclick');
}
// -->
</script>
If not you could do this.
<script type="text/javascript">
<!--
function updateWeekClientSide()
{
<%= GetPostBackEventReference(this, "UpdateWeek") %>;
}
// -->
</script>
and in the CodeBehind:
private void Page_Load(object sender, System.EventArgs e)
{
if ( this.IsPostBack )
{
// Place any code that needs to be executed ONLY on a post-back here.
string eventArgument = (this.Request["__EVENTARGUMENT"] == null) ? string.Empty : this.Request["__EVENTARGUMENT"];
if ( eventArgument == "UpdateWeek" )
update_week(null, EventArgs.Empty);
}
}
NC...