Thursday, May 17, 2012

IIterable as datasource

since u can use IIterable for datasources here is some neat code to quickly add a select item in a collection:

       IService client = new service();
              var things = client.Getthings();
              things.Insert(0, new thinge{ text = "--Select--",  desc  = "" });
              cmbthings.DataSource = modules;
              cmbthings.DataTextField = "text";
              cmbthings.DataValueField = "desc";
              cmbthings.DataBind();

No comments:

Post a Comment