Please help me on how to extract selected excell cell then pass it to textbox in asp.net c#..please let me know
Loading
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
Anupam SinghRank #643 · 3.7K reputationPosted May 19, 2014, 3:28 AM EDT
:( your file having some readonly (security issues).
I am attaching a website here with my text excel file.
you just have to run this website in you system.
hope this will help you..
Anupam SinghRank #643 · 3.7K reputationPosted May 18, 2014, 9:22 PM EDT
read a nice example here
mary jean ligasRank #3,676 · 400 reputationPosted May 19, 2014, 2:11 AM EDT
heres my snippet:
string
{
connString =
}
{
connString =
}
connString = "";string fileType = Path.GetExtension(file.FileName).ToLower();string fileName = Path.GetFileName(file.FileName);string path = file.PostedFile.FileName;if (fileType.Trim() == ".xls")"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";else if (fileType.Trim() == ".xlsx")"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";//string query = "select [Vendor#],[Vendor Name],[E-mail],[Account Number],[Total Amount],[Remarks] from [Sheet1$]";
//string query = "select [VATINC] from [Sheet1$E9]";[Sheet1$A1:A1]"{
conn.Open();
string query = "select * from [Sheet1$]";OleDbConnection conn = new OleDbConnection(connString);if (conn.State == ConnectionState.Closed)OleDbCommand cmd = new OleDbCommand(query, conn);OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);//DataTable table = new DataTable();adapter.Fill(ds);
{
GridView1.DataSource = data;
GridView1.DataBind();
}
DataSet ds = new DataSet();foreach (DataRow dr in ds.Tables[0].Rows)string data = dr[0], dr[1], dr[2];arun prasath94 reputationPosted May 19, 2014, 2:21 AM EDT
mary jean ligasRank #3,676 · 400 reputationPosted May 19, 2014, 2:23 AM EDT
arun prasath94 reputationPosted May 19, 2014, 2:26 AM EDT
Anupam SinghRank #643 · 3.7K reputationPosted May 19, 2014, 2:26 AM EDT
Because you are saying that data should be in textbox but here in this code you are binding in grid.
mary jean ligasRank #3,676 · 400 reputationPosted May 19, 2014, 2:36 AM EDT
mary jean ligasRank #3,676 · 400 reputationPosted May 19, 2014, 2:38 AM EDT