Click here to Skip to main content
15,892,298 members

Comments by xhon (Top 32 by date)

xhon 23-Jan-21 12:32pm View    
Thanks Peter.
As regards the event handler, I assume that I also need to specify this.OnLoad, is it correct? Or is there a way to tell JS that it's an OnLOad event from CRM/Ribbon workbench configuration?

I update the code as below, I'm not sure if I'm using the override of the OnLoad method correctly here:


function hideButton(executionContext) {
var executionContext = executionContext.getFormContext();
var formContext = executionContext.getFormContext();
var state = formContext.getAttribute("statecode").getValue();

this.OnLoad(executionContext){
if (state.getValue() == 1) {
document.getElementById("button_id").setDisabled(true);
}
else {
document.getElementById("button_id").setDisabled(false);
}

}

}

xhon 22-Jan-21 12:29pm View    
Hi, ok, I corrected the tags, thanks.
xhon 4-Dec-20 7:24am View    
thank you for commenting. I implemented the following action on my Controller:

public ActionResult getByDirector()
{
List<movie> movies = _movieProxy.GetByDirector();
return View (movies);
}


Then I added the following in my Index View, a JS function which calls the method above:

function searchFunction()
{
var url = "@Url.Action("GetByDirector");

$.get(url, function (data)
{
$("#newDivTag" ).html('$' + data); // I created this new div to contain the results
});
}


Then I wrote the following:

$.ajax({
Type: "GET",
contentType: "application/json; charset=utf=8",
url: "/MovieMvc/GetByDirector",
success: function (data) { successCallBack(data); },
error: function(data) { failureCallBack(data); }
});

Does it make sense?
xhon 2-Dec-20 8:29am View    
thanks
xhon 30-Nov-20 13:14pm View    
I know how to implement constructor and method injection (I used constructor injection in the code above, see the second block of code that I posted before), I apologize if my question wasn't clear. My Q was about the difference between using dependency injection and using dependency injection with Unity, I don't understand what would be the benefit of using Unity, configuring the classes in Unity to inject them, as it seems to me it can be even done without (As you said, DI can be as simple as having a constructor accepting parameters)