Advertisement

03.28.2008 at 10:48AM PDT, ID: 23278003
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

dynamic datasource of an embedded gridview in ASP.NET

I am displaying a gridview that has a template field containing a second gridview. The internal gridview needs to contain differing amounts based on a content field of the external gridview. I have created 2 datasource for the internal gridview, and am able, in the row databound event of the external grid, to pass the correct data. How do I dynamically change the datasource internally?
Here is my code, but page just hangs
If Mid(e.Row.Cells(2).Text, 5, 1) = "6" Then
                Dim s2 As SqlDataSource = CType(e.Row.FindControl("Sqlsrfees6"), SqlDataSource)
                s2.SelectParameters(0).DefaultValue = e.Row.Cells(0).Text
                s2.SelectParameters(1).DefaultValue = e.Row.Cells(1).Text
            Else
                Dim s2 As SqlDataSource = CType(e.Row.FindControl("Sqlsrfees"), SqlDataSource)
                s2.SelectParameters(0).DefaultValue = e.Row.Cells(0).Text
                s2.SelectParameters(1).DefaultValue = e.Row.Cells(1).Text
            End If
            e.Row.Cells(8).TemplateControl.DataBind()
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: dfisher6
Solution Provided By: dfisher6
Participating Experts: 1
Solution Grade: A
Views: 168
Translate:
Loading Advertisement...
03.28.2008 at 12:03PM PDT, ID: 21233238

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 12:08PM PDT, ID: 21233279

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 12:14PM PDT, ID: 21233315

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 02:00PM PDT, ID: 21234113

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 02:04PM PDT, ID: 21234137

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.04.2008 at 12:34PM PDT, ID: 21284981

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.28.2008 at 12:03PM PDT, ID: 21233238

Rank: Genius

The page usually takes a long time to load if you are loading a lot of data.

Bob
 
03.28.2008 at 12:08PM PDT, ID: 21233279
The control is by definition tied to the sqlsrfess data source - it usually loads in 3-4 seconds. I waited 10 minutes after putting the databind line in  - any ideas? Is the syntax correct?
 
03.28.2008 at 12:14PM PDT, ID: 21233315

Rank: Genius

Can you show me the HTML text for the GridView?

Bob
 
