Multi-select dropdown list in ASP.NET

后端 未结 8 1981
梦如初夏
梦如初夏 2020-11-27 04:22

Do any good multi-select dropdownlist with checkboxes (webcontrol) exist for asp.net?

Thanks a lot

相关标签:
8条回答
  • 2020-11-27 04:54

    Here's a cool ASP.NET Web control called Multi-Select List Field at http://www.xnodesystems.com/. It's capable of:

    (1) Multi-select; (2) Auto-complete; (3) Validation.

    0 讨论(0)
  • 2020-11-27 04:59

    I've used the open source control at http://dropdowncheckboxes.codeplex.com/ and been very happy with it. My addition was to allow a list of checked files to use just file names instead of full paths if the 'selected' caption gets too long. My addition is called instead of UpdateSelection in your postback handler:

    // Update the caption assuming that the items are files<br/> 
    // If the caption is too long, eliminate paths from file names<br/> 
    public void UpdateSelectionFiles(int maxChars) {
      StringBuilder full = new StringBuilder(); 
      StringBuilder shorter = new StringBuilder();
      foreach (ListItem item in Items) { 
        if (item.Selected) { 
          full.AppendFormat("{0}; ", item.Text);
          shorter.AppendFormat("{0}; ", new FileInfo(item.Text).Name);
        } 
      } 
      if (full.Length == 0) Texts.SelectBoxCaption = "Select...";
      else if (full.Length <= maxChars) Texts.SelectBoxCaption = full.ToString(); 
      else Texts.SelectBoxCaption = shorter.ToString();
    } 
    
    0 讨论(0)
提交回复
热议问题