Click here to Skip to main content
13,148,103 members (72,012 online)
Rate this:
Please Sign up or sign in to vote.
When I list the database by filtering the data into the textbox values ​​and would like to assign selected value textbox.

Posted 27-Aug-12 4:42am
Updated 27-Aug-12 4:47am
Dave Kreskowiak 27-Aug-12 11:00am
Ummm....what? I can appreciate that English probably isn't your 1st language, but this made no sense at all.

Are you asking how to filter a database list based on what the user is typing??
Yılmaz Korkmaz 27-Aug-12 11:03am
I want to filter a field in the database table.
Value of the function can not send.

@using (Html.BeginForm())
<div class="editor-label">
@Html.LabelFor(model => model.sender_name)
<div class="editor-field">
@Html.TextBox("sendername", null, new { onkeyup = "GetSenderName(this.value);" })

@Html.ValidationMessageFor(model => model.sender_name)
<input type="submit" value="Submit" />
<script type="text/javascript">
function GetSenderName(value) {
type: "GET",
url: "/RCV/GetSenderName",
data: "{id:" + value + "}",
contentType: "application/json; charset=utf-8",
success: function (msg) {
error: function () {
alert("not connected!");
Christian Graus 27-Aug-12 11:38am
Don't use unobtrusive javascript, it's very limited. Use straight jQuery.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You also don't want to make AJAX calls on every keypress. You could use a timer to make it fire when the keys stop being pressed, or use the blur event to do it when focus is lost. Assigning a value to a textbox is trivial is jquery - $("#txtboxid").val(myVal); If that's not what you want, your question is too unclear to know what you need.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170924.1 | Last Updated 27 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100