How can I get the datasource to refresh itself - asp: sqldatasource wizard

I am trying to use the asp: SqlDataSource wizard to populate my drop down list.  My drop down list gets populated based upon what another drop down's selected value is.  Now, during the page load, the drop down list gets populated correctly.  But, when the user changes the selected value of the 2nd drop down, (which is what the first drop down list uses the selected value to bring back the records) the first drop down list does not populate new data.  How can I get the databind to fire off automatically again on selected index change of the 2nd drop down list?

I have attached my sqldatasource code that is attached to my first drop down list.
<asp:SqlDataSource ID="sqlDSLTLCarrierList" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:ProcessShipperConnectionString %>" 
                                        SelectCommand="SELECT [cname] FROM [LTLCarriers] WHERE ([plantid] = @plantid)">
                                            <asp:ControlParameter ControlID="DDLPlants" Name="plantid" 
                                                PropertyName="SelectedValue" Type="String" />

Open in new window

Who is Participating?
Bran-DamageConnect With a Mentor Author Commented:
I have gone another route with this.  None of these solutions worked for what I am trying to deal with.

is the first dropdown's autopostback property set to true?
Bran-DamageAuthor Commented:
No, I do not have the first one set to true, the second one is however.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

try using Text instead of SelectedValue for PropertyName
Bran-DamageAuthor Commented:
That did not work.  I'm going to try an explain this a little more in depth.

when the page loads, I have a drop down box that gets populated with location IDs.  Then another drop down box, (this one has the sqldatasource attached with the where clause being the locationid drop down box selectedvalue).  The location Id drop down box gets set to a default location, and everything I do on the screen populates correctly, even the sqldatasource drop down list.  Now, when someone changes the locationid drop down, there is a post back that happens, but the sqldatasource drop down list has old data in it from the previous locationid and no new data with the new selected location id.

Here is an example similar to what you are looking for.  It uses a drop down, gridview and 2 sqldatasource controls.

Bran-DamageAuthor Commented:
Went another route.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.