.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Bind SQL Data to a RadioButtonList

Posted By:      Posted Date: September 11, 2010    Points: 0   Category :ASP.Net
 Hi all, I need to bind data from an SQL Select Statement into a RadioButtonList and have not been able to come up with anything that works. <asp:Table runat="server" ID="TableTitle" Width="800px" CssClass="Table" Style="margin-top: 20px;"> <asp:TableHeaderRow runat="server"> <asp:TableHeaderCell runat="server" Font-Size="Medium" HorizontalAlign="Center" ColumnSpan="2">Title</asp:TableHeaderCell> </asp:TableHeaderRow> <%--Exam Questions--%> <asp:TableRow runat="server"> <asp:TableCell runat="server" HorizontalAlign="Left" Font-Bold="true" Text="Multiple Choice Question" ColumnSpan="2" /> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell runat="server" HorizontalAlign="Left"> <asp:RadioButtonList ID="RadioButtonQ1" runat="server" RepeatDirection="Vertical" /> </asp:TableCell> </asp:TableRow> </asp:Table> In my VB code behind I have a select statement that retreives the information from the database and randomizes the answers, but I am unable to get t

View Complete Post

More Related Resource Links

.NET Reflection: Dynamically Bind Your Data Layer to Stored Procedures and SQL Commands Using .NET M


One major inconvenience of using SQL stored procedures from code is having to match type information. You have to write long wrapper functions around the procedures just to expose the data types. In the .NET Framework, however, the reflection services of the System.Reflection namespace allow you to query rich metadata that describe data types. This article explains how to use reflection in .NET to end your stored procedure nightmares. The author creates four custom classes, including one that generates a SQLCommand object based on the metadata of a method. Using this library, you'll be on your way to automating the generation of stored procedures.

Atif Aziz

MSDN Magazine August 2002

Change data on gridview bind


Hi there,

Simple little problem. i have a gridview that shows products assigned to a customers job. They are displayed in exVAT prices. To make it easier i want to show the inc VAT prices. How can i add VAT to 1 column in this table?

Access and Bind data wihtout using Datasource Control


i want to bind my gridview with a dataset with concept of caching (to minimize the database server trips). plz give me a best example to get and bind data to gridview (command line) . grid paging is also enabled so example code should be capable to rebind data at Gridview page change.  

#BIND two seperate data items into one label

Hey people!I have a simple question.. but for the life of me cannot figure it out. I have two fields in my database (firstname and lastname)I have a formview, and I filter the results and I get two labels - one with firstname and one with lastname. I want to put the FIRSTNAME and LASTNAME together in one label but I am stuck lol. <asp:label id="label1" runat="server" SkinID="profilepropertylabel" Text='<%BIND ("Firstname") & BIND("Lastname") %>' />It only gives me the last name when I do that. Help?

Bind hierarchical data

Our system holds a DB table which stores catalogue records and catalogue items. The structure is heirarchical so catergory items can be children of category items in the same table, the catalogues are records with parentid = null; My question is if I populate one combox for the catalogues, how can I now bind my catalogue items combobox to the parents' children. Is this possible in XAML rather than code? Cheers Cheers

I need a suggestion to bind the data in share point 2010 page.Suggest some right control to do this.

In my visual web part i need a control to display rows with grouping option. In my web part i am going to display all my document library and  announcement so that i need groping option. I need to do grouping option in the view.so what is the best control u suggest me to bind my data? 


the database result is as follows DATE     code   class1 class2  class3 1/8/10     M1     10       20     30     3/8/10     V2      20       30     10      1/8/10      H1      1           2      3         7/8/10     ! ! 8/8/10     !M2    5      5      5       3/8/10     B2      4      4     4       1/8/10     V1      3      7     3       THE OUTPUT SHOULD BE AS FOLLOWS:- DATE           M1                          M2           

how to save radiobuttonlist data into database when they are in disable position

