After you bind the data to the dropdownlist, you can add a new listitem and set the index to 0. This will store the blank row at the top of the list and even allow you to set it as selected by default. ------------------------------------- I have no prayer for that. - Stark, Farscape
uadrive
Posts
-
Drop down list is asp.net form -
How can i sort a DataTable?You can use the DefaultView property to access the Table's view and then sort. i.e. DataTable myTable = new DataTable("blah"); myTable.DefaultView.Sort ------------------------------------- I have no prayer for that. - Stark, Farscape
-
Security Question IISI've always had this same problem when security isn't set up correctly in either my web.config or the virtual directory. I would bet that the issue has to do with security settings on the virtual directory set up for the new server. ------------------------------------- I have no prayer for that. - Stark, Farscape
-
Custom Control TreeWeb and DataBindingI have written a modification to the TreeWeb custom control found here on The Code Project. I needed to be able to bind data to any TreeElement that I choose. I have been able to do this by making the TreeElements controls themselves and using a ControlDesigner to allow me to make DataSource Selections to the properties. The issue I am having is that I can set the DataSource initially, but once I build, or close my project and try to open the page that has a TreeWeb, the DataSource is no longer editable through the properties. Instead it will be greyed out displaying 'System.Data.DataSet' as the value in the field. The other issue I'm having is when I bind the control in Page_Load it sees a filled DataSource as empty unless I reset the DataSource just before binding. Any help would be appreciated. I intend to post the source when I'm completed to help The Code Project out. Thanks. Here's the designer code from my designer related to DataSource // resolve ambiguous reference public string DataMember { get { Check.Require(this.mElement.DataMember != null); return this.mElement.DataMember; } set { this.mElement.DataMember = value; this.OnDataSourceChanged(); } } public string DataSource { get { DataBinding binding = base.DataBindings["DataSource"]; if(binding != null) { return binding.Expression; } return string.Empty; } set { // check to see if it needs to remove dataSource if((value == null) || (value.Length == 0)) { base.DataBindings.Remove("DataSource"); } else { // sets a new dataSource DataBinding binding = base.DataBindings["DataSource"]; if(binding == null) { binding = new DataBinding("DataSource", typeof(IEnumerable), value); } else { binding.Expression = value; } base.DataBindings.Add(binding); } this.OnDataSourceChanged(); base.OnBindingsCollectionChanged("DataSource"); } } protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties(properties); PropertyDescriptor prop = (PropertyDescriptor)properties["DataSource"]; AttributeCollection runtimeAttributes; if(prop!=null) { runtimeAttributes = prop.Attributes; // make a copy of the original attributes but make room for one extra attribute ie the TypeConver
-
IE Treeview controlI'm currently working on the TreeWeb version available here at CodeProject. I've been able to write my own DataBinding to it, but am having a few problems myself. If the control doesn't support DataBinding yet, look into creating a ControlDesigner for your tree to add DataBinding at designtime. This will give you the functionality you need for using SQL. TreeWeb allows the use of checkboxes. If I can get my version of TreeWeb bug free I will post the source for people to use.:laugh: ------------------------------------- In death he has a name. His name is Robert Palmer. His name is Robert Palmer. -Fight Club