Is there any way other than Ajax request to autopostback the form when the selectd index of a combobox is changed?
I dont want to perform ajax requests to call the methods explicitly, Isnt there an onchange() attribute which will post the form(this.form.submit()) when the index is changed without clicking the submit button.
Also in my igCombo I cannot define it like this :
THIS DOESNT WORK:
@using (Html.BeginForm()) { @(Html.Infragistics().Combo("comboProducts") // When I supply it with id, I get object not set to an instance of an object exception)
}
THIS WORKS:
@using (Html.BeginForm()){
@(Html.Infragistics().Combo() //This works but I think the ID of / <select> element is not set , rather / <span> gets the id. .InputName("comboProducts") .ID("comboProducts") //is this the same id which gets supplied to .Combo("id")??
) }
--------------------------------------------------
Because of this issue, I think I am also unable to persist the selected value of igCombo on postback.
Please help me out here.
Hello Maya,
I am able to persist the combo selection as well as do autopostback.
For AutoPostback:
I was getting null reference exception when i supplied id like this @(Html.Infragistics().Combo("combo1")
Now I am using this @(Html.Infragistics().Combo().ID("combo1") to set the id & use the Id in delegates as parameter & the form is posting itself back just fine
For Persisting Combo Selection:
The main culprit was : public ActionResult Listing(int[] comboProducts) instead of public ActionResult Listing(string[] comboProducts)
My ValueKey was a string & I was specifying int[] in the [HttpPost] method because i thaught this would get the selected indexes of the combo, rather it gets the ValueKey itself.
Thanks alot for your help & time.
Hello Omer ,
Yes. Both will lead to the same result.
Both:
@(Html.Infragistics().Combo("combo1")
And
@(Html.Infragistics().Combo().ID("combo1")
Will generate a span element with the related id that will be the main Dom element of the combo.
In both cases the selector for the combo would need to be “#combo1”.
Let me know if you have any additional questions.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://es.infragistics.com/support
I dont want to use ComboFor() because this would require me to provide the model using the @model directive at the top.
In my case the igCombo is in a partial View & the parent View is already getting a @model Infragistics.Web.Mvc.GridModel on top therefore I cannot supply it with another comboModel. Therefore I was hoping to do the same thing using @(Html.Infragistics().Combo("Combo1") & supply it with DataSourceUrl instead of DataSource, BUT I cannot set the id of the combo which is causing issues i think.
One quick question:
Is this the same : @(Html.Infragistics().Combo().ID("Combo1") as this : @(Html.Infragistics().Combo("Combo1") ??
I tried this with another View, Its also showing me the same error. I think because i am not able to set the ID I cannot supply the delegates with id too and therefore cannot call them either. You see the delegate get the id as a parameter but if it is not set, I cannot use them:
$(document).delegate("#combo1", "igcombodropdownclosed", function (evt, ui) { ..... }); //Cannot set combo1 as id.
Please check these screenshots also, I tried to make a separate View, but that is also showing the same error.
I dont why but its very strange, I am getting a null reference exception whenever I use @(Html.Infragistics().Combo("combo1") & supply it with id here.
I dont know what is causing this. I have tried this in a separate view as well as a partial view, It throws a "Object not set to an instance of an object" exception everytime.
Please have a look at the screen shot.