How to post to server-side?

Dec 27, 2007 at 2:01 AM
How to post to server-side when the text changed? I only see the OnClientTargetValueChanged method, but there is no parameter in that method. Thanks for the good component and hard work.
Mar 19, 2008 at 5:29 PM
I believe you probably have two options as it is now.

1) Set AutoPostBack = "true" on the TextBox and set an OnTextChanged method

2) Set EnablePageMethods="true" in the ScripManager And use a JavaScript / WebMethod combination...

Example:
- Set OnClientTargetValueChanged="testAlert" in the InlineEditExtender
- Use something similiar to the following code (assumes you have a txtDate object):

<script language="javascript">
function testAlert()
{
PageMethods.GetCurrentDate(OnSucceeded, OnFailed);
}
function OnSucceeded(result, userContext, methodName) {
$get('txtDate').innerHTML = result;
}

function OnFailed(error, userContext, methodName) {
$get('txtDate').innerHTML = "An error occured.";
}
</script>

Then have this in the CodeBehind ...

<WebMethod()> _
Public Shared Function GetCurrentDate() As String
Return DateTime.Now.ToLongDateString()
End Function