If(dropdownlist1.selectedIndexChanged==true)
{
//code
}
else
{
//code
}
I am getting error in If condition, so can u pls give me a
solution.

Answers were Sorted based on User's Feedback



If(dropdownlist1.selectedIndexChanged==true) { //code } else { //code } I am getting error i..

Answer / gaurav k

SelectedIndexChanged is a event for the DropDown Control.
True is a bool type. We can not compare an event with bool
type like this. If we have to do somthing on the change of
the selection of an item, we can write the appropriate code
in the SelectedIndexChanged Event.

protected void DropDownList1_SelectedIndexChanged
(object sender, EventArgs e)
{
//Code
}

Is This Answer Correct ?    11 Yes 0 No

If(dropdownlist1.selectedIndexChanged==true) { //code } else { //code } I am getting error i..

Answer / prashant yadav

selectedIndexChanged is a event while true is bool type
variable which is not corrct

Is This Answer Correct ?    10 Yes 0 No

If(dropdownlist1.selectedIndexChanged==true) { //code } else { //code } I am getting error i..

Answer / narashiman

if we try to set the dropdownlist1 autopostback to true. we
will not get the error

Is This Answer Correct ?    2 Yes 3 No

If(dropdownlist1.selectedIndexChanged==true) { //code } else { //code } I am getting error i..

Answer / milind

If(dropdownlist1.selectedIndexChanged!=0)

Try this 1 you will not get error

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More ASP.NET Interview Questions

How can we inherit a static variable?

0 Answers  


how to encrypt a connection string in web.config file?

3 Answers   Hexaware,


Explain ViewState?

0 Answers   QuestPond,


What is an application domain?

2 Answers   Microsoft,


What are the different methods of session maintenance in asp.net?

0 Answers  






What is session id in web application?

0 Answers  


How do I upload a file from my ASP.NET page?

0 Answers  


Various types of Page Load functions

4 Answers   Net Solution,


how many script manager controls are used in Ajax web page?

7 Answers   CSC, Health Prime Services, TCS,


What is a session government?

0 Answers  


Asp.net - How to find last error which occurred?

1 Answers   Abacus,


Can we throw exception from catch block ?

4 Answers   Accenture, BirlaSoft,


Categories