Solved

bind grid to sqldatasource based on user selection

Posted on 2013-12-05
3
224 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

Independent Software Vendors: 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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

749 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