repeater datasource viewstate error

M

Mike K

Hello,

I have run into a strange situation.

I have a control in which I am trying to sort the datasource of a
repeater and bind the arraylist data back to the repeater. Whenever I do
this I get an error stating that there were multiple controls with the
same id. The stack trace shows the following:

System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
calcViewState)


which leads me to beleive that there is a naming collission in the view
state.

The control contains 2 embeded repeaters. The sort image button is a
control within in the top level repeater. When the sort button is
clicked the sort criteria is determined from a list box next to the
button. The data source (2d arrayList) for the top level repeater is
aquired, the appropriate sub data list is aquired according to the
command argument, it is then sorted and the entire arraylist is bound
back to the the data source of the top level repeater.

The sort event is thrown from within the reapter so it is handled by an
ItemCommand event handler. The sorting works fine, I have verified the
data. The problem occurs when I try to bind the data back to the
repeater.



Any insight that can be provided will be very helpful.



aspx code example:

<ASP:REPEATER id="repeaterDataSummary" runat="server"
onItemDataBound="ShowDataSummary" OnItemCommand="Button_ItemCommand">

<asp:ImageButton id="imageButtonSortFlightsx" ImageUrl="/sort.gif"
BorderWidth="0" CommandName="SortDataSummary" runat="server"
CommandArgument="<%# Container.ItemIndex%>" />





aspx.cs code example:

protected void Button_ItemCommand(object sender ,
RepeaterCommandEventArgs e)
{
try{
switch(e.CommandName){

case "SortFlightsCommandName":

this.repeaterSchedule.DataSource =
SortedDataSummaryList();

this.repeaterSchedule.DataBind();

break;

default: break;
}
}
catch(Exception ex){//handle ex.}
 

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

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,226
Latest member
KristanTal

Latest Threads

Top