Tuesday, January 5, 2010

ASP.NET Dropdown SelectedValue does not change?

Problem:
My dropdown selected value does not change.
It will always return the initialized value.

Solution:
Check if you put the initialization within the page.ispostback criteria.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ddl.SelectedValue = "1"
End If
End Sub

No comments: