Custom Module Postback DataBinding

Posted by Community Admin on 03-Aug-2018 21:30

Custom Module Postback DataBinding

All Replies

Posted by Community Admin on 28-Feb-2013 00:00

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?

Posted by Community Admin on 01-Mar-2013 00:00

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

Posted by Community Admin on 01-Mar-2013 00:00

Thanks. I added more details steps for my module here: jmawebtechnologies.com/.../sitefinity-quickbooks-installation

Read website for more details.

This thread is closed