Bunch's Blog

  Home  |   Contact  |   Syndication    |   Login
  48 Posts | 0 Stories | 36 Comments | 0 Trackbacks

News

Tag Cloud


Archives

Green

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