在ASP.NET中隐藏文本框 [英] Hiding a textbox In ASP.NET

查看:58
本文介绍了在ASP.NET中隐藏文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有人能帮帮我吗?!我正试图在我的ASP.Net

源代码中隐藏一个文本框,但是它不起作用!


这是一部分我想要隐藏的HTML代码!

< tr>

< td style =" width:170px">

产品编号:< / td>

< td style =" width:214px">< asp:textbox id =" txtProduct_Number"

runat = "服务器"宽度= QUOT; 215px" /< / td>

< / tr>

我该怎么做才能隐藏文本框??????

解决方案

" psychomad" < bh ********* @ gmail.comwrote in message

news:11 ********************* @ w1g2000hsg.googlegrou ps.com ...


有人能帮帮我吗?!我正试图隐藏我的ASP.Net

源代码中的文本框,但它不起作用!



发布源代码


<%@ Page Language =" VB" debug =" true"%>

<%@ Import Namespace =" System.Data" %>

<%@ Import Namespace =" System.Data.OleDb"%>

< script language =" VB" runat = server>

Dim oConn As New OleDbConnection(" Provider = Microsoft.Jet.OLEDB。

4.0; Data Source = C:\ bhavish_vb_asign\StoresDbs。 mdb")

Dim strProduct_Number as string


Sub Insert_Click(ByVal Src As Object,ByVal E As EventArgs)

Dim oDA作为OleDbDataAdapter

Dim oDS作为新数据集

Dim sSql As String

oConn.Open()

oDA =新的OleDbDataAdapter(sSql,oConn)

oDA.Fill(oDS,product)

txtProduct_Number.Text =

oDS.Tables( " product")。行(0).Item(" Product_Number")

End Sub


私函数更新(ByVal oConn作为OleDbConnection,ByVal

strInsertSQL As String)作为整数

Dim intQueryState作为整数

''连接数据库

oConn.Open()

''生成OleDbCommand对象

Dim cmdInsert As New OleDbCommand(strInsertSQL, oConn)

intQueryState = cmdInsert.ExecuteNonQuery()

oConn.Close()

返回intQueryState

结束函数


私有函数存在(ByVal oConn作为OleDbConnection,ByVal

值作为字符串,ByVal ValueColumn作为字符串,ByVal项目作为字符串,

ByVal ItemColumn As String,ByVal TableName As String,Optional ByVal

bIsNumeric As Boolean = False)As Integer

Dim blnUserAuthenticated As Boolean = False

''连接到数据库

Dim strSQL As String =" Select * from" &安培; TableName&

where &安培; ItemColumn& " =" &安培;项目& "'''AND" &安培; ValueColumn& " =" &

IIf(bIsNumeric,Value,""& Value&"''")

Dim cmd As New OleDbCommand(strSQL, oConn)

Dim objDataReader As OleDbDataReader

objDataReader = cmd.ExecuteReader()

oConn.Close()


结束功能


< / script>


< html>


< titleEDITING PRODUCTS< / title>



< form runat = server>


< h3>< font面= QUOT;宋体" color =" blue"> EDIT PRODUCTS< / font>< / h3>

< font color =" blue" face =" Verdana">< span style =" font-

family:Times New Roman">< span

style =" color: #cc0000">输入产品名称和

更新详情< / span>

< / span>< / font>

< br />

< br />

< table style =" font-family:Times New Roman">


< tr>

< td style =" width:170px">

产品编号:< / td>

< td style =" width:214px">< asp:textbox id =" txtProduct_Number"

runat =" server"宽度= QUOT; 215px" /< / td>

< / tr>

< / table>

< asp:button text ="更新产品" OnClick =" Insert_Click"

runat = server />

< p>

< asp:Label id =" Msg" ;前景色= QUOT;红色"字体名称="宋体"字体 -

尺寸=" 10" runat = server />


< / form>

< / body>

< / html>


psychomad写道:


hi,


有人能帮帮我吗?!我正试图在我的ASP.Net

源代码中隐藏一个文本框,但是它不起作用!


这是一部分我想要隐藏的HTML代码!


< tr>

< td style =" width:170px">

产品编号:< / td>

< td style =" width:214px">< asp:textbox id =" txtProduct_Number"

runat =" server"宽度= QUOT; 215px" /< / td>

< / tr>


我该怎么做才能隐藏文本框??????



txtProduct_Number.Visible = false

-


Riki


hi,

can someone help me?! I''m trying to hide a textbox in my ASP.Net
source code, but it''s not working!

This is part of the HTML code that i want to be hidden!
<tr>
<td style="width: 170px">
Product Number:</td>
<td style="width: 214px"><asp:textbox id="txtProduct_Number"
runat="server" Width="215px" /</td>
</tr>
What should i do to Hide the Textbox??????

解决方案

"psychomad" <bh*********@gmail.comwrote in message
news:11*********************@w1g2000hsg.googlegrou ps.com...

can someone help me?! I''m trying to hide a textbox in my ASP.Net
source code, but it''s not working!

Post your source code


<%@ Page Language="VB" debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb"%>
<script language="VB" runat=server>
Dim oConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.
4.0;Data Source=C:\bhavish_vb_asign\StoresDbs.mdb")
Dim strProduct_Number as string

Sub Insert_Click(ByVal Src As Object, ByVal E As EventArgs)
Dim oDA As OleDbDataAdapter
Dim oDS As New DataSet
Dim sSql As String
oConn.Open()
oDA = New OleDbDataAdapter(sSql, oConn)
oDA.Fill(oDS, "product")
txtProduct_Number.Text =
oDS.Tables("product").Rows(0).Item("Product_Number ")

End Sub

Private Function update(ByVal oConn As OleDbConnection, ByVal
strInsertSQL As String) As Integer
Dim intQueryState As Integer
'' Connect to Database
oConn.Open()
''Make the OleDbCommand object
Dim cmdInsert As New OleDbCommand(strInsertSQL, oConn)
intQueryState = cmdInsert.ExecuteNonQuery()
oConn.Close()
Return intQueryState
End Function

Private Function Exists(ByVal oConn As OleDbConnection, ByVal
Value As String, ByVal ValueColumn As String, ByVal Item As String,
ByVal ItemColumn As String, ByVal TableName As String, Optional ByVal
bIsNumeric As Boolean = False) As Integer
Dim blnUserAuthenticated As Boolean = False
'' Connect to Database
Dim strSQL As String = "Select * from " & TableName & "
where " & ItemColumn & "=''" & Item & "'' AND " & ValueColumn & "=" &
IIf(bIsNumeric, Value, "''" & Value & "''")
Dim cmd As New OleDbCommand(strSQL, oConn)
Dim objDataReader As OleDbDataReader
objDataReader = cmd.ExecuteReader()
oConn.Close()

End Function

</script>

<html>

<titleEDITING PRODUCTS</title>

<body background="pale.jpg" bgproperties="fixed">

<form runat=server>


<h3><font face="Verdana" color="blue">EDIT PRODUCTS </font></h3>
<font color="blue" face="Verdana"><span style="font-
family: Times New Roman"><span
style="color: #cc0000">Enter Product Name and
Details for Update </span>
</span></font>
<br />
<br />
<table style="font-family: Times New Roman">

<tr>
<td style="width: 170px">
Product Number:</td>
<td style="width: 214px"><asp:textbox id="txtProduct_Number"
runat="server" Width="215px" /</td>
</tr>
</table>
<asp:button text="Update Products" OnClick="Insert_Click"
runat=server/>
<p>
<asp:Label id="Msg" ForeColor="red" Font-Name="Verdana" Font-
Size="10" runat=server />

</form>
</body>
</html>


psychomad wrote:

hi,

can someone help me?! I''m trying to hide a textbox in my ASP.Net
source code, but it''s not working!

This is part of the HTML code that i want to be hidden!
<tr>
<td style="width: 170px">
Product Number:</td>
<td style="width: 214px"><asp:textbox id="txtProduct_Number"
runat="server" Width="215px" /</td>
</tr>
What should i do to Hide the Textbox??????

txtProduct_Number.Visible=false

--

Riki


这篇关于在ASP.NET中隐藏文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