Get Data from SQL Server to TextBox, Dropdown and RadioButton in Asp.Net c#.

preview_player
Показать описание
Complete CRUD Operation in Asp.Net C# LINK

Get data from SQL to textbox
Get data from SQL to dropdown
Get data from SQL to Radiobuttonlist

Code-

SqlConnection con = new SqlConnection("Data Source=ROWSHAN-PC;Initial Catalog=ProgrammingDB;User ID=sa;Password=swfit129");
protected void Button5_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand comm = new SqlCommand("select * from StudentInfo_Tab where StudentID= '" + int.Parse(TextBox1.Text) + "'", con);
SqlDataReader srd = comm.ExecuteReader();
while (srd.Read())
{
TextBox2.Text = srd.GetValue(1).ToString();
DropDownList1.SelectedValue = srd.GetValue(2).ToString();
TextBox3.Text = srd.GetValue(3).ToString();
TextBox4.Text = srd.GetValue(4).ToString();
RadioButtonList1.SelectedValue = srd.GetValue(5).ToString();
}
con.Close();
}

------
This channel covers all the programming tutorial related with .Net- C#, linq, VB, SQL, Android, HTML, CSS, jQuery, Crystal Report and Microsoft Report.
So, please subscribe and keep in touch.

Visit my page in Facebook
------

More Tags
#GetDataFromSQLToAsp_Net #DisplayDataFromSQLToTextBox #Asp_NetTutorial

Рекомендации по теме
Комментарии
Автор

How crud operation( Edit, update, delete, cancel) perform on dropdownlist using gridview with coding ?

kavitasharma-yrgc
Автор

Can you tell me how to add radio buttons in linq dataconnection in C#?

poornimamanogaran
Автор

Very Nice. Thank for this awesome tutorial.

globalinvest