asp.net中选择数字时,另外的数字同时发生变化(适用dev控件)
关键:
<ClientSideEvents ValueChanged="AgioChanged" />
<div class="col-sm-4"> <div class="form-group"> <label>折扣前价(¥)</label> <dx:ASPxSpinEdit ID="edTab3_agioagoprice" ClientInstanceName="edTab3_agioagoprice" runat="server" DisplayFormatString="¥{0:0.00}" Text='<%# Eval("AGIOAGOPRICE")%>' Width="100%" MinValue="0" MaxValue="999999999" LargeIncrement="1"> <SpinButtons ShowIncrementButtons="False" ShowLargeIncrementButtons="True" /> <ClientSideEvents ValueChanged="AgioPriceChanged" /> </dx:ASPxSpinEdit> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>普通折扣(%)</label> <dx:ASPxSpinEdit ID="edTab3_agio" ClientInstanceName="edTab3_agio" runat="server" DisplayFormatString="{0:0}%" Text='<%# Eval("AGIO")%>' Width="100%" MinValue="0" MaxValue="100" LargeIncrement="1"> <SpinButtons ShowIncrementButtons="False" ShowLargeIncrementButtons="True" /> <ClientSideEvents ValueChanged="AgioChanged" /> </dx:ASPxSpinEdit> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>折扣普通价(¥)</label> <dx:ASPxSpinEdit ID="edTab3_aprice" ClientInstanceName="edTab3_aprice" runat="server" DisplayFormatString="C" Text='<%# Eval("APRICE")%>' Width="100%" MinValue="0" MaxValue="999999999" LargeIncrement="1"> <SpinButtons ShowIncrementButtons="False" ShowLargeIncrementButtons="True" /> </dx:ASPxSpinEdit> </div> </div>
js:
//折扣前价格值改变时 function AgioPriceChanged() { var agioagoprice = edTab3_agioagoprice.GetValue();//折扣前 价格 edTab3_agioagoprice var agio = edTab3_agio.GetValue();//折扣 edTab3_agio var aprice = agioagoprice * (agio / 100);//折扣普通价 edTab3_aprice edTab3_aprice.SetValue(aprice); }; //折扣值改变时 function AgioChanged() { var agioagoprice = edTab3_agioagoprice.GetValue();//折扣前 价格 var agio = edTab3_agio.GetValue();//折扣 var aprice = agioagoprice * (agio / 100); edTab3_aprice.SetValue(aprice);//折扣普通价 };
我还是会相信,星星会说话,石头会开花,穿过夏天的栅栏和冬天的风雪过后,你终会抵达。