Jump to content
Xtreme .Net Talk

Specificed arguement was out of range of valid values.


Recommended Posts

Posted

Hi all,

 

Have filled a dropdown list with data directly from the database. Wish to have a specific value selected when the page first loads. I am using the following line of code:

ddlOrgtype.DataSource = dsOrgTypes
ddlOrgtype.DataTextField = "OrgType"
ddlOrgtype.DataValueField = "Identifier"
ddlOrgtype.DataBind()
ddlOrgtype.selectedValue = "Select Organisation Type"

 

I am getting the error: "Specificed arguement was out of range of valid values.", any suggestions on how to overcome this problem?

 

Mike55

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Posted
Make sure "Select Organisation Type" is a possible value.

 

 

Yep, its a value that exists in the drop down. Got around the problem by using the following code:

Me.ddlOrgtype.Items(6).Selected() = True

Possible not the best way to do it, but still it works

 

Mike55

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Posted
Are you sure it was a value and not just the displayed text?

 

You can't set selected "value" by specifying a text value. If you wanted to set it by a text value you'd need to use this:

 

ddl.SelectedItem.Text = "Select Organisation Type"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...