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

Two Comboboxes

1 Answer 68 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
aabdan
Top achievements
Rank 1
aabdan asked on 12 Jan 2009, 11:20 AM

 

I am setting the same datasource for two comboboxes. If I selected any value in one combo box the same value is reflected in other combobox also.can anyone help to do this issue.

Thanks
LPW

1 Answer, 1 is accepted

Sort by
0
aabdan
Top achievements
Rank 1
answered on 12 Jan 2009, 12:41 PM
i  found the solution if any body want it,

 

 

<

 

script type="text/jscript">

 

 

 

 

 

 

 

 

 

 

function OnClientSelectedIndexChangedValue(sender, args)

 

{

 

var combo = $find("<%= RadComboBoxDescription.ClientID %>");

 

 

var item = args.get_item();

 

 

var i = item.get_index();

 

 

 

if (item.get_value() != combo.get_value())

 

combo.get_items().getItem(i).select();

}

 

 

function OnClientSelectedIndexChangedDescription(sender, args)

 

{

 

var combo = $find("<%= RadComboBoxValue.ClientID %>");

 

 

var item = args.get_item();

 

 

var i = item.get_index();

 

 

 

if (item.get_value() != combo.get_value())

 

combo.get_items().getItem(i).select();

}

 

 

 

 

 

function ClientValidate<%= CVRadComboBoxValue.ClientID %>(source, arguments)

 

{

 

var comboValue = <%= RadComboBoxValue.ClientID %>;

 

 

var StrItemText = '<%= RadComboBoxValue.FindItemByValue("-1").Text %>'

 

 

 

 

 

 

var StrItemText2 = '<%= RadComboBoxValue.FindItemByValue("-2").Text %>'

 

 

 

 

 

 

 

if (StrItemText == arguments.Value || StrItemText2 == arguments.Value )

 

{

arguments.IsValid =

false;

 

 

return false;

 

}

arguments.IsValid =

true;

 

 

return true;

 

}

 

 

 

</

 

script>

 

<

 

table style="width: 350px">

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

<td style="width: 100px">

 

 

 

 

 

 

<telerik:RadComboBox ID="RadComboBoxValue" runat="server" OnClientSelectedIndexChanged="OnClientSelectedIndexChangedValue"

 

 

 

 

 

 

Height="190px" HighlightTemplatedItems="True" MarkFirstMatch="True" AppendDataBoundItems="True"

 

 

 

 

 

 

Skin="WebBlue" CausesValidation="False">

 

 

 

 

 

 

<CollapseAnimation Duration="200" Type="OutQuint" />

 

 

 

 

 

 

</telerik:RadComboBox>

 

 

 

 

 

 

</td>

 

 

 

 

 

 

<td style="width: 100px">

 

 

 

 

 

 

<telerik:RadComboBox ID="RadComboBoxDescription" runat="server" OnClientSelectedIndexChanged="OnClientSelectedIndexChangedDescription"

 

 

 

 

 

 

Height="190px" HighlightTemplatedItems="True" MarkFirstMatch="True" AppendDataBoundItems="True"

 

 

 

 

 

 

Skin="WebBlue" CausesValidation="False">

 

 

 

 

 

 

<CollapseAnimation Duration="200" Type="OutQuint" />

 

 

 

 

 

 

</telerik:RadComboBox>

 

 

 

 

 

 

</td>

 

 

 

 

 

 

<td style="width: 100px">

 

 

 

 

 

 

<asp:CustomValidator ID="CVRadComboBoxValue" runat="server" ControlToValidate="RadComboBoxValue"

 

 

 

 

 

 

ErrorMessage="Required" EnableClientScript="true"></asp:CustomValidator></td>

 

 

 

 

 

 

</tr>

 

</

 

table>


Regards,

 

Tags
ComboBox
Asked by
aabdan
Top achievements
Rank 1
Answers by
aabdan
Top achievements
Rank 1
Share this question
or