|
-
Mar 8th, 2005, 05:49 AM
#1
Thread Starter
Fanatic Member
[RESOLVED]databinding dropdown problem
I have a dropdown that is populated through a stored procedire triggered from the chnage of a different drop down.
I am getting the message
Specified argument was out of the range of valid values.
Parameter name: value
does any know what this means so i can start to investigate, I cannot get debug working so I dont knwo where to start looking
-----------------------------------------------
I Have changed code too:
Code:
ddSectorName.SelectedIndex = 0
ddSectorName.DataSource = dsSectorName
ddSectorName.DataTextField = "SECT_NM"
ddSectorName.DataValueField = "SECT_ID"
ddSectorName.DataBind()
ddSectorName.Items.Insert(0, "All")
ddSectorName.Items(0).Value = "%"
ddSectorName.SelectedIndex = 0
it seems that the dropdown was stroing the indexnumber for the currently selected item in viewstate, and when databinding if the new list of items was not as big as the previous then it couldnt find the index and it would fall over.
Last edited by davebat; Mar 10th, 2005 at 05:34 AM.
Reason: [RESOLVED]
-
Mar 8th, 2005, 07:28 AM
#2
Frenzied Member
Re: databinding dropdown problem
The code to generate the dropdowns would help. HTML and C# or VB.Net script.
DJ
-
Mar 8th, 2005, 09:24 AM
#3
Thread Starter
Fanatic Member
Re: databinding dropdown problem
Drop down change
Code:
Private Sub ddChannelName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddChannelName.SelectedIndexChanged
Dim dsSectorName As New DataSet
Dim cmpData As New dataaccess
Dim strChannelID As String = ddChannelName.SelectedItem.Value
dsSectorName = cmpData.getSectNm(strChannelID)
ddSectorName.Items.Clear()
ddSectorName.DataSource = dsSectorName
ddSectorName.DataTextField = "SECT_NM"
ddSectorName.DataValueField = "SECT_ID"
ddSectorName.DataBind()
ddSectorName.Items.Insert(0, "All")
ddSectorName.Items(0).Value = "%"
End Sub
-
Mar 8th, 2005, 10:30 AM
#4
Frenzied Member
Re: databinding dropdown problem
Instead of:
Code:
ddSectorName.Items.Insert(0, "All")
ddSectorName.Items(0).Value = "%"
Try:
Code:
Dim newItem As ListItem
newItem.Text = "All"
newItem.Value = "%"
ddSectorName.Items.Insert(0, newItem)
DJ
-
Mar 9th, 2005, 05:35 AM
#5
Thread Starter
Fanatic Member
Re: databinding dropdown problem
thanks DJ, but this didn't help. The error occurs when the event fires and ddSectorName index was not currently on 'All'.
Any ideas, or an english translation of the error message
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|