postback and webcustomcontrol

A

Alexander Widera

Hello,

i have a webcustomcontrol :)CompositeControl) which is in an asp.net page
which causes a postpack-event (ChangeSort).

protected void ChangeSort(Object sender, EventArgs e)

{

Session["Sort1"] = dropDownListSort1.SelectedValue;

Session["Sort2"] =
Int32.Parse(dropDownListSort2.SelectedValue.ToString());

}

ChangeSort only saves 2 variables which are selected in a dropdownlist in
the session.



Then I have a method which compares objects of "IShopAricle" on the in the
session stored variables.

protected int CompareIShopArticleByConfig(IShopArticle x, IShopArticle y)

{

return CompareIShopArticle(x, y, Session["Sort1"].ToString(),
Session["Sort2"].ToString());

}



nothing complicated until here...

now there is a ArticleCollection which is a generic list of IShopArticle

public List<IShopArticle> ArticleCollection = new List<IShopArticle>();



and the method which renders the webcustomcontrol and calls the sort-method.

ArticleList is another webcustomcontrol which is added to this control.



protected override void CreateChildControls()

{

ArticleList articleList = new ArticleList();

this.ArticleCollection.Sort(CompareIShopArticleByConfig);

articleList.ArticleCollection = this.ArticleCollection ;

this.Controls.Add(articleList);

}


And now the problem: if i select in my dropdownlist something, and the
postback has finished, the correct item in the dropdown is selected, but the
articleList shows the "old" "unsorted" articleList. If i reload the page it
shows the correct sorted content.

There must be something wrong with the order of the events or there must be
something missing.

Could somebody help me please?

thanks a lot,

alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,991
Messages
2,570,212
Members
46,800
Latest member
Tobi1987

Latest Threads

Top