Geeks With Blogs
Bunch's Blog One day I'll have a catchy subtitle, one day

This was something else that gave me fits recently. I have a web app that uses a formview, which wasn’t that big a deal to me. Until I tried to have the value in one dropdown affect the value(s) in a second dropdown. For my problem the first dropdown holds manufacturer names and then the second displays the models by the selected manufacturer in the first dropdown.


I could get the dropdowns to load up proper on the first load based on a SQL query, but the issue came about when I was testing changing the value of the manufacturer dropdown. None of the formview methods seemed to fire when I needed them to.


So what I did was to set the ‘OnSelectedIndexChanged’ of the manufacturer ddl. I used:


 Protected Sub ddlMfr_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)


for the sub. This would fire when I changed the manufacturer item. Within the sub I wrote code more specific to the dropdown lists and their respective datasources to have them populate via the datasource’s Select statement. To find the datasources I used Me.FindControl(datasource name) and for the dropdowns formview.Row.FindControl(ddl name).

Technorati Tags: ,
Posted on Monday, March 10, 2008 2:29 PM ASP.Net | Back to top

Comments on this post: Cascading DropDowns within a FormView (Without AJAX)

# re: Cascading DropDowns within a FormView (Without AJAX)
Requesting Gravatar...
I have the same problem too I'm getting Xbind Error. I dont understand why
Left by Yazılım Uzmanı on Dec 02, 2010 7:22 AM

Your comment:
 (will show your gravatar)

Copyright © Bunch | Powered by: