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 to authenticate users using Web.Config ?

1 Answers   Accenture,


Difference between response.redirect and server.transfer?

0 Answers  


What are the main requirements for caching?

0 Answers  


What is another word for redirect?

0 Answers  


What are the disadvantages of view state / what are the benefits?

2 Answers   Siebel Systems,


What is fulltrust?

0 Answers  


Why is validation always done on the server? When does that occur?

2 Answers  


What is asp.net localization?

0 Answers  


Explain how can we inherit a static member?

0 Answers  


Where the assembly is stored in asp.net?

0 Answers  


What types of data validation events are commonly seen in the client-side form validation?

0 Answers  


What are the parts of an http response?

0 Answers  


Categories