Jump to content
Sign in to follow this  
startuga

[Resolvido] DropDownList não carrega

Recommended Posts

startuga

Boas estou com um problema bastante 'estupido' que nunca me tinha acontecido e não consigo encontrar solução no google :X

Tenho um dropdownlist que me dá o seguinte erro:

'DDLedit_importerVendorENV' has a SelectedValue which is invalid because it does not exist in the list of items.

Parameter name: value

No entanto no mesmo form tenho outra ddl que funciona perfeitamente :x

Edited by thoga31
Formatação do quote - letras demasiado grandes

Share this post


Link to post
Share on other sites
nelsonr

Boas,

e com o que é que está a ser preenchida a dropdown?

Pelo erro parece que a dropdown tem um valor selecionado que já não está disponivel.

Share this post


Link to post
Share on other sites
startuga

Desta maneira:

<asp:HyperLinkField DataNavigateUrlFields="VEN_ID,IMP_CODE,IMPVEN_SM,IMPVEN_INC,IMPVEN_PORT1,IMPVEN_PORT2,IMPVEN_PORT3,IMPVEN_TIME,IMPVEN_ENVIRONMENT"
                   DataNavigateUrlFormatString = "Edit_IMPVEN.aspx?VEN_ID={0}&IMP_CODE={1}&IMPVEN_SM={2}&IMPVEN_INC={3}&IMPVEN_PORT1={4}&IMPVEN_PORT2={5}&IMPVEN_PORT3={6}&IMPVEN_TIME={7}&IMPVEN_ENVIRONMENT={8}"
                   Text="Edit" >
                   <ControlStyle ForeColor="#0066FF" />
               </asp:HyperLinkField>

Imports System.Data.SqlClient
Imports System.Data
Partial Public Class Edit_IMPVEN
   Inherits System.Web.UI.Page
   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       If Not IsPostBack Then
           Dim strImpVenID As String = Request.QueryString("VEN_ID")
           Dim strImpVenCode As String = Request.QueryString("IMP_CODE")
           Dim strImpVenSM As String = Request.QueryString("IMPVEN_SM")
           Dim strImpVenINC As String = Request.QueryString("IMPVEN_INC")
           Dim strImpVenPORT1 As String = Request.QueryString("IMPVEN_PORT1")
           Dim strImpVenPORT2 As String = Request.QueryString("IMPVEN_PORT2")
           Dim strImpVenPORT3 As String = Request.QueryString("IMPVEN_PORT3")
           Dim strImpVenTime As String = Request.QueryString("IMPVEN_TIME")
           Dim strImpVenEnvironment As String = Request.QueryString("IMPVEN_ENVIRONMENT")

           txbedit_importerVendorID.Text = strImpVenID
           txbedit_importerVendorCode.Text = strImpVenCode
           DDLedit_importerVendorSM.SelectedValue = strImpVenSM
           txbedit_importerVendorINC.Text = strImpVenINC
           txbedit_importerVendorPORT1.Text = strImpVenPORT1
           txbedit_importerVendorPORT2.Text = strImpVenPORT2
           txbedit_importerVendorPORT3.Text = strImpVenPORT3
           txbedit_importerVendorTime.Text = strImpVenTime
           DDLedit_importerVendorENV.SelectedValue = strImpVenEnvironment
       End If

Edited by thoga31
GeSHi

Share this post


Link to post
Share on other sites
nelsonr

Ai não mostra como está a ser preenchida.

Poe um breakpoint na linha que atribui o selectedValue e verifica o conteúdo dos items da dropdown

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.