PDA

View Full Version : [CLOSED] [MVC] Set Tag proprties on button with AjaxResult



Tactem
Sep 09, 2013, 4:07 PM
Hi guys,

i have a button, i have a default value, when i change tag value in ajaxresult, tag properties in my button isn't refresh in javascript

Button config


Button disPlayPathButton = new Button();
disPlayPathButton.ID = "DisPlayPathButton";
disPlayPathButton.Icon = Icon.Comment;
disPlayPathButton.Width = 25;
disPlayPathButton.DirectEvents.Click.Action = "ShowCompleteBusiPath";
disPlayPathButton.DirectEvents.Click.ExtraParams.A dd(new Parameter("path", "item.initialConfig.tag", ParameterMode.Raw));
disPlayPathButton.Tag = path != string.Empty ? path : ".";

Ajax Result


public AjaxResult ShowReturnBusiPath(int idNode)
{
TIOMembershipUser currentUser = _memberShipService.GetUser();
string path = string.Empty;
var buttonPath = X.GetCmp<Button>("DisPlayPathButton");
var data = _treeNodeService.GetBusinessGeoById(currentUser.Us erInfos.GroupId, 2502, idNode, 1, ref path);
if (data.Count > 0)
{
buttonPath.Tag = path;
}
return new AjaxResult();
}

Regards

Daniil
Sep 10, 2013, 4:18 AM
Hi @Tactem,

I cannot reproduce with this test case.

View

@{
var X = Html.X();
}

<!DOCTYPE html>
<html>
<head>
<title>Ext.Net.MVC v2 Example</title>
</head>
<body>
@X.ResourceManager()

@X.Button().ID("Button1").Text("Change my Tag").Tag("initial tag").DirectClickAction("ChangeTag")

@X.Button().Text("Show Tag").Handler("alert(App.Button1.tag);")
</body>
</html>


Controller Action

public ActionResult ChangeTag()
{
(X.GetCmp<Ext.Net.Button>("Button1")).Tag = "new tag";
return new AjaxResult();
}

Tested with the SVN trunk.

Tactem
Sep 10, 2013, 7:29 AM
it's better with
App.Button1.tag than
item.initialConfig.tag

Thanks Daniil