专栏首页张善友的专栏使用json 和jQuery制作级联dropdownlist

使用json 和jQuery制作级联dropdownlist

联动式的下拉选择是一个很普遍的需求,在ASP.NET MVC中可以使用Json和jQuery来实现,更简单的是使用jQuery的级联插件CascadingDropDown ,具体参见文章http://weblogs.asp.net/rajbk/archive/2010/05/20/cascadingdropdown-jquery-plugin-for-asp-net-mvc.aspx

   1: $(targetID).CascadingDropDown(sourceID, actionPath, settings) 
   2:  
   3: •targetID 
   4: The ID of the select list that will auto populate.  
   5:  
   6: •sourceID 
   7: The ID of the select list, which, on change, causes the targetID to auto populate. 
   8:  
   9: •actionPath 
  10: The url to post to 
  11: Options
  12:  
  13: •promptText 
  14: Text for the first item in the select list 
  15: Default : -- Select -- 
  16:  
  17: •loadingText 
  18: Optional text to display in the select list while it is being loaded. 
  19: Default : Loading.. 
  20:  
  21: •errorText 
  22: Optional text to display if an error occurs while populating the list 
  23: Default: Error loading data. 
  24:  
  25: •postData 
  26: Data you want posted to the url in place of the default 
  27: Example : 
  28: postData: function () { 
  29:     return { prefix: $('#txtPrefix').val(), customerID: $('#customerID').val() }; 
  30: } 
  31: will cause prefix=foo&customerID=bar to be sent as the POST body. 
  32: Default: A text string obtained by calling serialize on the sourceID 
  33:  
  34: •onLoading (event) 
  35: Raised before the list is populated. 
  36:  
  37: •onLoaded (event) 
  38: Raised after the list is populated, The code below shows how to “animate” the  select list after load. 

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • Setting Up KeePass For Centos 6

    This mini-howto describes how to set up KeePass on Centos 6. It requires buildin...

    张善友
  • Line Counter - Writing a Visual Studio 2005 Add-In

    Download original source files - 553 Kb Download new source files - 1483 Kb Do...

    张善友
  • ASP.NET Web API和依赖注入

    ASP.NET Web API中自带了一个依赖解析器(Dependency Resolver)接口,允许我们向控制器注入依赖关系。不过,Mark Seemann...

    张善友
  • SAP S/4HANA最佳业务实践:Order-to-Cash订单到收款-3合同处理

    •The tile Manage Sales Contracts is part of the business catalog Sales –Contract...

    SAP最佳业务实践
  • 【IP设计秘笈】 爆! 噗噗星人来袭!

    ? 2020.6.6 正值PUPU噗噗两周岁,我们揭开PUPU面纱,空降PUPU星球的其他物种,正式发布噗噗星人家族,同时展示我们的IP角色设计秘笈。最后文末...

    腾讯ISUX
  • Some Facts about Summon Gears in v1.5.0+

    用户7136908
  • Visual Studio 也开始支持 Ctrl 点击跳转了,于是需要解决跟 ReSharper 的冲突

    2017-11-07 07:55

    walterlv
  • Kaggle竞赛:《NIPS 2017 Adversarial Learning Challenges》

    Batch normalization potentially helps in two ways: faster learning and higher ov...

    fishexpert
  • Flutter “跳转页面”(二)前言正文

    写了这么多文章,有翻译文档的,有自己理解的,也不知道到底是怎么样的风格更能让人接受,希望大家能给点意见或建议。

    坑吭吭
  • [转] Agile Software Development 敏捷软件开发

      敏捷开发是一种软件开发方法,基于迭代和增量开发,通过自组织,跨团队,沟通协作完成开发工作。

    Edison Zhou

扫码关注云+社区

领取腾讯云代金券