Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 March 22nd, 2006, 02:24 PM
MDM MDM is offline
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic sql data source

Hi,

attempting to do smth here. got a datagrid, no sql data source attached. Have two hyperlinks above, click each of them makes a relevant dropdown box visible. Content in dropdown lists are data bound to the db.

on selection of the record in dropdown list and the click of the button attempting to attach the sqldata source to the grid. i.e

on click
{
  attach data source to grid
}

it seems as it takes the code in, but sends the error that the grid may not be without an sql data source. As one may see, tricky issue.

suggestions, wise ones?

appreciate that

mdm

  #2 (permalink)  
Old March 22nd, 2006, 03:18 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

what is your code and the name of your datasource?

  #3 (permalink)  
Old April 5th, 2006, 03:59 PM
MDM MDM is offline
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Attempt to attach two different data sources depending on the click of the button. Error message - cannot have data grid left un attached (by default)
--------------------------------------------------------------------------------------------------------------------------------------------------

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        DropDownList1.Visible = True
        DropDownList1.DataValueField = "Language"
        DropDownList1.DataTextField = "Language"
        DropDownList1.DataSourceID = "SqlDataSource2"
        Button1.Visible = True
        GridView1.DataSourceID = "SqlDataSource1"
        DetailsView1.Visible = True


    End Sub

    'Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    ' DropDownList1.Visible = True
    ' DropDownList1.DataValueField = "UserID"
    ' DropDownList1.DataTextField = "UserID"
    'DropDownList1.DataSourceID = "SqlDataSource4"

    'Button1.Visible = True
    'GridView1.DataSourceID = "SqlDataSource5"

    ' DetailsView1.Visible = True
    ' End Sub

  #4 (permalink)  
Old April 5th, 2006, 11:45 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

you need gridview1.datbind after you set the datasource

 


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
Open Source Tools to generate XML from SQL data ethanhunt XML 0 May 7th, 2008 02:55 PM
help writing dynamic form data to dynamic table ublend SQL Server ASP 1 June 1st, 2007 08:09 AM
Dynamic Data source with Native XML driver Nellie Crystal Reports 1 November 30th, 2006 11:42 AM
data source and SQL queries sss22 ASP.NET 1.0 and 1.1 Basics 1 October 24th, 2005 01:13 PM



All times are GMT -4. The time now is 10:12 PM.


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