Solved

bind grid to sqldatasource based on user selection

Posted on 2013-12-05
3
214 Views
Last Modified: 2013-12-18
I have a grid that is bound to a sqldatasource.  I also have two additional sqldatasource's.
There is three radio buttons on the page, and when I user clicks one I want to rebind to the correct data source.. here is how I tried to do it, but did not work.. any help would be great (the rad's are set for auto postback)

 Protected Sub radShowAll_CheckedChanged(sender As Object, e As EventArgs) Handles radShowAll.CheckedChanged
        If radShowAll.Checked Then
            RadGrid1.DataSource = SqlAllOps
            RadGrid1.DataBind()
        End If
    End Sub

    Protected Sub radActive_CheckedChanged(sender As Object, e As EventArgs) Handles radActive.CheckedChanged
        If radActive.Checked Then
            RadGrid1.DataSource = SqlActiveOps
            RadGrid1.DataBind()
        End If

    End Sub

    Protected Sub radInactive_CheckedChanged(sender As Object, e As EventArgs) Handles radInactive.CheckedChanged
        If radInactive.Checked Then
            RadGrid1.DataSource = sqlInactiveOps
            RadGrid1.DataBind()
        End If

    End Sub

Open in new window

0
Comment
Question by:NCSA SCADA
  • 2
3 Comments
 
LVL 21

Expert Comment

by:Dale Burrell
Comment Utility
Firstly, why not use a single data source and pass the radio button value in as a parameter? That works out of the box.

Secondly if you do need multiple datasources, have you tried setting the DataSourceId property instead of the DataSource property?
0
 

Accepted Solution

by:
NCSA SCADA earned 0 total points
Comment Utility
I figured it out...
0
 

Author Closing Comment

by:NCSA SCADA
Comment Utility
I figured out the issue myself
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 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

16 Experts available now in Live!

Get 1:1 Help Now