473,320 Members | 2,000 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Hiding a textbox In ASP.NET

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??????

Apr 9 '07 #1
16 8903
"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
Apr 9 '07 #2
<%@ 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>

Apr 9 '07 #3
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
Apr 9 '07 #4
"psychomad" <bh*********@gmail.comwrote in message
news:11*********************@w1g2000hsg.googlegrou ps.com...

Well, as far as I can see, the code you posted refers to txtProduct_Number
twice:
txtProduct_Number.Text =
oDS.Tables("product").Rows(0).Item("Product_Number ")
and
<td style="width: 214px"><asp:textbox id="txtProduct_Number"
runat="server" Width="215px" /</td>
I can't see any code in which you are trying to hide the TextBox...
Apr 9 '07 #5
"Riki" <ri**@dontnagme.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>What should i do to Hide the Textbox??????

txtProduct_Number.Visible=false
That won't hide the textbox - it will actually stop it from even being
rendered and sent down to the client browser, which is not the same thing...
Apr 9 '07 #6
txtProduct_Number.Visible=false

This doesn't work...in fact the right code is

txtProduct_Number.Visible ="false"

but this doesn't work also!
The field Product_Number in my database is set to 'AUTO NUMBER'
and i dnt want it to be displayed when the page is running. The page
is meant for UPDATE of the Product and i don't want the administrator
to be able to change the product number as the Row must only be
Updated not Inserted!!!!
Apr 9 '07 #7
"psychomad" <bh*********@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
txtProduct_Number.Visible=false

This doesn't work...in fact the right code is

txtProduct_Number.Visible ="false"
No it isn't. The Visible property of webcontrols accepts boolean values, not
string values...
but this doesn't work also!
The field Product_Number in my database is set to 'AUTO NUMBER'
and i dnt want it to be displayed when the page is running. The page
is meant for UPDATE of the Product and i don't want the administrator
to be able to change the product number as the Row must only be
Updated not Inserted!!!!
So post the code where you are actually trying to hide this TextBox - you
still haven't done that...
Apr 9 '07 #8
the prob is that i don't know where to put the invisiblity of the
textbox Dear!!!!! I dnt kno if i must put it in th Sub or the 1st
Function or the 2nd Funcyion or the HTML code !!!!!

Apr 9 '07 #9
Display the product number in an <asp: Label...>, not in a textbox,
if you don't want it to be editable.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"psychomad" <bh*********@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
txtProduct_Number.Visible=false

This doesn't work...in fact the right code is

txtProduct_Number.Visible ="false"

but this doesn't work also!
The field Product_Number in my database is set to 'AUTO NUMBER'
and i dnt want it to be displayed when the page is running. The page
is meant for UPDATE of the Product and i don't want the administrator
to be able to change the product number as the Row must only be
Updated not Inserted!!!!


Apr 9 '07 #10
On Apr 9, 1:31 pm, "Juan T. Llibre" <nomailrepl...@nowhere.comwrote:
Display the product number in an <asp: Label...>, not in a textbox,
if you don't want it to be editable.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
==================================="psychomad" <bhavish1...@gmail.comwrote in message

news:11**********************@o5g2000hsb.googlegro ups.com...
txtProduct_Number.Visible=false
This doesn't work...in fact the right code is
txtProduct_Number.Visible ="false"
but this doesn't work also!
The field Product_Number in my database is set to 'AUTO NUMBER'
and i dnt want it to be displayed when the page is running. The page
is meant for UPDATE of the Product and i don't want the administrator
to be able to change the product number as the Row must only be
Updated not Inserted!!!!- Hide quoted text -

- Show quoted text -


THANKS dear... That was the idea !!!!! It was so easy yet i didnt
thought about it !!!!!

Apr 9 '07 #11
You could have set the text box to visible = false. Whilst it doesn't render
it, the content is still in the viewstate (if viewstate is still enabled for
the box). When the page posts back, you can still read its value, even
though it was not displayed.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"psychomad" <bh*********@gmail.comwrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
On Apr 9, 1:31 pm, "Juan T. Llibre" <nomailrepl...@nowhere.comwrote:
Display the product number in an <asp: Label...>, not in a textbox,
if you don't want it to be editable.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
==================================="psychomad" <bhavish1...@gmail.com>
wrote in message

