I have to fill a dropdownlist with two value as (id, value) in asp.net application. That value only fill with dropdownlist. that id should be hide. when i click the value that id has to passed as internally. how to do this?
I have to pass a hide int value whenever i change the value of the dropdownlist in asp.net. How to do?
%26lt;%
' 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=" %26amp; Server.MapPath("xl_data.xls") %26amp; ";" %26amp; _
"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
%%26gt;
%26lt;table border="1"%26gt;
%26lt;thead%26gt;
%26lt;%
' Show the names that are contained in the first row
' of the named range. Make sure you include them in
' your range when you create it.
For I = 0 To iCols - 1
Response.Write "%26lt;th%26gt;"
Response.Write rstExcel.Fields.Item(I).Name
Response.Write "%26lt;/th%26gt;" %26amp; vbCrLf
Next 'I
%%26gt;
%26lt;/thead%26gt;
%26lt;%
rstExcel.MoveFirst
' Loop through the data rows showing data in an HTML table.
Do While Not rstExcel.EOF
Response.Write "%26lt;tr%26gt;" %26amp; vbCrLf
For I = 0 To iCols - 1
Response.Write "%26lt;td%26gt;"
Response.Write rstExcel.Fields.Item(I).Value
Response.Write "%26lt;/td%26gt;" %26amp; vbCrLf
Next 'I
Response.Write "%26lt;/tr%26gt;" %26amp; vbCrLf
rstExcel.MoveNext
Loop
%%26gt;
%26lt;/table%26gt;
%26lt;%
rstExcel.Close
Set rstExcel = Nothing
cnnExcel.Close
Set cnnExcel = Nothing
%%26gt;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment