Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m checking drop down list text
n want true index change event only if text is "OTHER"

Is it possible???
Posted

My answer was lost...

If you handle the change event on the client side and return true if the text is 'OTHER', then a server side event will only fire in that case.
 
Share this answer
 
Comments
sumit wagh 18-Jun-13 0:38am    
Ok,
thanks

its abt my project performance issue..
Christian Graus 18-Jun-13 0:41am    
Well, you would do well to write code that works nicely, but you can suppress the event, as I said.
No, it's not. SelectedIndexChanged event will be fired if you'll select different item DropDownList. In your case, you can prevent the action not the event. Try this:
C#
protected void ddlTest_SelectedIndexChanged(object sender, EventArgs e)
{
    if(ddlTest.SelectedItem.Text == "Other")
    {
         //Write your code here.
    }
}



--Amit
 
Share this answer
 
Comments
sumit wagh 18-Jun-13 0:37am    
Ya i tried the same but for performance issue so and so
Christian Graus 18-Jun-13 0:42am    
Doing a postback on an event is stupid anyhow. This is 2013, you should be using AJAX for any events.
_Amy 18-Jun-13 0:46am    
You can use Ajax then.

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