Hi There,
I am trying to display some textboxes on my page, When I run the code the
textbox is written to the page (when I view source) but not to the screen.
Could someone tell me if I have the syntax correct?
Sean - thanks in advance for your answer
!-- code
response.write ("<asp:TextB ox runat=server id=" & strMFormValue &"
/></td></tr>" & Vbcrlf)
<% @Import Namespace="Syst em.Data" %>
<% @Import Namespace="Syst em.Data.SqlClie nt" %>
<script language="vb" runat="server">
Sub Page_Load(sende r as Object, e as EventArgs)
If Not Page.IsPostBack then
BindData()
End If
End Sub
Sub BindData()
Dim dbRead As SqlDataReader
Dim strMFormControl as string
Dim strMFormValue as string
Dim strMDFormContro l as string
Dim strMDFormValue as string
Dim myConnection as New
SqlConnection(C onfigurationSet tings.AppSettin gs("connectionS tring"))
try
myConnection.Op en()
Dim myCommand As New SqlCommand("Get FormById", myConnection)
myCommand.Comma ndType = CommandType.Sto redProcedure
dbRead = myCommand.Execu teReader()
While dbRead.Read ( )
strMFormValue = dbRead(1)
strMFormControl = dbRead(2)
strMDFormValue = dbRead(3)
strMDFormContro l = dbRead(4)
response.write ("<form runat=server><t able border=1 align=center>" &
Vbcrlf & _
"<tr><td colspan=2>" & dbRead(0) & "</td></tr>" & Vbcrlf & _
"<tr><td>" & strMFormValue & "</td><td>" & Vbcrlf)
DisplayFormItem (strMFormContro l,strMFormValue )
response.write ("<tr><td>" & strMDFormValue & "</td><td>" & Vbcrlf)
DisplayFormItem (strMDFormContr ol,strMDFormVal ue)
response.write ("</table></form>")
End While
dbRead.close
Catch oexpData As OleDb.OleDbExce ption
response.write ("an exception has occured,")
response.end
Finally
myConnection.cl ose
End Try
End Sub
!--- function here
Function DisplayFormItem (ByVal strMFormControl , ByRef strMFormValue)
Select Case Trim(strMFormCo ntrol)
Case "textbox"
response.write ("<asp:TextB ox runat=server id=" & strMFormValue &"
/></td></tr>" & Vbcrlf)
Case "checkbox"
End Select
End Function
</script>