hiiiiiam using 2 radio buttonlist controls in web application they are FIRST      Yes    NoSECOND  Yes    NoInitially  SECOND radio button list is in disable position.when i was click on yes of FIRST radio button list, then SECOND radio button list is enables otherwise it is in disable mode only.here my problem is when i am inserting data into the database the disable radio button list gives error as System.NullReferenceException: Object reference not set to an instance of an object.code written for inserting isprotected void Button1_Click(object sender, EventArgs e)    {                    SqlConnection con = new SqlConnection(@"Data Source=STS2\SQLEXPRESS;Initial Catalog=STS;Integrated Security=True");            string sql;            sql = "insert into Table1(";            sql += "First,Second)";            sql += "values('";            sql += rbl_first.SelectedItem.Value.ToString() + "&

Bind Data to a Calender Control

I have a data on my Standby _ Table look like this in database   ID EMP_NO YEAR MONTH DAY 3 10001 2010 09 17 4 10002 2010 09 18 5 10002 2010 09 19   Now I want have this data displayed in a form of a Calendar , actually a full page calendar. My senario is I have employees doing standby weekly but I want to have their standby dates displayed in a form of a calendar , can somebody please help me even if it means I have to change the table structure.   Im using a VS2008 .NET 3.5 Regards,      

How to enable caching on SSRS that using SSAS cube to bind data


Hi All 

 How to set Cach refersh option for a SSRS report that using SSAS cube to bind data 

when i tried to store credential in data source getting error as show below 

"Non-Windows user credentials were supplied for a non-http connection to Analysis Services. The Microsoft SQL Server Analysis Services data extension requires Windows Integrated Security unless connecting via http or https."





how to bind object data source with bullited list


 i wanted to retrieve things from the data base and perform mathmatical operations on it then post it to the user, so i was told to use the bullited list and bind it to the object dataSource

how to perform such thing??

How to Data bind to a listbox on a wpf usercontrol ?


Hi ,

what i have is a Windows form and in that form i have a elementhost which hosts a wpf usercontrol. On that control is a wpf listbox. In the windows form i have a routine that fetches data form the db.

How can i bind that data to the list box using the "{Binding = ???} attribute in the XAML ?

Currently i bubble up an event and on the event in the windows form i call an action whcih binds to the listbox. is that the correct way to do it



Unable to drag data source to control to bind


I have a simple test application following the directions from http://msdn.microsoft.com/en-us/library/dd465159.aspx .  When I attempt to drag the data source onto the design surface I get the following error:

Cannot add the control to the design surface or bind to the control because the type TestApp.AdventureWorksEntities cannot be resolved.  Please try to build the project or add necessary assembly references.

The project as been built and the data source is in the same namespace.  I did a search for this error and the only hit I found was here, and mentioned Tools->Options->Extension Manager, 'Load per use extensions...'.  This option is checked.  I've tried unchecking and restarted with the same behavior.

Any ideas?


How to bind data from linq to html table without a single line of loop.




This is the above code i have worked using querysing and displaying the listitem with in  a simple html table. Here I am using foreach statement to bind items. How to bind the data to a simple html table using SharePoint linq without  a single line of loop.

using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Linq;
using Microsoft.SharePoint.Linq;

namespace QuerystringProgramWithoutLoop.QuerystringProgramWithoutLoop
    public class QuerystringProgramWithoutLoop : WebPart
        string strTitle=string.Empty;
        string strStatus=string.Empty;
        protected override void Render(HtmlTextWriter writer)

Reading data from RadioButtonList in PlaceHolder on dynamic site


Hi All, I have a big problem and I need your help.

I'm a new in ASP and I have this problem. I do some small websurwey. Random questions per page, random count of
questions, 4 types of questions (answears 1 .. 10, Text answears, ... atc.) I created webuserscontrol for each type
of questions and these controls I dynamicly add to place holder in some page. There is everything OK, but when I
click button on the bottom of the page, I need save the results from client, I need to know which radiobutton is
selected and save it to DB and make some operation, and then, after saving, this page is reloaded and show next
Questions. This questions and settings I have in DB. My problem is, how to read data from my UserControls after
button click (button on page, not on my controls)? Controls in placeholder are NULL in PostBack and after postback
there are new controls. Can somebody help me? I endclose a small code which is "like" my original code, it is
testcode to explaine to you.

Thank you very much

================================ShowQuestionsForm cs

using System;
using System.Collections;
using System.Collections.Generic;
//using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;
using System.Reflec

Unable to data-bind to a PasswordBox

When I attempt to bind to the Password property of the PasswordBox (binded to a property on an object that returns a string), I get the following error:

Object of type 'System.Windows.Data.Binding' cannot be converted to type 'System.String'.

Is string the wrong type....I tried char[] with the same result.

Active Directory bulk data update error System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIf



we are trying to update bulk data into Active Directory from some database table. If we run for say 40000 users, it fails in between While updating its failing with an exception that. The server is not operational.

at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_AdsObject()
   at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
   at System.DirectoryServices.DirectorySearcher.FindOne()

Below is the piece of code updating the records ...


While drDataReader.Read()
                strMailID = drDataReader.Item(("EMAILID")).ToString()
                strAttributeName = drDataReader.Item("ATTRIBUTENAME").ToString().Trim()
                strAttributeValue = drDataReader.Item("ATTRIBUTEVALUE").ToString().Trim()

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend