Solved

bind grid to sqldatasource based on user selection

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

919 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

20 Experts available now in Live!

Get 1:1 Help Now