In order to fill a dropdownlist with two value as (id, value) in an Asp.net application. When populating the dropdownlist, the id should be hidden. when an item is selected, that id has to be passed as internally. How can this be done?
1 thought on “How to pass a hide int value whenever i change the value of the dropdownlist in asp.net. How to do?”
Leave a Reply to Lobes Cancel reply
You must be logged in to post a comment.
<% ' Selected constants from adovbs.inc Const adOpenStatic = 3 Const adLockPessimistic = 2 Dim cnnExcel Dim rstExcel Dim I Dim iCols ' This is all standard ADO except for the connection string. ' You can also use a DSN instead, but so it'll run out of the ' box on your machine I'm using the string instead. Set cnnExcel = Server.CreateObject("ADODB.Connection") cnnExcel.Open "DBQ=" & Server.MapPath("xl_data.xls") & ";" & _ "DRIVER={Microsoft Excel Driver (*.xls)};" ' Same as any other data source. ' FYI: TestData is my named range in the Excel file Set rstExcel = Server.CreateObject("ADODB.Recordset") rstExcel.Open "SELECT * FROM TestData;", cnnExcel, _ adOpenStatic, adLockPessimistic ' Get a count of the fields and subtract one since we start ' counting from 0. iCols = rstExcel.Fields.Count %>
Response.Write rstExcel.Fields.Item(I).Name
Response.Write “
” & vbCrLf
Next ‘I
%>
<% rstExcel.MoveFirst ' Loop through the data rows showing data in an HTML table. Do While Not rstExcel.EOF Response.Write "
For I = 0 To iCols – 1
Response.Write “
Response.Write rstExcel.Fields.Item(I).Value
Response.Write “
” & vbCrLf
Next ‘I
Response.Write “
” & vbCrLf
rstExcel.MoveNext
Loop
%>
<% rstExcel.Close Set rstExcel = Nothing cnnExcel.Close Set cnnExcel = Nothing %>