Apr 10, 2012, 3:54 PM
[CLOSED] Get value from textfield in controller [Razor]
When using direct click on button i can get value form one textfield in controller, but when use direct click in button on window value of textbox is null.
This is a textfield:
But in this example where I only use Window it is not work:
For both examples I put razor code in BeginForm
This is a textfield:
@Html.X().TextField().ID("tfID").FieldLabel("Labela 23").Text("Some text ...")
This example works:@(Html.X().Button()
.ID("btnID2")
.Text("Direct event 2")
.DirectEvents(directEvents =>
{
directEvents.Click.Url = "/Account/TestMethod";
})
)
and controller:public ActionResult TestMethod(string tfID)
{
AjaxResult r = new AjaxResult();
r.Script = X.Msg.Alert("", "Vrednost: " + tfID).ToScript();
return r;
}
But in this example where I only use Window it is not work:
@(Html.X().Window().ID("WindowLogIn")
.Layout(LayoutType.Anchor)
.Width(300)
.Height(150)
.Title("Test")
.Items(item =>
{
item.Add(Html.X().Button().ID("ButtonPrijava").Text("Prijavi me").DirectEvents(directEvents => { directEvents.Click.Url = "/Account/TestMethod"; }));
})
)
For both examples I put razor code in BeginForm
@using (Html.BeginForm())
{
}
Can you help me to handle this data from textbox in controller.
Last edited by Daniil; Apr 16, 2012 at 11:53 AM.
Reason: [CLOSED]