how to hide a textbox in asp.net
There are two text boxes on my .net page they have function which activate but at different time. I want script to hide one text box while another text box is selected that means only one text box allowed to perform when it is selected. Is that possible?
Re: how to hide a textbox in asp.net
Code:
<%@ Page Language="VB" debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb"%>
<script language="VB" runat=server>
Dim text As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.
4.0;Data Source=C:\jamal_vb_asign\StoresDbs.mdb")
Dim myProduct_Number as string
Sub Insert_Click(ByVal frs As Object, ByVal G As EventArgs)
Dim BDA As OleDbDataAdapter
Dim BDS As New DataSet
Dim BSql As String
text.Open()
BDA = New OleDbDataAdapter(sSql, oConn)
BDA.Fill(oDS, "product")
myProduct_Number.Text =
BDS.Tables("product").Rows(0).Item("Product_Number ")
End Sub
Private Function update(ByVal text As OleDbConnection, ByVal
StextQL As String) As Integer
Dim textsql As Integer
' Connect to Database
text.Open()
'Make the OleDbCommand object
Dim strtext As New OleDbCommand(strInsertSQL, oConn)
intQueryState = cmdInsert.ExecuteNonQuery()
text.Close()
Return intQueryState
End Function
Re: how to hide a textbox in asp.net
Code:
hidetext1.Attributes.Add("onclick" , "HideTextbox(' " + hidetext2.ClientID + " ' , ' " + hidetext1.ClientID +" ');");
hidetext2.Attributes.Add("onclick" , "HideTextbox(' " + hidetext1.ClientID + " ' , ' " +hidetext2.ClientID +" ');");
In your .aspx page -
<script type='text/javascript'>
function HideTextbox(Horitxtbox , Vertxtbox)
{
document.GetElementByID((Horitxtbox).style.visibility = 'hidden';
document.GetElementByID(Vertxtbox).style.visibility = 'visible';
}
</script>