本文介绍了删除文本控件中的垃圾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将更新面板与asp.net结合使用,它在文本控件中带来了垃圾值,如何从中删除垃圾?

下面的代码

i m using update panel with asp.net it brings garbage values in text controlls how to remove garbage from it ??

code below

<asp:UpdatePanel ID="up_gvBenefit" runat="server" UpdateMode="Conditional">
                   <ContentTemplate>

             <div id="div_benefit" runat="server">
               <table id="tblBeneFits" cellpadding="3px">
                   <tr>
                       <td>
                           <asp:Label ID="lblBenefitType" runat="server" Text="Benefit Type"></asp:Label>
                       </td>

                       <td>

                           <asp:DropDownList ID="ddlBenefitTypes" runat="server" Width="200px"

                            onchange="ddl_change();">
                           </asp:DropDownList>
                       </td>
                       <td>
                           <div id="vehicle" onclick="clearVehicle();">
                           <asp:Button ID="btnAddVehicle" runat="server" Text="Add" CssClass="btns" />
                          </div>

                          <div id="Fuel" onclick="ClearFuel();">
                           <asp:Button ID="btnAddFuel" runat="server"    Text="Add" CssClass="btns"/>
                         </div>

                          <div id="VMT" onclick="ClearVMA();">
                           <asp:Button ID="btnAddVMT" runat="server"     Text="Add" CssClass="btns"/>
                          </div>

                          <div id="mobile" onclick="ClearMobile();">
                           <asp:Button ID="btnAddMobile" runat="server"  Text="Add" CssClass="btns"/>
                           </div>

                          <div id="MAT" onclick="ClearMAT();">
                           <asp:Button ID="btnAddMAT" runat="server"     Text="Add" CssClass="btns"/>
                           </div>


</ContentTemplate>
</asp:UpdatePanel>


</ContentTemplate>
</asp:UpdatePanel>

function ddl_change() {


             var val = document.getElementById('MainContent_TabContainer1_tabBenefits_ddlBenefitTypes').value;


             var vehicle = 'MainContent_TabContainer1_tabBenefits_btnAddVehicle';
             var fuel = 'MainContent_TabContainer1_tabBenefits_btnAddFuel';
             var vma = 'MainContent_TabContainer1_tabBenefits_btnAddVMT';
             var mobile = 'MainContent_TabContainer1_tabBenefits_btnAddMobile'
             var ma = 'MainContent_TabContainer1_tabBenefits_btnAddMAT';



             switch (val) {

                 case '1':

                     document.getElementById(vehicle).style.display = 'block';
                     document.getElementById(fuel).style.display = 'none';
                     document.getElementById(vma).style.display = 'none';
                     document.getElementById(mobile).style.display = 'none';
                     document.getElementById(ma).style.display = 'none';
                     break;

                 case '2':
                     //get_Regno();
                     document.getElementById(vehicle).style.display = 'none';
                     document.getElementById(fuel).style.display = 'block';
                     document.getElementById(vma).style.display = 'none';
                     document.getElementById(mobile).style.display = 'none';
                     document.getElementById(ma).style.display = 'none';



                     break;

                 case '3':
                     document.getElementById(vehicle).style.display = 'none';
                     document.getElementById(fuel).style.display = 'none';
                     document.getElementById(vma).style.display = 'block';
                     document.getElementById(mobile).style.display = 'none';
                     document.getElementById(ma).style.display = 'none';
                     break;



                 case '4':

                     document.getElementById(vehicle).style.display = 'none';
                     document.getElementById(fuel).style.display = 'none';
                     document.getElementById(vma).style.display = 'none';
                     document.getElementById(mobile).style.display = 'block';
                     document.getElementById(ma).style.display = 'none';
                     break;

                 case '5':
                     document.getElementById(vehicle).style.display = 'none';
                     document.getElementById(fuel).style.display = 'none';
                     document.getElementById(vma).style.display = 'none';
                     document.getElementById(mobile).style.display = 'none';
                     document.getElementById(ma).style.display = 'block';
                     break;

                 default:
                     alert('out');
                     break;

             }


:omg:


:omg:

推荐答案


这篇关于删除文本控件中的垃圾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 19:41