Click here to Skip to main content
16,015,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
Im trying to upload a excel file using asp.net,c#
Im trying to upload a excel sheet which contains dropdown lists,Im Not able to find the selected text of that dropdown.I Need to find that values and pass to backend
Posted
Comments
ZurdoDev 17-Feb-12 7:52am    
I think this was asked recently. However, where are you stuck? What have you done so far?
Ravi Vayyala 17-Feb-12 8:01am    
After selecting the data from excel through OleDbDataReader and while reading the data from it the plain cell data is accessible but there is a dropdown in that excel that drop down selected value can't be accessed.
some code is pasted below in that some are dropdown list columns in excel
that dtExcelSheetNames[0] in select query is sheetname of the excel

excelConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fine + "; Jet OLEDB:Engine Type=5;Extended Properties=\"Excel 8.0;IMEX=1;HDR=Yes;ImportMixedTypes=Text;\"";
OleDbConnection objconn = new OleDbConnection(excelConnection);

qry = "Select [Type],[Bank],[Party Type],[Party ID],[Purpose],[Instrument Type],[Instrument No],[Instrument Date],[Instrument Bank],[Instrument Branch],[Instrument Amount],[Remarks] from [" + dtExcelSheetNames[0] + "]";
OleDbCommand cmd = new OleDbCommand(qry, objconn);

OleDbDataReader dReader;
dReader = cmd.ExecuteReader();


while (dReader.Read())
{
//string rid = GetRegid(dReader["UserName"].ToString().Trim());
SqlCommand cmd1 = new SqlCommand("sp_uploadPaymnet", sqlcon);
cmd1.CommandType = CommandType.StoredProcedure;
cmd1.Parameters.Add("@FileName", SqlDbType.NVarChar).Value = Name + Extension;
cmd1.Parameters.Add("@TransType", SqlDbType.NVarChar).Value = dReader["Type"].ToString();
cmd1.Parameters.Add("@Bank", SqlDbType.NVarChar).Value = dReader["Bank"].ToString();
cmd1.ExecuteNonQuery();
}
Member 11819086 21-Aug-15 7:17am    
thank you for your responce @ vayyalaravi i have two dropdownlist and one file uploader to select excel sheet so that how can i do that? please help me


while uploading(sqlbulkcopy) the selected values from dropdownlist must be inserted ...



This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900