03.28.2008 at 02:00PM PDT, ID: 21234113
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" BackColor="White"
            BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" CellPadding="4"
            DataSourceID="SqlNonCredit" EmptyDataText="No classes match your selection criteria" Font-Size="Small" GridLines="Horizontal" HorizontalAlign="Left" Width="100%">
            <FooterStyle BackColor="White" ForeColor="#333333" />
            <Columns>
                <asp:BoundField DataField="TERM_CODE_KEY" SortExpression="TERM_CODE_KEY" >
                   
                </asp:BoundField>
                <asp:BoundField DataField="CRN_KEY" HeaderText="CRN" SortExpression="CRN_KEY" />
                <asp:BoundField DataField="Course" HeaderText="Course" />
                <asp:BoundField DataField="TITLE" HeaderText="Title" SortExpression="TITLE" />
                <asp:BoundField DataField="SEATS_AVAILABLE" HeaderText="Seats Available" SortExpression="SEATS_AVAILABLE" >
                   
                </asp:BoundField>
                <asp:TemplateField HeaderText="Meetings">
                   
                        <asp:SqlDataSource ID="SqlMeetings" runat="server" ConnectionString="<%$ ConnectionStrings:OracleConnect %>"
                            ProviderName="<%$ ConnectionStrings:OracleConnect.ProviderName %>" SelectCommand="SELECT DISTINCT SSRMEET_TERM_CODE, SSRMEET_CRN, SSRMEET_SUN_DAY || SSRMEET_MON_DAY || SSRMEET_TUE_DAY || SSRMEET_WED_DAY || SSRMEET_THU_DAY || SSRMEET_FRI_DAY || SSRMEET_SAT_DAY AS DAYS, TO_CHAR(TO_TIMESTAMP(SSRMEET_BEGIN_TIME, 'HH24:MI'), 'HH:MI A.M.') || NVL2(SSRMEET_BEGIN_TIME, '-', '') || TO_CHAR(TO_TIMESTAMP(SSRMEET_END_TIME, 'HH24:MI'), 'HH:MI A.M.') AS TIMES, TO_CHAR(SSRMEET_START_DATE, 'MM/DD/YYYY') || '-' || TO_CHAR(SSRMEET_END_DATE, 'MM/DD/YYYY') AS CLDATES FROM SATURN.SSRMEET WHERE (SSRMEET_TERM_CODE = :SSRMEET_TERM_CODE) AND (SSRMEET_CRN = :SSRMEET_CRN) ORDER BY CLDATES">
                            <SelectParameters>
                                <asp:Parameter Name="ssrmeet_term_code" />
                                <asp:Parameter Name="ssrmeet_crn" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlMeetings"
                            Width="350px" BorderStyle="None" ShowHeader="False">
                            <Columns>
                                <asp:BoundField DataField="CLDATES">
                                   
                                </asp:BoundField>
                                <asp:BoundField DataField="DAYS" NullDisplayText="TBA" ShowHeader="False" SortExpression="days" >
                                   
                                </asp:BoundField>
                                <asp:BoundField DataField="TIMES" ShowHeader="False" SortExpression="Times" >
                                   
                                </asp:BoundField>
                            </Columns>
                        </asp:GridView>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="site" HeaderText="Site" SortExpression="BLDG_DESC1" />
                <asp:BoundField DataField="Fees" DataFormatString="{0:c}" HeaderText="Fees" HtmlEncode="False" />
                <asp:TemplateField HeaderText="Sr Fees">
                   
                        <asp:SqlDataSource ID="SqlSrFees" runat="server" ConnectionString="<%$ ConnectionStrings:OracleConnect %>"
                            ProviderName="<%$ ConnectionStrings:OracleConnect.ProviderName %>" SelectCommand="SELECT SSRFEES_TERM_CODE, SSRFEES_CRN, SUM(SSRFEES_AMOUNT) AS SRFEES FROM SATURN.SSRFEES WHERE (SSRFEES_DETL_CODE <> 'TC') AND (SSRFEES_DETL_CODE <> 'TV') GROUP BY SSRFEES_TERM_CODE, SSRFEES_CRN HAVING (SSRFEES_TERM_CODE = :ssrfees_term_code) AND (SSRFEES_CRN = :ssrfees_crn)">
                            <SelectParameters>
                                <asp:Parameter DefaultValue="" Name="ssrfees_term_code" />
                                <asp:Parameter Name="ssrfees_crn" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderStyle="None"
                            DataSourceID="SqlSrFees" ShowHeader="False">
                            <Columns>
                                <asp:BoundField DataField="SRFEES" DataFormatString="{0:c}" HeaderText="SRFEES" HtmlEncode="False"
                                    ShowHeader="False" SortExpression="SRFEES">
                                   
                                </asp:BoundField>
                            </Columns>
                            <SelectedRowStyle BorderStyle="None" />
                        </asp:GridView><asp:SqlDataSource ID="SqlSrFees6" runat="server" ConnectionString="<%$ ConnectionStrings:OracleConnect %>"
                            ProviderName="<%$ ConnectionStrings:OracleConnect.ProviderName %>" SelectCommand="SELECT B.SSRFEES_TERM_CODE, B.SSRFEES_CRN, B.SSRFEES_AMOUNT * .75 + A.SRSUBFEES AS SRFEES FROM SATURN.SSRFEES B, (SELECT SSRFEES_TERM_CODE, SSRFEES_CRN, SUM(SSRFEES_AMOUNT) AS SRSUBFEES FROM SATURN.SSRFEES WHERE (SSRFEES_DETL_CODE <> 'TC') AND (SSRFEES_DETL_CODE <> 'TV') GROUP BY SSRFEES_TERM_CODE, SSRFEES_CRN HAVING (SSRFEES_TERM_CODE = :ssrfees_term_code) AND (SSRFEES_CRN = :ssrfees_crn)) A WHERE B.SSRFEES_CRN = A.SSRFEES_CRN AND B.SSRFEES_TERM_CODE = A.SSRFEES_TERM_CODE AND (B.SSRFEES_DETL_CODE = 'TC')">
                            <SelectParameters>
                                <asp:Parameter DefaultValue="" Name="ssrfees_term_code" />
                                <asp:Parameter Name="ssrfees_crn" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <RowStyle BackColor="White" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
           


            <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
        </asp:GridView>

 
03.28.2008 at 02:04PM PDT, ID: 21234137

Rank: Genius

1) How many rows to you get for the outer GridView, if you aren't binding the inner GridView?

2) That inner query seems pretty complicated.

3) I have approached that problem a different way.

4) Bind the outer GridView to a DataSource.

5) Bind the inner GridView to a DataView with the RowFilter set to filter the values that relate to the current row.

Bob
 
04.04.2008 at 12:34PM PDT, ID: 21284981
Here is how I changed the code to work (in the outer gridview row databound event:
If Mid(e.Row.Cells(2).Text, 5, 1) = "6" Then
                CType(e.Row.Cells(8).FindControl("GridView1"), GridView).DataSourceID = "sqlsrfees6"
                CType(e.Row.Cells(8).FindControl("GridView1"), GridView).DataBind()
                Dim s2 As SqlDataSource = CType(e.Row.FindControl("Sqlsrfees6"), SqlDataSource)
                s2.SelectParameters(0).DefaultValue = e.Row.Cells(0).Text
                s2.SelectParameters(1).DefaultValue = e.Row.Cells(1).Text
            Else
                CType(e.Row.Cells(8).FindControl("GridView1"), GridView).DataSourceID = "sqlsrfees"
                CType(e.Row.Cells(8).FindControl("GridView1"), GridView).DataBind()
                Dim s2 As SqlDataSource = CType(e.Row.FindControl("Sqlsrfees"), SqlDataSource)
                s2.SelectParameters(0).DefaultValue = e.Row.Cells(0).Text
                s2.SelectParameters(1).DefaultValue = e.Row.Cells(1).Text
            End If
Accepted Solution
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628