One of my web page contains dropdown and gridview only.There is no button.I want to validate that dropdown when i click the gridview.(OR) validate when control moves from that dropdown.Help me.

<asp:dropdownlist id=lstForeColor runat="server" Height="22px" Width="194px" AutoPostBack="True"></asp:dropdownlist>

Private Sub ControlChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
     Handles lstForeColor.SelectedIndexChanged
'YOUR VALIDATION CODE HERE
End Sub

I think this code will work.

Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object,_
ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
'Implement your code (OR) follow the next code 
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Button1.Click
TextBox1.Text = "You Selected:" & DropDownList1.SelectedItem.Text
End Sub

Write your code in dropdownlist1_selectedIndexChanged event to show the records in grid view for a particular value selected from dropdownlist (or) Write the code in the button by getting the text from dropdownlist as shown above.

Please clarify with more details what you are expecting if it is not suitable to your code.

Please read my first post.Now i removed intial value in drop down so no need to validate dropdown.i couldnt solve that.Now first value also one of valid value.

This article has been dead for over six months. Start a new discussion instead.