English 中文(简体)
选择在降水中的一种选择,取决于通过jquery/ajax在纸箱内的案文
原标题:select an option in a asp dropdown depending on text inside asp textbox via jquery/ajax

I want the user to click on a button called select. This then selects an option in the dropdownlist. The option it selects must be the one that starts with the first 10 characters of the text in the text box.

这是倒数和案文箱。

<asp:DropDownList runat="server" ID="selDealer"></asp:DropDownList>

<a href="#" class="RemoveLink" >Select</a>
Dealer Name: <asp:TextBox ID="RtnDealerName" runat="server"></asp:TextBox>

At the moment the jscript only does a simple alert to test the select link is working.

<script language="javascript" type="text/javascript">
 $(function () {       
         $(".RemoveLink").click(function () {
            alert("Yes");


        });
    });
</script>

在文字中,从案文的头10个特性开始选择降级办法,是什么。

最佳回答
$(".RemoveLink").click(function() {
    var regexpToSearch = new RegExp( $("#<%= RtnDealerName.ClientID %>").val().substring(0,10),  i );

    var optionToSelect = $("#<%= selDealer.ClientID %> option").filter(function(index) {
        return this.innerText.search(regexpToSearch) != -1;
    }).first();

    if(optionToSelect.length != 0){
        $("#<%= selDealer.ClientID %>").val(optionToSelect.val());
    }
});

对照选择变更表述的最后10个特点,核对案文箱中的最后10个特性,以建立登记册 如下:

    var selDealerText = $("#<%= RtnDealerName.ClientID %>").val();
    var regexpToSearch = new RegExp(selDealerText.substring(Math.max(selDealerText.length - 10, 0)) +  $ ,  i );
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签