news:11**********************@o5g2000hsb.googlegro ups.com...
txtProduct_Number.Visible=false
This doesn't work...in fact the right code is
txtProduct_Number.Visible ="false"
but this doesn't work also!
The field Product_Number in my database is set to 'AUTO NUMBER'
and i dnt want it to be displayed when the page is running. The page
is meant for UPDATE of the Product and i don't want the administrator
to be able to change the product number as the Row must only be
Updated not Inserted!!!!- Hide quoted text -

- Show quoted text -


THANKS dear... That was the idea !!!!! It was so easy yet i didnt
thought about it !!!!!
Apr 9 '07 #12
re:
!>THANKS dear... That was the idea !!!!!

You're quite welcome.

re:
!It was so easy yet i didnt thought about it !!!!!

Sometimes the simplest things trip us.
It takes somebody else to see what eludes us.

Been there, done that! :-)


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"psychomad" <bh*********@gmail.comwrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
On Apr 9, 1:31 pm, "Juan T. Llibre" <nomailrepl...@nowhere.comwrote:
Display the product number in an <asp: Label...>, not in a textbox,
if you don't want it to be editable.
Juan T. Llibre, asp.net MVP
====================
"psychomad" <bhavish1...@gmail.comwrote in message
>
news:11**********************@o5g2000hsb.googlegro ups.com...
The field Product_Number in my database is set to 'AUTO NUMBER'
and i dnt want it to be displayed when the page is running. The page
is meant for UPDATE of the Product and i don't want the administrator
to be able to change the product number as the Row must only be
Updated not Inserted!!!!-

THANKS dear... That was the idea !!!!! It was so easy yet i didnt
thought about it !!!!!
Apr 9 '07 #13
"psychomad" <bh*********@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
the prob is that i don't know where to put the invisiblity of the
textbox
Put it anywhere you like - it hardly matters...

"><asp:textbox id="txtProduct_Number"
runat="server" Width="215px" />
txtProduct_Number.Visible = False

or

asp:textbox id="txtProduct_Number" runat="server" Width="215px"
Visible="false" />
Dear!!!!!
Dear...?
Apr 9 '07 #14
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:e5**************@TK2MSFTNGP04.phx.gbl...
!>THANKS dear... That was the idea !!!!!
I think you've made a "friend", Juan... ;-)
Apr 9 '07 #15
Even if she's a psycho and is mad, if we believe the name she uses.

:-)

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message news:OX**************@TK2MSFTNGP05.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:e5**************@TK2MSFTNGP04.phx.gbl...
>!>THANKS dear... That was the idea !!!!!
I think you've made a "friend", Juan... ;-)

Apr 9 '07 #16
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:O$**************@TK2MSFTNGP04.phx.gbl...
Even if she's a psycho and is mad, if we believe the name she uses.

:-)
Wow! As far as "benefit of the doubt" goes, that's a classic... ;-)
Apr 9 '07 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: wk6pack | last post by:
Hi, I would like to know if this is possible. I'm using ASP with JSCRIPT. I have a dropdown box that when the use selects a particular value, I would like the textbox to become visible....
1
by: Alexander | last post by:
I am building a little unique dialog editor and have derived some new classes like DButton, DLabel and DTextBox. The user adds these Controls to a panel which is part of a class Document which is...
1
by: Dan Neely | last post by:
I want to have my textbox display a scrollbar if there is more text than will fit, but to make it invisible if it will all fit. Is this possible? The default behavior if all the text fits is a...
0
by: Paul | last post by:
Hi I have a hidden Panel (DIV, style.visibility='hidden') control containing a hidden TextBox. If I make the Panel visible, then make the TextBox visible and then re-hide the Panel the...
3
by: MDB | last post by:
This may sound like a naive question, but that's only because I'm naive about most things ASP.NET, as my background is primarily Lotus Notes Development, and before that, DOS-based FoxPro. Is...
2
by: darrel | last post by:
When showing/hiding items on the front end via codebehind, one normally just sets the object to runat='server' and then set's its visibility to false. This works fine. However, when I have a...
1
by: c.verma | last post by:
I am not able to hide a href element using javascript. Here is my code written on aspx page. On the click of "OK" button, I want to hide href element. But I am getting message: Object required....
0
by: simon | last post by:
hello, I was hoping someone could help me with an issue (using vb & .net 2.0) I have a datagrid and the first column shown i have an asp:textbox that i basically want to "group by" an ID and only...
10
daoxx
by: daoxx | last post by:
Hello I've searched, posted and solved this (Thanks for helping!), but now it came back to bite me in the *ss. I have a Yes/No field that is represented by a check box in my form1. I want to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.