I have the the following html elements:
<tr>
<td> <label for="casenumber">Case:</label></td>
<td>
<%=Html.TextBox("casenumber", "", new Dictionary<string, object>
{
{"id", "casenumberID"}
})%>
</td>
</tr>
<tr>
<td><label for="fogbugzUser">Users:</label></td>
<td>
<%=Html.DropDownList("UserList", (SelectList)ViewData["UserList"], new Dictionary<string, object>
{
{"id", "userlistid"}
})%>
</td>
</tr>
Now, when the "casenumber" loses focus, I want to call the database to return me a selected value in the "UserList".
Here's the Javascript:
$(function() {
$("#casenumberID").blur(function() {
//don't know how to do!!);
});
});
And here's the client side scripting:
public JsonResult GetOpenByUser(string casenumber)
{
return Json(userContext.OpenBy(casenumber));
}
The question is how to write the function "blur" so that I can pass in the value of the textbox "casenumber" to the GetOpenByUser?
Also, how to complete the function "blur" so that the option that has the same value as the one that is returned by GetOpenByUser will be selected?