chandu gummadi

chandu gummadi

  • NA
  • 67
  • 56.5k

dropdown selected index changed event

May 2 2013 7:35 AM

Hi ...

I have a gridview which has 3 columns and binded from database on pageload.

In the same page i have 3 dropdown list which is also binded from database.

Here User will select 3 dropdown list value, if all the 3 dropdown list value is available in the binded gridview in any row of 3 column , then i need to show a message ALREADY EXIST.

Plz help me to do this ! Hope u guys have understand !!


let me exaplin you in clear what i need is 

let us consider i have this data which is below in my gridview binded through sqldatasource


EmployeeName   Title   City    Salary

Bob                       yyy      B       30K   

John                      XXX      A       20K

Rahmesh               zzz      c       15K

Gomathi                hhh      D       18K

Riya                          iii      E       19K

Karthicks               uuu      F       22K


I have three dropdownlist outside of the gridview 

Dropdownlist1,Dropdownlist2,Dropdownlist3


In first dropdownlist1 i have for example: John,Rahul,Riya

In Second dropdownlist2 i have for example: XXX,TTT,iii

In third dropdownlist3 i have for example: A,P,E


Forexample:-

If user select John in dropdwonlist1, XXX in dropdwonlist2, A in dropdwonlist3

i need to show record already exists message

coz in my gridview it has all the three in second Row..

this what i need..Help me to achieve this


for(int i=0; i<gridview1.rows.count)
{
if(gridview.rows[i].cells["Employe_Name"].toString()==ddl.selectedvalue().toString() &&  gridview.rows[i].cells["Title"].toString()==ddl2.selectedvalue().toString() && gridview.rows[i].cells["City"].toString()==dd3.selectedvalue().toString()   )
{
response.write("already exist");
}
}

its not working bellow code it shows a error like The best overloaded method match for 'System.Web.UI.WebControls.TableCellCollection.this[int]' has some invalid arguments