Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 09, 2012 06:00 PM by chandrashekarthota
Member
5 Points
50 Posts
May 08, 2012 06:44 PM|LINK
@Html.TextBox("tbxSearch", null, new { data_url = Url.Action("GetSearchData"), data_maxValues = 10, data_valueHiddenId = "#Id", @class = "searchTextbox" })
I am using a autocomplete option for a textbox in asp.net mvc3 by calling a controller method to display list of values associated with ids in textbox.
Now I want to use Jquery to get data_valueHiddenId value in alert
$(document).ready(function () { ConfigureAutoComplete("#tbxSearch"); $("#btnSearchPerson").click(function () { alert($("#data_valueHiddenId").val()); }); });
Participant
959 Points
193 Posts
May 09, 2012 11:57 AM|LINK
you can use the below code to access the value, as data_valueHiddenId will be rendered as attribute of the text box
$(document).ready(function () { ConfigureAutoComplete("#tbxSearch"); $("#btnSearchPerson").click(function () { alert($("#tbxSearch").attr("data_valueHiddenId")); }); });
Hope that helps!
May 09, 2012 06:00 PM|LINK
It gives me undefined. Could you please check if I did some issue in assigning hidden value in html.textbox?
chandrasheka...
Member
5 Points
50 Posts
Getting Hidden Field Values in mvc @Html.TextBox
May 08, 2012 06:44 PM|LINK
@Html.TextBox("tbxSearch", null, new { data_url = Url.Action("GetSearchData"), data_maxValues = 10, data_valueHiddenId = "#Id", @class = "searchTextbox" })I am using a autocomplete option for a textbox in asp.net mvc3 by calling a controller method to display list of values associated with ids in textbox.
Now I want to use Jquery to get data_valueHiddenId value in alert
$(document).ready(function () { ConfigureAutoComplete("#tbxSearch"); $("#btnSearchPerson").click(function () { alert($("#data_valueHiddenId").val()); }); });gopakumar.r
Participant
959 Points
193 Posts
Re: Getting Hidden Field Values in mvc @Html.TextBox
May 09, 2012 11:57 AM|LINK
you can use the below code to access the value, as data_valueHiddenId will be rendered as attribute of the text box
$(document).ready(function () { ConfigureAutoComplete("#tbxSearch"); $("#btnSearchPerson").click(function () { alert($("#tbxSearch").attr("data_valueHiddenId")); }); });Hope that helps!
Gopakumar
| Please click “Mark as Answer” on the post(s) if it helps |
chandrasheka...
Member
5 Points
50 Posts
Re: Getting Hidden Field Values in mvc @Html.TextBox
May 09, 2012 06:00 PM|LINK
It gives me undefined. Could you please check if I did some issue in assigning hidden value in html.textbox?