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 do cookies work?

0 Answers  


What are validator? Name the Validation controls in asp.net? How do u disable them?

2 Answers  


What are the advantages of using sql stored procedures instead of adhoc sql queries in an asp.net web application?

0 Answers  


what is webpart? what r the parts in this webpart (zone)

2 Answers  


What are custom user controls in asp.net?

0 Answers  


For a server control, you need to have same properties like color maxlength, size, and allowed character throughout the application. How do you handle this?

2 Answers   Microsoft,


i develop a web application and i gave security setting i.e autherization and athentication now it work properly on my local system , now question is ,is this security setting ie autherization and athentication which i gave in web.config will it be enough strong to secure my application on internet or i have to use some 3rd party tool or software to get security .if yes --how ? if no--what is the alternate?

0 Answers  


What is applicatio domain?

0 Answers   MCN Solutions,


Explain authentication levels in .net ?

3 Answers  


Can you explain one critical mapping? Performance issue which one is better?

0 Answers  


What is session object? Describe in detail.

0 Answers  


what is silverlight and what is the purpose of silverlight?

2 Answers   Cognizant, CTS,


Categories