?
Solved

bind grid to sqldatasource based on user selection

Posted on 2013-12-05
3
Medium Priority
?
233 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
[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
  • 2
3 Comments
 
LVL 21

Expert Comment

by:Dale Burrell
ID: 39700114
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
ID: 39718001
I figured it out...
0
 

Author Closing Comment

by:NCSA SCADA
ID: 39726220
I figured out the issue myself
0

Featured Post

Technology Partners: 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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

770 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