DropDownList Inside a Repeater ASP.NET Not firing IndexChanged Event

Hi everybody, (USING ASP.NET & C#)
I am having a repeater inside an update panel and there is one DropDownList inside repeater. I have set AutoPostBackTrue for that Repeater and have defined event IndexChanged.

all the instances of drop down list always have list with values 0,1,2,3,4,5 and here is my problem.
Let say there are two rows in repater hence two drop downs X and Y. And I change value of X to 1 (It fires event and does what it should), then I change Y to be 2 (It does what it should i.e. fires indexChanged event) I move Y = 0 (setting back to 0 still fires indexChanged) but when I set X=0 (i.e. all ddl back to original values so this last change does not fire DDL IndexChanged event)  and this last move is a problem for me.

Furthermore everytime i am changing something in one dropdownlist it is firing IndexChangedEvent as many times as there dropDownLists.

Please help me to solve this issue. I have played hours with it. And if this is not the right way to do it then suggest me a better way to fire an event everytime something is changed on DDLS inside repeater. Many thanks in Advanced.

<asp:repeater ID="rptSizes" enableviewstate="false" runat="server" onitemdatabound="rptSizes_ItemDataBound" >
		 <HeaderTemplate>
			<table cellpadding="2" cellspacing="3">
			   <tr>
				  <th>
					 <asp:literal id="ltrSizeColumHeading" text="Size" runat="server"></asp:literal>
				  </th>
				  <th>
					 <asp:literal id="ltrNumberOfProducts" text="Antal" runat="server"></asp:literal>
				  </th>
			   </tr>  
		 </HeaderTemplate>
		 <ItemTemplate>
			<tr>
			   <td>
				  <asp:literal id="ltrProductSizeName" runat="server"></asp:literal>
			   </td>
			   <td>
				  <asp:dropdownlist id="ddlQuantity" runat="server" cssclass="quantityTextBox" runat="server" AutoPostBack="true" onselectedindexchanged="ddlQuantity_SelectedIndexChanged">
					 <asp:listitem text="0" value="0"></asp:listitem>
					 <asp:listitem text="1" value="1"></asp:listitem>
					 <asp:listitem text="2" value="2"></asp:listitem>
					 <asp:listitem text="3" value="3"></asp:listitem>
					 <asp:listitem text="4" value="4"></asp:listitem>
					 <asp:listitem text="5" value="5"></asp:listitem>
				  </asp:dropdownlist>
				  <asp:literal id="ltrUnit" text="Stk." runat="server"></asp:literal>
			   </td>
			</tr>
			<asp:hiddenfield id="hidBonusProductID" runat="server" />
		 </ItemTemplate>
		 <footertemplate>
			</table>
		 </footertemplate>
	  </asp:repeater>
	  
	  
	protected void ddlQuantity_SelectedIndexChanged(object sender, EventArgs e) {
         //DoSomething
      }

Open in new window

hussainAbidAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rajvjaCommented:
In the updatePanel, write trigger also for dropdownlist
0
krunal_shahCommented:
bind repeater inside ,
if(!Page.IsPostBack)
{
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hussainAbidAuthor Commented:
Thanks for reply Raj,
Can not write trigger for update panel because Update panel is outer bounded to a div that then has a control called ProductList and then comes nested control Product and that is where this repater is placed. Anymore sugessions...
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

hussainAbidAuthor Commented:
Thanks Mr Shah, It worked but can you please explain me How would it effect this behaviour of DropDownList. I will highky appreciate it.
0
hussainAbidAuthor Commented:
Thanks Mr Shah, It worked but can you please explain me How would it effect this behaviour of DropDownList. I will highky appreciate it.
0
krunal_shahCommented:
Hi,
its affecting because when your dropdown selected index change event fires, the postback of the page occurs and so the page_load event fires first whih causes your repeater and dropdown binding again,so your dropdown value changes to the default one.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.