Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
Setting an Inital Value to WebCombo
posted

I need to have the WebCombo display a initial value when the web page loads. The user can either proceed or change the value to one that they desire from the combo box.

Thanks in advance.

  • 370
    posted

    If you're binding the combo to a datasource then you can set the default value in the DataBound event.

    Protected Sub cboData_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) _
      Handles cboData.DataBound

      With DirectCast(sender, WebCombo)
       
    If Not IsPostBack Then
         
    .SelectedRow = .Rows.Item(0)
       
    End If
      End With
    End Sub

    Otherwise you can just set the DisplayValue property to whatever value you want to display.