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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anupam SinghPosted May 19, 2014, 7:28 AM
:( 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..
mary jean ligasPosted May 19, 2014, 6:38 AM
mary jean ligasPosted May 19, 2014, 6:36 AM
Anupam SinghPosted May 19, 2014, 6:26 AM
Because you are saying that data should be in textbox but here in this code you are binding in grid.
arun prasathPosted May 19, 2014, 6:26 AM
mary jean ligasPosted May 19, 2014, 6:23 AM
arun prasathPosted May 19, 2014, 6:21 AM
mary jean ligasPosted May 19, 2014, 6:11 AM
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];Anupam SinghPosted May 19, 2014, 1:22 AM
read a nice example here