Solved

Conflict between DropDownList and Gridview

Posted on 2006-07-04
4
471 Views
Last Modified: 2012-05-05
Hi I am still fairly new to Web Development so please be easy with me if this is simplistic question :-)

I am using Visual Web Developer/VS2005 and VB.NET and on one particular web page I have both a Dropdownlist and a Gridview.

The gridview is bound to a SQL Table and when it is on it's own (i.e. without the dropdownlist on the same page the gridview works fine.

If I then put the dropdownlist on the same page, and bind it to another table in the database the gridview still works fine.

If (and this is how I want it) I manually add items to the dropdownlist and don't bind it to a table) then the gridview will not even display on the page.

I am at a loss as to why this should be, as the gridview and dropdownlist are not linked, and neither are the tables in the database.

Any help to get me going again would be very much appreciated.

Many thanks
...Steve
0
Comment
Question by:swtiley
  • 3
4 Comments
 
LVL 1

Author Comment

by:swtiley
ID: 17039309
Oh one additional piece of information - the dropdownlist and gridview are together in a webusercontrol.

...Steve

0
 
LVL 5

Expert Comment

by:nickhoggard
ID: 17040782
Hi,

When you say the gridview will not even display on the page, does it provide you any error messages?

Could you possibly provide a sample of the code you are using to add the items to the drop down list?

Cheers

Nick
0
 
LVL 1

Author Comment

by:swtiley
ID: 17040874
Hi Nick,

Thanks for the response.

I have now set up a "new" web-site consisting of one page and webuser control.

On the webuser control, I put one dropdownlist and one gridview, and then put the webusercontrol onthe webpage. If the dropdownlist is not bound to a datasource the gridview simply does not display.

There is no error message or anything, simply nothing happens (seems bizarre to me :-)

- In the new example I am not even trying to populate the dropdownlist - however for reference the code I previously used to populate the dropdownlist is


---------------
 If Not Page.IsPostBack Then
            cmdDB.CommandText = "SELECT Store_Name, Store_Number FROM opappslive.dbo.APPT_Store_Details order by store_number"
            rsDB = cmdDB.Execute
            rsDB.MoveFirst()

            DropDownList1.Items.Clear()
            DropDownList1.Items.Add("Unknown")
            While rsDB.EOF = False
                DropDownList1.Items.Add(Mid(rsDB.Fields("store_number").Value, 3, 4) & " " & rsDB.Fields("store_name").Value)
                rsDB.MoveNext()
            End While
        End If
       
    End Sub

----------------

Thanks forany help
... Steve
0
 
LVL 1

Accepted Solution

by:
swtiley earned 0 total points
ID: 17045532
OK - thread can be closed as resolved by myself
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

17 Experts available now in Live!

Get 1:1 Help Now