when particular row is selected then all values have to be
displayed in rich text box(which is user control)
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sharad GuptaRank #111 · 20K reputationPosted Jun 11, 2013, 4:33 AM EDT
HI yadagiri uppari
Try this one......
using System;
using System.Data;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication12
{
public partial class Form1 : Form
{
SqlDataAdapter da;
DataTable dt;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
listView1.Items.Clear();
da = new SqlDataAdapter("select * from emp", "Data Source=MCNDESKTOP07;Initial Catalog=manish;User ID=sa;Password=***********");
dt = new DataTable();
da.Fill(dt);
foreach (DataRow dr in dt.Rows)
{
ListViewItem itm = new ListViewItem(dr["empId"].ToString());
itm.SubItems.Add(dr["empName"].ToString());
listView1.Items.Add(itm);
}
}
private void button2_Click(object sender, EventArgs e)
{
//for displaying in to textbox
if (listView1.SelectedItems.Count > 0)
{
richTextBox1.Text = listView1.SelectedItems[0].SubItems[0].Text +" "+ listView1.SelectedItems[0].SubItems[1].Text;
}
}
}
}
yadagiri uppariRank #7,043 · 250 reputationPosted Jun 11, 2013, 5:07 AM EDT
working....My problem is to get all values of row which is selected
in list view in asp.net