Solved

Conflict between DropDownList and Gridview

Posted on 2006-07-04
4
521 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Suggested Courses

734 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