This is a migrated thread and some comments may be shown as answers.

ComboBox And WebService

2 Answers 83 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Babak
Top achievements
Rank 1
Babak asked on 01 Jun 2014, 12:29 PM
Hi . 
I have 3 control in a form , 
2  Radcombobox and a button . 
the first radcombobox binded to webservice and the second bind in server side code .
both radcomboboxes have AutoPostback="true" attribute . 
when I choose an item from the first combo the second bind with item that selected from the first combo . 
but I have problem when I choose an item from the second combo and do post back . after post back it seems that the first combo box dose not have any item selected. 
I write a custome validation in clientside code that checked the value of first combo . after second combobox post back the customevalidator return null .
function ClientValidate_<%= this.ClientID %>(source, args) {
            var combo = $find("<%= ExComboControl.ClientID %>");
            if (combo.get_enabled()) {
                args.IsValid = false;
                var text = combo.get_text();
                if (text.length < 1) {
                    args.IsValid = false;
                    combo.set_emptyMessage("Please choose an Item");
                }
                else {
                    combo.trackChanges();
                    console.log(text);
                    var node = combo.findItemByText(text);
                    console.log(node);
                    var inputElement = combo.get_inputDomElement();
                    console.log(inputElement);
                    if (node) {
                        args.IsValid = true
                        args.IsValid = false;
                        inputElement.style.color = "black";
                    }
                    else {
                        args.IsValid = false;
                        inputElement.style.color = "#FF0000";
                    }
                }
            }
        }
 

2 Answers, 1 is accepted

Sort by
0
SANJAY
Top achievements
Rank 1
answered on 01 Jun 2014, 12:53 PM
Hi Babak
I understand you have written the client code only to check on the Combo Box

1. Please check if you have some thing written on the page_load event which is not with "If Not IsPostBack"
2. Probably when you are loading the second combo you are clearing the first combo
3, If you code is on Items_Requested event then on the AJAX call probably the first combo is clearing off
4. If it is ok please post your code


Regards


Sanjay
0
Shinu
Top achievements
Rank 2
answered on 02 Jun 2014, 05:21 AM
Hi Babak,

With reference to this help documentation RadComboBox items loaded on demand using the ItemsRequested event handler or WebService do not exist on the server and cannot be accessed using the server-side FindItemByText / Value methods. The properties that are accessible on the server are Text and SelectedValue.

Let me know if you have any concern.
Thanks,
Shinu.
Tags
ComboBox
Asked by
Babak
Top achievements
Rank 1
Answers by
SANJAY
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or