Home All Groups Group Topic Archive Search About

asp:Repeater + no viewstate + DataBind() ??

Author
10 Feb 2006 11:10 PM
nickster
Hi,

I have a repater control to which I re-bind my data everytime the page
loads. I can't use viewstate as it caches the data and the application I'm
building allows our internal employees to collaborate and they need to be
looking at LIVE data (or as live as possible) in case someone else makes a
change etc.

This is causing me some grief when re-rendering the repeater after they make
a change. The repeater is rendering one-behind; meaning, I have to postback
twice before the change is finally rendered to the screen.

I guess my question is, what is the recommended technique for DataBinding,
ViewState usage, etc, when you MUST re-query the data on every postback to
always get the latest data possible?

Here's an extremely simplified I.e. of what I'm basically doing...

Page_Load()
{
    DataBind();
}

Item_Command()
{
    PersistChanges();
    DataBind();
}

DataBind()
{
    rptr.DataSource = GetDataFromDB();
    rptr.DataBind();
}

Thanks!

- Nick

Author
14 Feb 2006 9:16 AM
Emil Christopher Melar
nickster wrote:
> Hi,

> I guess my question is, what is the recommended technique for DataBinding,
> ViewState usage, etc, when you MUST re-query the data on every postback to
> always get the latest data possible?
>

If you use ASP.NET 2, you should look into ObjectDataSource or
SqlDataSource. (if you do the horrendous thing of accessing DB directly
from your page without using datalayer).

Show quoteHide quote
> - Nick


--
Emil Christopher Melar