Solved

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

Posted on 2010-11-29
7
649 Views
Last Modified: 2012-05-10
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)">

                                        <SelectParameters>

                                            <asp:ControlParameter ControlID="DDLPlants" Name="plantid" 

                                                PropertyName="SelectedValue" Type="String" />

                                        </SelectParameters>

                                    </asp:SqlDataSource>

Open in new window

0
Comment
Question by:Bran-Damage
  • 4
  • 3
7 Comments
 
LVL 6

Expert Comment

by:ajb2222
Comment Utility
is the first dropdown's autopostback property set to true?
0
 

Author Comment

by:Bran-Damage
Comment Utility
No, I do not have the first one set to true, the second one is however.
0
 
LVL 6

Expert Comment

by:ajb2222
Comment Utility
try using Text instead of SelectedValue for PropertyName
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Bran-Damage
Comment Utility
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.

0
 
LVL 6

Expert Comment

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

http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewDropDownList.src&file=GridViewDropDownList_cs.aspx&lang=C%23+Source

0
 

Accepted Solution

by:
Bran-Damage earned 0 total points
Comment Utility
I have gone another route with this.  None of these solutions worked for what I am trying to deal with.

Thanks.
0
 

Author Closing Comment

by:Bran-Damage
Comment Utility
Went another route.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now