VinodKumar01 wrote:
if (((DropDownList)(griddistrict.Rows[e.RowIndex].FindControl("editdrp"))).SelectedValue == "select")
Basically Dropdownlist contains two properties
DataTextField(For Name type) &
DataValueField(For ID type) regarding Databind. I suspect "select" is
DataTextField as per your code.
So your code should be
if (((DropDownList)(griddistrict.Rows[e.RowIndex].FindControl("editdrp"))).SelectedText == "select")
or
if (((DropDownList)(griddistrict.Rows[e.RowIndex].FindControl("editdrp"))).SelectedValue == 0)
Why don't you try validators for controls? Try these
Link 1[
^]
Link 2[
^]