Subscribe to Subscribers
Talk to Webmaster Tony John

Online Members

Phagu Mahato
More...


Resources » Code Snippets » C# Syntax

List Controls from Different Collections


Posted Date:     Category: C# Syntax    
Author: Member Level: Gold    Points: 10



 


This coding is for List Controls from Different Collections

----------------------------------------------------------------

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;


public partial class LIstBoundingFromDatabase : System.Web.UI.Page
{
SqlConnection connection;
SqlCommand cmd;

protected void Page_Load(object sender, EventArgs e)
{

if (!Page.IsPostBack)
{
Connect();
}
}
public void Connect()
{
connection = new SqlConnection(" server=192.168.1.2;database=ProjectManagementSystem;user ID=sa; password=sa");
connection.Open();
cmd = new SqlCommand("dbo.select_StudentDemo", connection);
cmd.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter(cmd);

sda.Fill(ds);

// Binding Values To DropDownList
//*******************************

ddl_StudentName.DataSource = ds;
ddl_StudentName.DataTextField = "studentname";
ddl_StudentName.DataValueField = "studentid";
ddl_StudentName.DataBind();

// Binding Values To DropDownList
//*******************************

lb_Name.DataSource = ds;
lb_Name.DataTextField = "studentname";
lb_Name.DataValueField = "studentid";
lb_Name.DataBind();

// Binding Values To Radio Button List
//************************************
rbtnlist_Name.DataSource = ds;
rbtnlist_Name.DataTextField = "studentname";
rbtnlist_Name.DataValueField = "studentid";
rbtnlist_Name.DataBind();

// Binding Values To Radio Button List
//************************************
btlist_Name.DataSource = ds;
btlist_Name.DataTextField = "studentname";
btlist_Name.DataValueField = "studentid";
btlist_Name.DataBind();


cbl_Name.DataSource = ds;
cbl_Name.DataTextField = "studentname";
cbl_Name.DataValueField = "studentid";
cbl_Name.DataBind();


}
}





Did you like this resource? Share it with your friends and show your love!


Responses to "List Controls from Different Collections"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Get Contact information from outlook using C#
    Previous Resource: Paypal website payment pro in c#
    Return to Resources
    Post New Resource
    Category: C# Syntax


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    List Controls from Different Collections  .  List Controls from Different Collections  .  



    Follow us on Twitter: https://twitter.com/dotnetspider

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.