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 http response header?

0 Answers  


What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?

4 Answers  


What is custom attribute? How to create?

0 Answers  


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?

0 Answers   Marlabs,


What is the difference between Trace and Debug?

2 Answers   BirlaSoft,






Define the steps to set up validation control.

0 Answers  


What is the difference between the asp and asp.net?

0 Answers  


What is deff. saop and disco?

1 Answers  


How many types of validation are there?

0 Answers  


can i use two web.config files of ConnectionString in One Default.aspx page

6 Answers   Satyam, Verinon Technology Solutions, Wipro,


Explain the namespace classes used in asp.net mvc? : asp.net mvc

0 Answers  


What is a global postback url?

0 Answers  


Categories