Click here to Skip to main content
15,919,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dynamic Controls with Event is always firing even if i click on submit it is firing.
Can anybody help me out here??
[no name] 7-Jul-11 5:43am    
which event???? can you please name some event??
ParthaDinda 7-Jul-11 7:15am    
try to write your code in ItemCreated event and test it i think it will work

1 solution

Write this in the event

e.Handled = true;

if page event

then use

//Data Binding Code
Share this answer
HK from SRT 7-Jul-11 5:51am    
Already done still facing problem
I dont want it to fire every time but in selectedIndexChange the actual event that occurs
[no name] 7-Jul-11 5:54am    
selectedIndexChange which control.

If you are binding the data to the control then it will get called.

Please Show us some code.
HK from SRT 7-Jul-11 6:02am    
I have repeater rptQuestions_ItemDataBound:
inside this controles are dynamically created
like: ListControl lstMCQAnswer = new RadioButtonList();
then i create events for that controles like: lstMCQAnswer.SelectedIndexChanged += new EventHandler(lstControlQuestionOption_SelectedIndexChanged);
lstMCQAnswer.AutoPostBack = true;
All inside repeater and repeater data are binding under:
when if(!IsPostBack)
{ condition
Now suppose my list control is drop down then on its selected index change event i m getting one textbox.
But now when i enter some data on that textbox and if try to submit it.Uneccesary drop down selected index change is called my control is againg created and i lost my data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900