Gridview does not get fresh data on rebind

Posts   
 
    
daz_oldham avatar
daz_oldham
User
Posts: 62
Joined: 20-Jul-2007
# Posted on: 04-Oct-2007 18:47:19   

Hello

Ref: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=11477

I have got a gridview, with a design-time LLBL data source. I have a command button that fires an event that creates records in the table that provides the data for my Gridview.

I am doing gvOptions.DataBind() to get my gridview to refresh the data, but it seems to be cacheing the data. I have tried disabling the LivePersistence, but when I cange tabs in my tabstrip, the datagrid just loses its data.

Does anyone have any ideas?

Many thanks

Darren


<asp:GridView ID="gvOptions" runat="server" AutoGenerateColumns="False"
            CellPadding="4" ForeColor="#333333" GridLines="Horizontal" OnRowEditing="gvOptions_RowEditing"
            OnRowUpdated="gvOptions_RowUpdated" OnRowUpdating="gvOptions_RowUpdating" DataKeyNames="CombinationId" DataSourceID="dsLLBLOne" EmptyDataText="--">
            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <Columns>
                <!-- Template Fields Here -->
            </Columns>
            
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <llblgenpro:LLBLGenProDataSource ID="dsLLBLOne" runat="server" DataContainerType="EntityCollection"
            EntityCollectionTypeName="RedStarEnergy.DAL.CollectionClasses.ProductTypeOptionAttributeCombinationCollection, RedStarEnergy.DAL" AllowDuplicates="False">
        </llblgenpro:LLBLGenProDataSource>

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Oct-2007 11:54:14   

I am doing gvOptions.DataBind() to get my gridview to refresh the data, but it seems to be cacheing the data.

Try: LLBLGenProDataSource.Refetch = true;

I have tried disabling the LivePersistence, but when I cange tabs in my tabstrip, the datagrid just loses its data.

Most probably the ViewState is not enabled in the Grid.

daz_oldham avatar
daz_oldham
User
Posts: 62
Joined: 20-Jul-2007
# Posted on: 05-Oct-2007 13:38:24   

Yeah that's done the trick.

Thanks smile

Darren