Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1845
MVC Helper Controls different than jQuery-created Controls
posted

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();

...then enter "45" into the control in my browser...

...and then I try to access the text property in my js file...

  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...

  @Html.Infragistics().CurrencyEditor("test2").Render()

...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 MVC View)

  <input id="test" />

(In js file)

  $('#test').igCurrencyEditor();

...this is generated:

<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?

 

 

 

 

 

 

Parents Reply Children
No Data