ruhi 13 Light Poster

Hi,
I have three dropdownlist: country, state and city.
Based on the selection of country the data of state will be filtered and similarly depending on the selection of state , the items of the city will be filtered.
That is working fine.
Now there is one gridview which contains country, state and city. But on the selection of any row of that gridview, the data must be filled up in the above dropdownlists, that is not working. For the default value it is working but for other it is not working.

I am writing like this..

int j = 0;
        while (!this.countrynameDropDownList.Items[j].Text.ToString().Equals(cityGridView.SelectedRow.Cells[2].Text.ToString())) j++;
        this.countrynameDropDownList.SelectedIndex = j;


int i = 0;
        while (!this.statenameDropDownList.Items[i].Text.ToString().Equals(cityGridView.SelectedRow.Cells[3].Text.ToString())) i++;
        this.statenameDropDownList.SelectedIndex = i;

For country I think it is ok but for state it is not.
Can anyone give any idea how to do?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.