Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I cant set text field value to ajax.action ID .

This is my code :


C#
@Html.TextBoxFor(m => m.DivisionId)
    @Html.ValidationMessageFor(m => m.DivisionId)
    @Ajax.ActionLink("Find", "Find", "DivisionSetup", new { id = ????? }, new AjaxOptions { UpdateTargetId = "find"})

I need to set
C#
@Html.TextBoxFor(m => m.DivisionId)
value to id = ????? .

Please help me out.
Posted
Updated 28-Feb-12 18:48pm

1 solution

when you use
C#
@Html.TextBoxFor(m => m.DivisionId)

the TexBoxFor render as
HTML
<input id="DivisionId" name="DivisionId" type="text" value="" />

The TextBoxFor helper uses the lambda expressions that is passed as first argument to calculate the name of the input field. So if you want the generated input field to be called with some Id or name , simply rename the property in your view model
 
Share this answer
 
v3

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900