.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

populate radiobutton list

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :ASP.Net

SqlConnection conn= new SqlConnection();
string qry = "select opt1,opt2,opt3 from ques where QID=" + DetailsView1.DataKey[0];
SqlCommand cmd= new SqlCommand();
SqlDataReader dr= cmd.ExecuteReader();
if (dr.HasRows)
RadioButtonList rb = (RadioButtonList)(DetailsView1.FindControl("RadioButtonList1"));
//string str = Convert.ToString(dr[0]);
rb.Items.Add(new ListItem(Convert.ToString(dr[0])));//(Convert.ToString(dr["opt1"]));


Please tell me the correct way to do this

View Complete Post

More Related Resource Links

problem...i want a list item to populate all data in gridview!!!


i have a dropdownbox and a gridview

what I want is to have a list item which populates all data in a gridview.

I have tried using list item selected value=0 but to no avail.

what is the easiest way to achieve this?

radiobutton list item make visible true or false in javascript

in my project i have used one radiobuttonlist according different user login , i want to make one of radiobuttonlist item visible true or false..   please help me to solve this issue.   thanks in advance.  

Fetch data from one list and populate another list


How to fetch the details from one list & show it in an another list in Sharepoint 2010.


List #1 : Total Project/Resource List

   Resources       Projects
         Resource1 Project1,project2
  REsource2 Project1,project3

List #2 : Resources Per project


How to fetch details from List1 based on projects (Projects (Multiline text) are comma seperted data)


How to bind two different list to dropdown base on radiobutton selection

  I have radio button and dropdown column types in sharepoint list, and apart from this i have two list. I want to bind the data to data from the two list base on the selection of radio button. If i select 'Yes' i want to bind from the one of two list, and when i select i want to bind it to another list. Is it possible in sharepoint ?. If yes can you help me out in this

Using a sharepoint list to populate a form then capture user input


Hi.  New to this forum but looks like a great resource.  I am using MOSS2007, Infopath 2007 and Nintex workflow 2007.

I have a form that will act as a report for each of the operational sites in my company.  Each site receives freight movements on a daily basis and these are on a schedule; I am trying to record the variances to that schedule.  What I have attempted to do is the following:

  • Create a sharepoint list that contains each of the scheduled arrivals per site.
  • Connect to this list in Infopath as a secodary data source.
  • Drop this in to the form as a repeating table.
  • Filter the list of arrivals by using the conditional formatting control on the section, bound to a drop-list where the user specifies the facility/site.

What I am trying to do is present these arrivals and have the user enter an "actual" arrival time next to each, then store the results on submit.  I therefore need to know two things, 1) how to capture an "actual" value for each row in the repeating table (at the moment this is pulled in as an empty field from the list) and 2) how to store the data on submit so it is there when the form is re-opened.

I hope this makes sense, happy to give you any further information that may be required.

Thanks, Matt

Rules on Drop Down List to populate another text field


I have a last name field in infopath 2007 web form with a drop down on sharepoint list. When they select a certain last name, I want it to populate the primary dept field on form. I set up a rule on the last name to set the primary dept field = to the primary dept field on datasource when the last name field is not blank. What I am getting is the primary dept value for the first record in the datasource. I am trying to understand what record I have. Do I need to do another query back to the datasource with the last name field to have the correct entries available to populate the dept field with? Please give me some clue. I am a programmer but not grasping the interplay between the datasource and the form and noit finding what I need in numerous google searches.



Search data from sharepoint list and populate repeating table (Seach text should be entre in first f


Hi All,

I am newbie to infopath.

I have assignment to search data from sharepoint list and display it to repeating table. Below is the case in detail.

i. User enter search text in first textbox of repeating table.

ii. After text enter you will Enter or click tab button.

iii. As user press Tab /Enter, the other textboxes of repeating table will populate with data automatically.

iv. If searched data rows are more then one, then dynamically add new row's in repeating table and  show searched data.

I am working at offical assignment and it's deadline is very tough. i had made extensive search at google and msdn forum but unable to accomplish. I would appreciate and thanks is some provide me solution in form to a small infopath application and code snippet.




dropdown list wont populate values from database


Hello everyone i need help. Ive been having this problem for almost  3 days now. dropdown list won't populate from database

Below is the code i am using:

<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PhotoAlbum.aspx.vb" Inherits="PhotoAlbum" %>

<asp:SqlDataSource ID="categoriesDataSource" runat="server"  
<%$ ConnectionStrings:ConnectionString %>"  
    SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId) ORDER BY [Name]"> 
<asp:QueryStringParameter Name="UserId" QueryStringField="ID"/> 

Populate in dropdown list control


Hello need some help on this one.  I am using ASP.NET with C# and Oracle database. I am trying to return some values from my select statement to fill my dropdown list control. I am designing this in a 3 tier architecture.  Here is my codes.  I am getting an error which states "Object reference not set to an instance of an object." I am returning the field name "NAME" to be filled in my dropdown control.  What I am doing wrong?


List.cs file code

public static string _GetClientList()


string clients = string.Empty;int SessUserID =

Populate list of values for runtime parameters. SQL server 2008



