TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
swsh hussain
NA
11
11.7k
executing controller controller action method
Nov 14 2015 3:22 AM
i want to execute a controller action method soon after entering the data in a textbox glgroupcode
the action method takes glgroupcode textbox value as a parameter and result should get populated in another textbox .
the below is my jquery code and action method
<script type="text/javascript">
$('#GLGroupCode').on('keypress ', function (event) {
alert("s");
$.ajax({ url: "/GLMaster/TextChanged", type: "GET", data: { text: $('#GLGroupCode').val() }, dataType: 'json', success: function (result) {
$('#txtSearch1').val(result);
}
});
});
</script>
<div class="editor-field">
@Html.TextBoxFor(model => model.GLGroupCode)
@Html.ValidationMessageFor(model => model.GLGroupCode )
</div>
<div class="editor-label">
@Html.LabelFor(model => model.GLGroupName)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.GLGroupName, new { id = "txtSearch1" })
@Html.ValidationMessageFor(model => model.GLGroupName)
public JsonResult TextChanged(string GLGroupCode)
{
var subGroups = from p in db.tblGLGroups where p.GroupCode == GLGroupCode select p.GroupName;
return Json(subGroups, JsonRequestBehavior.AllowGet);
}
Reply
Answers (
2
)
how to use file upload controls in asp using jquery aja
error when inserting sql database from datagridview