3 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 18 Jan 2010, 10:52 AM
Hello Rahul,
Try the following approach in order to show radconfirm when changing the selection in combobox.
aspx:
javascript:
-Shinu.
Try the following approach in order to show radconfirm when changing the selection in combobox.
aspx:
<telerik:RadComboBox ID="RadComboBox4" runat="server" OnClientSelectedIndexChanging="OnClientSelectedIndexChanging"> |
<Items> |
<telerik:RadComboBoxItem Text="Item1" /> |
<telerik:RadComboBoxItem Text="Item2" /> |
<telerik:RadComboBoxItem Text="Item3" /> |
</Items> |
</telerik:RadComboBox> |
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"> |
</telerik:RadWindowManager> |
javascript:
var flag = false; |
var text = ""; |
function OnClientSelectedIndexChanging(sender, args) { |
if (!flag) { |
args.set_cancel(true); |
radconfirm('Are you sure...?', confirmCallBackFn); |
text = args.get_item().get_text(); |
} |
flag = false; |
} |
function confirmCallBackFn(arg) { |
if (arg) { |
var combo = $find('<%=RadComboBox4.ClientID%>'); |
var item = combo.findItemByText(text); |
flag = true; |
item.select(); |
} |
} |
-Shinu.
0
sf
Top achievements
Rank 1
answered on 10 Nov 2010, 07:31 AM
hi Shinu I tried your solution it doesn't work for me because my radcombobox is within a gridtemplatecolumn of radgrid control.
the application complaints that the combobox cannot be found. I need to achieve 2 things:
1. find the combobox so that the solution works in my scenario
2. make the confirmation box only popsup if the selectedvalue of the combobox is "Delete"
if you can help with my headaches it will be great, thanks in advance
the application complaints that the combobox cannot be found. I need to achieve 2 things:
1. find the combobox so that the solution works in my scenario
2. make the confirmation box only popsup if the selectedvalue of the combobox is "Delete"
if you can help with my headaches it will be great, thanks in advance
0
Shinu
Top achievements
Rank 2
answered on 10 Nov 2010, 02:31 PM
Hello,
I modified the code based on your requirement. I hope the following code snippet will help you to achieve your requirement.
Java Script:
Note: The RadComboBox is placed inside the ItemTemplate of GridTemplateColumn.
-Shinu.
I modified the code based on your requirement. I hope the following code snippet will help you to achieve your requirement.
Java Script:
<script type=
"text/javascript"
>
var
flag =
false
;
var
combo;
function
OnClientSelectedIndexChanging(sender, args) {
combo = sender;
text = args.get_item().get_text();
if
(text ==
"Delete"
) {
if
(!flag) {
args.set_cancel(
true
);
radconfirm(
'Are you sure...?'
, confirmCallBackFn);
}
}
flag =
false
;
}
function
confirmCallBackFn(arg) {
if
(arg) {
var
item = combo.findItemByText(
"Delete"
);
flag =
true
;
item.select();
}
}
</script>
-Shinu.