Custom Module Postback DataBinding
Hi,
I have created a custom intra-site module in the Sitefinity admin, which resides next to the administration tab.
I have a user control with a drop down list, which is populated when the page does not post back. When I click the save button:
<asp:LinkButton ID="lnk1" runat="Server"/>
The postback removes all of the drop down list's items. Here is my code:
protected
void
Page_Load(
object
sender, EventArgs e)
if
(!Page.IsPostBack)
LoadGLAccts(
"OtherAsset"
,
ref
list_ItemsAssetAcct);
I have turned viewstate on in my user control. Is there a special way to bind dropdowns in custom intra-site modules?
Hi Joseph,
I always put these lines in the Page_Load of such UserControls:
Page.ViewStateMode = ViewStateMode.Enabled;
Page.EnableViewState =
true
;
Be sure that the page where this UserControl is living on, also has the ViewState property enabled. You can do this in the Page Properties from the Sitefinity backend.
Kind regards,
Daniel
Thanks. I added more details steps for my module here: jmawebtechnologies.com/.../sitefinity-quickbooks-installation
Read website for more details.