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

What is HTTPModule and HTTPcontext? What is the use of each?

0 Answers   Accenture,


How can you achieve nested Masterpages in 2.0?

1 Answers   Microsoft,


What are the advantages of Web API?

0 Answers  


what is shared assembly asp net

1 Answers   Fidelity,


Compare and contrast between inline and code behind - which one is best?

2 Answers   Siebel,






Explain Factory pattern?

2 Answers   Microsoft,


What are ASP.NET Web Forms? How is this technology different than what is available though ASP (1.0-3.0)?

1 Answers   Siebel Systems,


How can we make sure that Web API returns JSON data only?

0 Answers  


How response object is related to asp's response object?

0 Answers  


What is difference between ASP and ASP.NET ?

3 Answers   TCS,


Where session variables are stored?

0 Answers  


How do you pass session values from one page to another ?

4 Answers   Digital GlobalSoft,


Categories