Hi
Anybody can help me how to change combobox selected value from another combobox selected value when click button (Copy from Mailing). I would like to publish my code and attached with image what i want to do. Appreciate for any help.
Client Side
(
function bindEventHandlers() {
$telerik.$('#btnCopyFromBilling').unbind('click').bind('click', function () {
oncopyfrombilling('COPYBILLING');
});
$telerik.$('#btnCopyFromMailing').unbind('click').bind('click', function () {
oncopyfrombilling('COPYMAILING');
});
}
function selectRadComboboxByValue(radcombo, value) {
radcombo.set_selectedIndex(value);
debugger
}
function oncopyfrombilling(args) {
var txtAreaBillingAddress = $get('<%=txtAreaBillingAddress.ClientID%>');
var ddlBillingRegion = $find('<%=ddlBillingRegion.ClientID%>');
var ddlBillingCity = $find('<%=ddlBillingCity.ClientID%>');
var txtBillingPostal = $get('<%=txtBillingPostal.ClientID%>');
var ddlBillingCountry = $find('<%=ddlBillingCountry.ClientID%>');
var txtAreaMailingAddress = $get('<%=txtAreaMailingAddress.ClientID%>');
var ddlMailingRegion = $find('<%=ddlMailingRegion.ClientID%>');
var ddlMailingCity = $find('<%=ddlMailingCity.ClientID%>');
var txtMailingPostal = $get('<%=txtMailingPostal.ClientID%>');
var ddlMailingCountry = $find('<%=ddlMailingCountry.ClientID%>');
if (args === 'COPYMAILING') {
alert(args);
txtAreaBillingAddress.value = txtAreaMailingAddress.value;
ddlBillingRegion.set_value(ddlMailingRegion.get_value());
ddlBillingCity.set_value(ddlMailingCity.get_value());
txtBillingPostal.value = txtMailingPostal.value;
ddlBillingCountry.set_value(ddlMailingCountry.get_value());
}
else if (args === 'COPYBILLING') {
txtAreaMailingAddress.value = txtAreaMailingAddress.value;
ddlMailingRegion.set_value(ddlBillingRegion.get_value());
ddlMailingRegion.set_value(ddlBillingCity.get_value());
ddlMailingRegion.value = txtBillingPostal.value;
ddlMailingRegion.set_value(ddlBillingCountry.get_value());
}
)
ASPX
(
<div class="divStatusAddressFieldSet" id="BillingMailing">
<div class="divEmptyRow">
</div>
<fieldset class="longestFieldset">
<legend>
<u>5</u>. Billing Address
</legend>
<div class="divFormControls">
<div class="divText">
</div>
<div class="divInput">
<input type="button" id="btnCopyFromMailing" value="Copy from Mailing (X) " />
</div>
</div>
<div class="divLongFormControls">
<div class="divText">
<label>
Address
</label>
</div>
<div class="divInput">
<textarea id="txtAreaBillingAddress" runat="server" style="height: 95%; width: 96%"></textarea>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Region
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlBillingRegion" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="Region" Width="100%" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblRegion" runat="server" Text="Region" Font-Bold="true" Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
<%-- <telerik:RadDropDownList ID="ddlBillingRegion" runat="server"></telerik:RadDropDownList>--%>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
City
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlBillingCity" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="City" Width="100%" Height="300px" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblBillingCity" runat="server" Text="City" Font-Bold="true" Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
<%-- <telerik:RadDropDownList ID="ddlBillingCity" runat="server"></telerik:RadDropDownList>--%>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Postal/Zip code
</label>
</div>
<div class="divInput">
<input type="text" id="txtBillingPostal" runat="server" />
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Country
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlBillingCountry" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="Country" Width="100%" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblGuestCountry" runat="server" Text="Nationality" Font-Bold="true"
Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
<%-- <telerik:RadDropDownList ID="ddlBillingCountry" runat="server" ></telerik:RadDropDownList>--%>
</div>
</div>
</fieldset>
<div class="divEmptyRow">
</div>
<fieldset class="longestFieldset">
<legend>
<u>6</u>. Mailing Address
</legend>
<div class="divFormControls">
<div class="divText">
</div>
<div class="divInput">
<input type="button" id="btnCopyFromBilling" value="Copy from billing (Y) " />
</div>
</div>
<div class="divLongFormControls">
<div class="divText">
<label>
Address
</label>
</div>
<div class="divInput">
<textarea id="txtAreaMailingAddress" runat="server" style="height: 95%; width: 96%"></textarea>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Region
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlMailingRegion" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="Region" Width="100%" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblRegion" runat="server" Text="Region" Font-Bold="true" Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
City
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlMailingCity" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="City" Width="100%" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblMainlingCity" runat="server" Text="City" Font-Bold="true" Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Postal/Zip code
</label>
</div>
<div class="divInput">
<input type="text" id="txtMailingPostal" runat="server" />
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Country
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlMailingCountry" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="Country" Width="100%" Height="300px" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblMailingCountry" runat="server" Text="Nationality" Font-Bold="true"
Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
</div>
</div>
</fieldset>
</div>
)
Anybody can help me how to change combobox selected value from another combobox selected value when click button (Copy from Mailing). I would like to publish my code and attached with image what i want to do. Appreciate for any help.
Client Side
(
function bindEventHandlers() {
$telerik.$('#btnCopyFromBilling').unbind('click').bind('click', function () {
oncopyfrombilling('COPYBILLING');
});
$telerik.$('#btnCopyFromMailing').unbind('click').bind('click', function () {
oncopyfrombilling('COPYMAILING');
});
}
function selectRadComboboxByValue(radcombo, value) {
radcombo.set_selectedIndex(value);
debugger
}
function oncopyfrombilling(args) {
var txtAreaBillingAddress = $get('<%=txtAreaBillingAddress.ClientID%>');
var ddlBillingRegion = $find('<%=ddlBillingRegion.ClientID%>');
var ddlBillingCity = $find('<%=ddlBillingCity.ClientID%>');
var txtBillingPostal = $get('<%=txtBillingPostal.ClientID%>');
var ddlBillingCountry = $find('<%=ddlBillingCountry.ClientID%>');
var txtAreaMailingAddress = $get('<%=txtAreaMailingAddress.ClientID%>');
var ddlMailingRegion = $find('<%=ddlMailingRegion.ClientID%>');
var ddlMailingCity = $find('<%=ddlMailingCity.ClientID%>');
var txtMailingPostal = $get('<%=txtMailingPostal.ClientID%>');
var ddlMailingCountry = $find('<%=ddlMailingCountry.ClientID%>');
if (args === 'COPYMAILING') {
alert(args);
txtAreaBillingAddress.value = txtAreaMailingAddress.value;
ddlBillingRegion.set_value(ddlMailingRegion.get_value());
ddlBillingCity.set_value(ddlMailingCity.get_value());
txtBillingPostal.value = txtMailingPostal.value;
ddlBillingCountry.set_value(ddlMailingCountry.get_value());
}
else if (args === 'COPYBILLING') {
txtAreaMailingAddress.value = txtAreaMailingAddress.value;
ddlMailingRegion.set_value(ddlBillingRegion.get_value());
ddlMailingRegion.set_value(ddlBillingCity.get_value());
ddlMailingRegion.value = txtBillingPostal.value;
ddlMailingRegion.set_value(ddlBillingCountry.get_value());
}
)
ASPX
(
<div class="divStatusAddressFieldSet" id="BillingMailing">
<div class="divEmptyRow">
</div>
<fieldset class="longestFieldset">
<legend>
<u>5</u>. Billing Address
</legend>
<div class="divFormControls">
<div class="divText">
</div>
<div class="divInput">
<input type="button" id="btnCopyFromMailing" value="Copy from Mailing (X) " />
</div>
</div>
<div class="divLongFormControls">
<div class="divText">
<label>
Address
</label>
</div>
<div class="divInput">
<textarea id="txtAreaBillingAddress" runat="server" style="height: 95%; width: 96%"></textarea>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Region
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlBillingRegion" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="Region" Width="100%" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblRegion" runat="server" Text="Region" Font-Bold="true" Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
<%-- <telerik:RadDropDownList ID="ddlBillingRegion" runat="server"></telerik:RadDropDownList>--%>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
City
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlBillingCity" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="City" Width="100%" Height="300px" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblBillingCity" runat="server" Text="City" Font-Bold="true" Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
<%-- <telerik:RadDropDownList ID="ddlBillingCity" runat="server"></telerik:RadDropDownList>--%>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Postal/Zip code
</label>
</div>
<div class="divInput">
<input type="text" id="txtBillingPostal" runat="server" />
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Country
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlBillingCountry" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="Country" Width="100%" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblGuestCountry" runat="server" Text="Nationality" Font-Bold="true"
Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
<%-- <telerik:RadDropDownList ID="ddlBillingCountry" runat="server" ></telerik:RadDropDownList>--%>
</div>
</div>
</fieldset>
<div class="divEmptyRow">
</div>
<fieldset class="longestFieldset">
<legend>
<u>6</u>. Mailing Address
</legend>
<div class="divFormControls">
<div class="divText">
</div>
<div class="divInput">
<input type="button" id="btnCopyFromBilling" value="Copy from billing (Y) " />
</div>
</div>
<div class="divLongFormControls">
<div class="divText">
<label>
Address
</label>
</div>
<div class="divInput">
<textarea id="txtAreaMailingAddress" runat="server" style="height: 95%; width: 96%"></textarea>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Region
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlMailingRegion" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="Region" Width="100%" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblRegion" runat="server" Text="Region" Font-Bold="true" Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
City
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlMailingCity" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="City" Width="100%" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblMainlingCity" runat="server" Text="City" Font-Bold="true" Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Postal/Zip code
</label>
</div>
<div class="divInput">
<input type="text" id="txtMailingPostal" runat="server" />
</div>
</div>
<div class="divFormControls">
<div class="divText">
<label>
Country
</label>
</div>
<div class="divInput">
<telerik:RadComboBox ID="ddlMailingCountry" runat="server" Skin="Default" ShowDropDownOnTextboxClick="true"
EmptyMessage="Country" Width="100%" Height="300px" Font-Size="11px" EnableLoadOnDemand="true">
<HeaderTemplate>
<asp:Label ID="lblMailingCountry" runat="server" Text="Nationality" Font-Bold="true"
Font-Size="11px"></asp:Label>
</HeaderTemplate>
</telerik:RadComboBox>
</div>
</div>
</fieldset>
</div>
)