
Hari Prasad
Top achievements
Rank 1
Hari Prasad
asked on 26 Jun 2012, 10:24 AM
Hi,
I have combo box, im loading the item on load demand. I have client selected index changed event, if i type exact text(case sensitive) and when i come out of the combobox and clicked on out side of the combobox,onclientselectedindexchanged event is firing. I don't want to fire this event when exact match is found. I want user to select the item from the combobox list then only i want this event to be fire.
I have
Attachment2 is not firing the event.
Please let me know the solution for this. If this is the default behaviour of the combobox, are there any work arounds for the solution.
Thanks in Advance,
Hari.
I have combo box, im loading the item on load demand. I have client selected index changed event, if i type exact text(case sensitive) and when i come out of the combobox and clicked on out side of the combobox,onclientselectedindexchanged event is firing. I don't want to fire this event when exact match is found. I want user to select the item from the combobox list then only i want this event to be fire.
I have
MarkFirstMatch
="false"
Attachment1 is firing the event.
Attachment2 is not firing the event.
Please let me know the solution for this. If this is the default behaviour of the combobox, are there any work arounds for the solution.
Thanks in Advance,
Hari.
5 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 26 Jun 2012, 12:40 PM
Hi,
Try the following Javascript to achieve your scenario.
JS:
Thanks,
Princy.
Try the following Javascript to achieve your scenario.
JS:
<script type=
"text/javascript"
>
function
OnClientBlur(sender, args)
{
sender.clearSelection();
}
</script>
Thanks,
Princy.
0

Hari Prasad
Top achievements
Rank 1
answered on 26 Jun 2012, 01:21 PM
Hi Princy,
Thanks for your quick reply.
Is it possible to do without clearing the selection. I have typed "dotnet se" and i will come out of the combobox, then its clearing the combobox item. I would like to be text should exist in the combo box when i come out of the combo box.
Thanks in Advance,
Hari.
Thanks for your quick reply.
Is it possible to do without clearing the selection. I have typed "dotnet se" and i will come out of the combobox, then its clearing the combobox item. I would like to be text should exist in the combo box when i come out of the combo box.
Thanks in Advance,
Hari.
0

Princy
Top achievements
Rank 2
answered on 27 Jun 2012, 07:47 AM
Hi HariPrasad,
Yes its possible without clearing the selection as well.
Try the following JS and it worked as expected.First add a asp:hiddenfield to the aspx
aspx:
JS:
Thanks,
Princy.
Yes its possible without clearing the selection as well.
Try the following JS and it worked as expected.First add a asp:hiddenfield to the aspx
aspx:
<
asp:HiddenField
ID
=
"HiddenField1"
runat
=
"server"
/>
<script type=
"text/javascript"
>
function
OnClientBlur()
{
var
combobox = $find(
'<%=RadComboBox1.ClientID%>'
);
var
combotxt = combobox._text;
var
items = combobox.get_items();
var
itemsCount = items._array.length;
for
(
var
itemIndex = 0; itemIndex < itemsCount; itemIndex++)
{
var
itemtxt = items._array[itemIndex]._text;
if
(combotxt == itemtxt)
{
var
hidfield = document.getElementById(
'<%=HiddenField1.ClientID%>'
);
hidfield.value =
"1"
;
}
}
}
function
OnClientSelectedIndexChanged()
{
var
hidfield = document.getElementById(
'<%=HiddenField1.ClientID%>'
);
if
(hidfield.value ==
"1"
)
{
return
false
;
}
else
{
//your code......
}
}
</script>
Thanks,
Princy.
0

Hari Prasad
Top achievements
Rank 1
answered on 27 Jun 2012, 10:04 AM
It worked. Thanks for your help.
If we type exact match, then Combobox client selected index changed event is firing. Is this the Default behaviour of the Rad Combo Box?
Thanks,
Hari.
If we type exact match, then Combobox client selected index changed event is firing. Is this the Default behaviour of the Rad Combo Box?
Thanks,
Hari.
0

Princy
Top achievements
Rank 2
answered on 28 Jun 2012, 05:44 AM
Hi HariPrasad,
You can cancel the OnClientSelectedIndexChanging event as follows which doesn't allow to fire OnClientSelectedIndexChanged event of RadComboBox.
JS:
Hope this helps.
Thanks,
Princy.
You can cancel the OnClientSelectedIndexChanging event as follows which doesn't allow to fire OnClientSelectedIndexChanged event of RadComboBox.
JS:
<script type=
"text/javascript"
>
function
OnClientBlur() {
var
combobox = $find(
'<%=RadComboBox1.ClientID%>'
);
var
combotxt = combobox._text;
var
items = combobox.get_items();
var
itemsCount = items._array.length;
for
(
var
itemIndex = 0; itemIndex < itemsCount; itemIndex++) {
var
itemtxt = items._array[itemIndex]._text;
if
(combotxt == itemtxt) {
var
hidfield = document.getElementById(
'<%=HiddenField1.ClientID%>'
);
hidfield.value =
"1"
;
}
}
}
function
OnClientSelectedIndexChanging(sender,args) {
debugger;
var
hidfield = document.getElementById(
'<%=HiddenField1.ClientID%>'
);
if
(hidfield.value ==
"1"
) {
hidfield.value =
"0"
;
args.set_cancel(
true
);
return
false
;
}
else
{
//your code......
}
}
</script>
Hope this helps.
Thanks,
Princy.