I have created a Trial balance report using report builder and have setup runtime filter parameters for GL description. I would like to populate  runtime filter parameter with values from the GL master table (GL00100) enableing users to select  values from the drop down list.

How  can i acheive this task? 





code SQL to populate gridview with multiple random list box selections, How to


I could use some help in coding a query.

I have a list box that allows for multiple selections (holding down the control key) the selection quantity is basically unlimited, but realistically should never be more than 50 to 100 items from the listing of about 3000 items.

I need to collect the list of selected items from the drop down list and retrieve each of their full records from the item master and populate a gridview.

Any help would be greatly appreciated.


Thanks again,



On excel sheet upload read the workbook and populate data to sharepoint list


Requirement in my current project:
In a document library when I upload an excel sheet, a specific workbook has to be read and the contents have to be uploaded to a sharepoint custom list.
The approach followed was create an event receiver and register as a feature. Following is the code for event receiver.

public override void ItemAdded(SPItemEventProperties properties)
            var list = getSPList("{150301BF-D0BD-452C-90D7-2D6CD082A247}");          
            SPListItem doc = properties.ListItem;
            doc["Msg"] = "items deleted from req list";
            string excelname=doc.File.Name;

UpdateListItems to populate multivalue in the lookup field of the list



I want to populate a column which is of type lookup.I used the web service provided by the sharepoint. This column should contain multiple values. For this I used the format ID;#lookupvalue.But the column is not getting populated.

The elbatch.InnerXML looks like IS

"<Method ID=\"2\" Cmd=\"New\"><Field Name=\"RFPRequirement\" Type=\"Lookup\">623</Field><Field Name=\"Product\" Type=\"Lookup\">232</Field><Field Name=\"Offering\" Type=\"Lookup\">49</Field><Field Name=\"Services\" Type=\"Lookup\">212;#B: Event Management Service;#215;#(B) Incident Management Service;#217;#(B) Proactive Problem Management Service</Field></Method>"

Also I tried separating only the IDs by ;#.The elbatch.innerxml is

"<Method ID=\"2\" Cmd=\&q

How to populate 2 custom list fields from one selection in a 'people or groups' selection


Hello everyone, I'm new to the forums.

I need to create a custom list that has the fields:

  • Name (get by People or groups - searched via e-directory)
  • Job Title
  • Picture

Now I want Job title to be auotimatically filled in depending on what name the user selected from the first option.  The actual date in e-directory already has the person's job title, so it seems resonable to me that when the user chooses the person they want to add, the person's job title automatically fills in a field.  However, I can't seem to be able to do that.  I created the Name field then when I went into the Show Field drop down, it had several options including telephone number, surname, job title.  I then selecvted which I wanted to show.  Is there a way to create another field that the user doesn't see that then is populated with the the job title, info which is otained from whatever name was selected?

Phew, sounds complicated, I know!

Also, In the picture field, I selected the field type as url/image, then selected show link as image.  But what I would prefer would be the option for the user to be able to browse the site, or their computer for the image file.  Currently, the user has to know the url for where the image is stored in a document library.

Any suggestions would be grateful

how to add radiobutton list in a detailsview or any other datacontrol


I am developing a website of online examination and i want to know how to display question of my paper along with its Answer options as radio button list. And if i use any data control then how to add radiobutton list n bind that list thru database

plz reply its urgent 

Radiobutton in Sharepoint list

We are currently facing a problem with the list connection webpart and was wondering if we could get help with this us.
I have created a list A in sharepoint 2007. I have added the list on a .aspx page in the site and connected it to another list B.  The radio buttons show up on List A now which when selected based on a common item filters the items in List B. The functionality works perfectly fine.
However, List A has been grouped and has lot of items under each grouping. When the user selects midway of this list, it does not collapse but shows the entire list expanded. Is there a way we can force the list to collapse when the user selects a radio button in the list?
Would really appreciate any feedback on this.

Problem with radiobutton list when viewstate disabled



I am having an issue with dropdown list when viewstate is disabled. The selectedindexchanged event fires even for the other events on the page.

I am pasting the code bello. To reproduce the issues I am mentioning please change the selected value of the dropdownlist and then click any button the selected indexchanged event fires even thought we didnot change the value.

<%@ Page Language="C#" AutoEventWireup="true"  EnableViewState="false" %>

<script runat="server">
	protected override void OnInit(EventArgs e) {
			new ListItem("Option 1"),
			new ListItem("Option 2"),
			new ListItem("Option 3"),
	protected override void OnLoad(EventArgs e) {
		SelectedValueOnLoadLabel.Text = OptionsDropDownList.SelectedValue;

	void OptionsDropDownList_SelectedIndexChanged(object sender, EventArgs e) {
		SelectedValueOnSelectedIndexChangedLabel.Text = OptionsDropDownList.SelectedValue;

    protected void btnTest_Click(object sender, EventArgs e)
        SelectedValueOnLoadLabel.Text = OptionsDropDownList.SelectedValue;

    protected void TestButton2_Click(object sender, EventArgs e)
        SelectedValueOnLoadLabel.Text = OptionsDropDownList.SelectedValue;

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