Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by kiko on Jul 30, 2008 11:34
open dhtmlx forum
dhtmlcombo and C#

I get an ClientScriptManager.RegisterForEventValidation error when I use dhtmlxcombo with c#. I use the loadxml with a drop downlist function to set the drop down list options. but when I select a value i get an error that says to set EnableEventValidation="false". And no values are in the dropdownlist selected item. I even registered the script :


<asp:DropDownList ID="drpInvLname" runat="server" AutoPostBack="true" OnSelectedIndexChanged="LastName_Change" Width="200px"></asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvInvLname" runat="server" ErrorMessage="Last Name Required" InitialValue="-1" ControlToValidate="drpInvLname"></asp:RequiredFieldValidator>
<script type="text/javascript">

        var z2;
        
        if(browserType()){
        z2 = dhtmlXComboFromSelect("ctl00_leftcolcontent_drpInvLname");
        z2.loadXML("investors.aspx?cmd=test");
        }
        else{
        z2 = dhtmlXComboFromSelect("ctl00$leftcolcontent$drpInvLname");
        z2.loadXML("investors.aspx?cmd=test");}
        
        z2.enableFilteringMode(true);
</script>
<script type="text/javascript">
        function doOnLoad(){
            var z=new dhtmlXCombo("combo_zone","alfa",200);
            z.enableFilteringMode(true,"investors.aspx?cmd=test",true,true);
        }
    </script>
Answer posted by Support on Jul 31, 2008 05:08
When select box converted to the combo, it creates two input fileds ( one has the same name as combo, second one shows is provided value was selected from the list , or it is a new text. )
The .Net code throws error because count of parameters returned from client differs from expected one. You may disable such check in asp code , or update dhtmlxcombo in next way

locate
   self.DOMelem.appendChild(z);
   self.DOMelem_hidden_input2 = z;

and comment first line
//   self.DOMelem.appendChild(z);
   self.DOMelem_hidden_input2 = z;