Hi Brett,You can achieve auto post back by dynamically setting the AutoPostBack property of the dropdown and dynamically registering for the SelectedIndexChanged event.SelectedIndexChanged is fired when the user has selected a new item in the dropdownlist.Using this technique, there will be no need to modify the TemplatesStorage.ascx file.The AutopostBack property is changed when the DropDownList is created this is the eventSmartDBControl.ondatabinding.The SelectedIndexChanged is registered each time the SmartDBControl is loaded. This is SmartDBControl.onload event.Below is example for the CategoryID dropdown. ctrlCategoryID_DataBinding method changes the AutoPostBack property.ctrlCategoryID_Load registers the dropDownValue_SelectedIndexChanged event handler.In the dropDownValue_SelectedIndexChanged method you put the code that should be executed when the dropdown selection changes.You can download the full aspx page from here:AutoPostBackProducts.zip...<smartDBforms:SmartDBControl Field="CategoryID" ID="ctrlCategoryID" runat="server" onload="ctrlCategoryID_Load" ondatabinding="ctrlCategoryID_DataBinding" ... ///////////////////////////////// // DROPDOWN AUTOPOSTBACK EXAMPLE protected void ctrlCategoryID_Load(object sender, EventArgs e) { // On page load register for the SelectedIndexChanged event which //will fire when the user has changed the drop down selection. DropDownList dropDownValue = ((SmartDBControl)sender).FindControl("DropDownValue") as DropDownList; // Dropdown is availailable only in Edit mode. Check if exist. if (dropDownValue != null) dropDownValue.SelectedIndexChanged += new EventHandler(dropDownValue_SelectedIndexChanged); } protected void ctrlCategoryID_DataBinding(object sender, EventArgs e) { // When dropdown is created set its Autopostback to true. DropDownList dropDownValue = ((SmartDBControl)sender).FindControl("DropDownValue") as DropDownList; // Dropdown is availailable only in Edit mode. Check if exist. if (dropDownValue != null) dropDownValue.AutoPostBack = true; } void dropDownValue_SelectedIndexChanged(object sender, EventArgs e) { //TODO: Do something. Page.Title +=" Selected Category value is:"+ ((DropDownList)sender).SelectedValue; }If you have any other questions, we will be more than happy to help you.Best wishes,Adillis SupportAdillis - IT solutions http://adillis.com
Hi Brett,A new feature will be added to the next release of smartDBforms.NET which will allow to easily achieve the AutoPostBack functionality.Here is description of the future feature:SmartDBControl will have custom property AutoPostBack which will enable the AutoPostBack of the underlying DropDownList.SmartDBControl will have CustomEvent "SelectedIndexChanged" which will fire when the underlying DropDownList.SelectedIndexChanged fires.This will allow to achieve the AutoPostBack functionality with minimum code.If you have any other questions, we will be more than happy to help you.Best wishes,Adillis SupportAdillis - IT solutions http://adillis.com