I'm running into some inconsistencies when I use the MVC Helpers to generate my IG controls, as opposed to when I create them in jQuery:
1. When generated through the MVC Helper, none of the IG control's client-side functionality works. For example, if I use the below code in my MVC View...
@Html.Infragistics().CurrencyEditor("test2").Render()
...then enter "45" into the control in my browser...
...and then I try to access the text property in my js file...
var myText = $('#test2').igCurrencyEditor('text')
...myText is a Jquery object, not "45" like you'd expect.
However, if I instantiate the igCurrencyEditor in my js file...
(In MVC View)
<input id="test" />
(In js File)
$('#test').igCurrencyEditor();
var myText = $('#test').igCurrencyEditor('text')
myText is "45", as expected.
2.. The controls generate different html when you instantiate them through MVC or in JS. For example, if I use the below code in my MVC View...
...this is generated:
<input id="test2" style="display: inline-block; text-align: right; " class="ui-igedit-field ui-igedit ui-state-default ui-widget ui-corner-all">
<input name="test2" type="hidden" value="">
Alternatively, if I render in the browser...
(In js file)
<input id="test" style="display: inline-block; text-align: right; " class="ui-igedit-field ui-igedit ui-state-default ui-widget ui-corner-all">
When generated from the MVC Helper, an extra input is rendered. Why is this? Is this related to to question 1? Am I doing this all wrong?
In short, how do I use an MVC Helper, but still have access to the client-side methods, events, and properties of the ig objects?
Hi JoshNoe,
When you are using MVC helpers to instantiate any of the ig editors, it renders igEditor widgets with specific type. That's why you can't access any option, method, or in example bind to any of the events on the client, using $("selector").ig<editortype>Editor("ig<editortype>editor<eventname>", eventHandler). You have all the functionality when you use igEditor to access/modify these options.
In your case:
var myText = $('#test2').igEditor('text'), should work fine.
Here is a link on a topic how to Configure Editors at Runtime
Hope that helps.
Thanks,
Thanks Todor! This works perfectly.
However, I don't see any documentation on this? Even the link you sent me doesn't show any indication that you should use "igEditor" instead of the more specific types when using MVC. If there's some place I can go to see more MVC-specific information like this regarding these controls, please let me know.