Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 13th, 2004, 03:40 PM
Registered User
Join Date: Dec 2004
Location: Boston, MA, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default This is driving me nuts!!! (datagrid in .ascx)

I have a VERY simple aspx page that has a usercontrol in it that just displays a list of names when you click a button. If I use this method for data retrieval/display it works:

      Dim connectionString As String
      connectionString = "Provider = Microsoft.Jet.OLEDB.4.0 ;User Id =;Password =;Data Source = " & dbName

      Dim myConnection As New OleDbConnection(connectionString)
      Dim myCommand As New OleDbCommand()
      Dim myInsertString As String

      myCommand.Connection = myConnection
      myInsertString = "select * from " & tName
      myCommand.CommandText = myInsertString

      datagrid1.datasource = myCommand.ExecuteReader()

    catch ex as exception
      response.write("Error : " & ex.message)
    end try

However, I need to use this code because this is the method used in other areas of the site:


     Dim cSearchText As String
        Dim cSearchText2 As String
        Dim Database As New ASGCommon.Database()
        Dim Dataset As New DataSet()

        Dim SQL2 As New System.Text.StringBuilder()

        cSearchText = "Adams"

        SQL2.Append("execute spGetDirectory @cSearch='" & cSearchText & "' ")

        Dataset = Database.GetDataSet("Employees", SQL2.ToString())

        Dim dvWebUsers2 As DataView = Dataset.Tables("Employees").DefaultView

        datagrid1 = New DataGrid()

        datagrid1.DataSource = dvWebUsers2

    catch ex as exception
      response.write("Error : " & ex.message)
    end try

I know that the stored proc is working because I can retrieve a recordcount and it is accurate.

It has to be the binding to the grid. What am I missing???

I'm thinking of a reward here since I have been stuck on this way too long!!!
Reply With Quote
  #2 (permalink)  
Old December 13th, 2004, 03:43 PM
Authorized User
Join Date: May 2004
Location: , , USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts

What is the nature of the problem?

Reply With Quote
  #3 (permalink)  
Old December 13th, 2004, 03:48 PM
Registered User
Join Date: Dec 2004
Location: Boston, MA, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Well, I have a page (index.aspx) that has a placeholder in it that I want to use to bind different datagrids to depending on what action the user takes. Essentially to reuse the same page over and over.

I set the "include" up like this:

placeholder.controls.add(loadcontrol("usercontrol. ascx")

*Where usercontrol.ascx holds the creation and binding of a datagrid*

When I do something simple like set the text of a label, it works fine. However, when I try to create a datagrid and then bind it, nothing happens. No error or anything. And when I step through it, it does everything is is supposed to do.

Is there something I am missing with the data binding?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! CommandButton Caption Driving Me Nuts! phoenixblue C# 0 September 29th, 2006 03:19 AM
This is driving me nuts... Klesk C# 3 January 27th, 2006 06:51 PM
Driving me nuts! bhd8ball Classic ASP Professional 2 January 7th, 2005 12:55 AM
English Query Problem is Driving me Nuts... davidlars99 Classic ASP Professional 0 September 29th, 2004 01:29 PM
Type mismatch - Going Nuts ivanv ASP.NET 1.0 and 1.1 Basics 1 July 10th, 2003 03:15 PM

All times are GMT -4. The time now is 12:21 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.