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 state management react?

0 Answers  


What is content place holder?

0 Answers  


asp.net page is a object or not?

5 Answers  


Is overloading possible in web services?

2 Answers   Microsoft,


What does the .webpart file do?

0 Answers  






In which event are the controls fully loaded?

0 Answers  


Explain how is the asp.net mvc architecture different from others? : asp.net mvc

0 Answers  


Explain how server control validation controls works?

2 Answers   CMS, Syntax Softtech,


What?s the difference between Response.Write() and Response.Output.Write()?

2 Answers   Visual Soft, Siebel,


what are the events raised in asp.net page life cycle?in which stage view state can be loaded?

0 Answers   EDS,


1.how to encrpt query string in asp.net? 2.there are 10000 records then i wnat display 5000 records one gridview and 5000 records another grid view what is the process?

2 Answers   Marlabs,


About dataset and data mining ?

1 Answers   Cognizant,






Categories