コード例 #1
0
 /// <summary>
 /// 设置选中的值
 /// </summary>
 /// <param name="box"></param>
 /// <param name="item">值</param>
 public static RadListBoxItem SetSelected(this RadListBox box, RadListBoxItem item)
 {
     if (item != null)
     {
         box.ClearSelection();
         item.Selected = true;
     }
     return(item);
 }
コード例 #2
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 /// <param name="box"></param>
 /// <param name="dataSource">数据源</param>
 /// <param name="textfld">文本字段</param>
 /// <param name="valuefld">值字段</param>
 public static RadListBox BindData(this RadListBox box, object dataSource, string textfld, string valuefld)
 {
     if (box.SelectedIndex > -1)
     {
         box.ClearSelection();
     }
     if (box.Items.Count > 0)
     {
         box.Items.Clear();
     }
     box.DataSource     = dataSource;
     box.DataTextField  = textfld;
     box.DataValueField = valuefld;
     box.DataBind();
     return(box);
 }