Results 1 to 3 of 3

Thread: how to hide a textbox in asp.net

  1. #1
    Join Date
    Dec 2008
    Posts
    161

    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?

  2. #2
    Join Date
    May 2008
    Posts
    2,015

    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

  3. #3
    Join Date
    Jan 2009
    Posts
    199

    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>

Similar Threads

  1. Replies: 2
    Last Post: 20-08-2010, 01:23 AM
  2. Textbox validation in ASP.NET
    By Kasper in forum Software Development
    Replies: 4
    Last Post: 19-01-2010, 07:28 PM
  3. Moving from one TextBox to another with TAB
    By GeforceUser in forum Software Development
    Replies: 3
    Last Post: 05-11-2009, 05:31 PM
  4. Auto-Hide toolbar won't hide?
    By Geoff from LA in forum Vista Help
    Replies: 8
    Last Post: 18-10-2009, 06:52 AM
  5. How to recover a value in a textbox
    By S_Asnodkar in forum Software Development
    Replies: 4
    Last Post: 29-04-2009, 03:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •