Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# Constructor 5/22/2009 3:49 PM (edited 5/22/2009 6:25 PM)
I have had this a few times. After perfoming this (in the gvAccordionItems_RowCommand):
int itemId;
AccordionItem ai;
AccordionItem aid;

switch (e.CommandName) { 
    case "MoveUp":
        itemId = Convert.ToInt32(e.CommandArgument.ToString());

        ai = this._Module._cuyAccordionDao.GetAccordionItem(itemId);
        if (ai.ZIndex > 0) 
        {
            aid = ai.Accordion.AccordionItems[ai.ZIndex - 1] as AccordionItem;
            aid.ZIndex += 1;
            ai.ZIndex += -1;

            this._Module._cuyAccordionDao.SaveOrUpdateAccordionItem(ai);
            this._Module._cuyAccordionDao.SaveOrUpdateAccordionItem(aid);
            Context.Response.Redirect(Context.Request.RawUrl);
        }
        break;

    case "MoveDown":
        itemId = Convert.ToInt32(e.CommandArgument.ToString());

        ai = this._Module._cuyAccordionDao.GetAccordionItem(itemId);
        if (ai.ZIndex < (ai.Accordion.AccordionItems.Count - 1))
        {
            aid = ai.Accordion.AccordionItems[ai.ZIndex + 1] as AccordionItem;
            ai.ZIndex += 1;
            aid.ZIndex += -1;

            this._Module._cuyAccordionDao.SaveOrUpdateAccordionItem(ai);
            this._Module._cuyAccordionDao.SaveOrUpdateAccordionItem(aid);
            Context.Response.Redirect(Context.Request.RawUrl);
        }
        break;
}


I need to do a Response.Redirect to ensure the gridview reflects the changes. I have tried lots of different ways. Anyone got a better way to do this (ie. without redirecting to the same page). Is this just a classic asp.net page life cycle issue?