473,663 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

By default zero showing in the text box of .aspx page?

Hi experts,

I defined two integer values in the class. Like this

public class IntegerClass
public ID1 as Int32
public ID2 as Int32
End Class

then iam instantiating this class and assigning these values to the text box
id. After if i run the application by deafult zero is showing in the two text
boxes.

I don't want display the zero by deafult it should be blank. How to avoid
this zeros.

Can any one help me on this.

Thanks in advance

Nov 19 '05 #1
3 1601
in c#:

if (myIntegerClass .ID1 == 0)
txtBox.Text="";
else
txtBox.Text=myI ntegerClass.ID1 ;

Eliyahu

"pesani" <pe****@discuss ions.microsoft. com> wrote in message
news:2F******** *************** ***********@mic rosoft.com...
Hi experts,

I defined two integer values in the class. Like this

public class IntegerClass
public ID1 as Int32
public ID2 as Int32
End Class

then iam instantiating this class and assigning these values to the text box id. After if i run the application by deafult zero is showing in the two text boxes.

I don't want display the zero by deafult it should be blank. How to avoid
this zeros.

Can any one help me on this.

Thanks in advance

Nov 19 '05 #2
thank you for your reply.
"Eliyahu Goldin" wrote:
in c#:

if (myIntegerClass .ID1 == 0)
txtBox.Text="";
else
txtBox.Text=myI ntegerClass.ID1 ;

Eliyahu

"pesani" <pe****@discuss ions.microsoft. com> wrote in message
news:2F******** *************** ***********@mic rosoft.com...
Hi experts,

I defined two integer values in the class. Like this

public class IntegerClass
public ID1 as Int32
public ID2 as Int32
End Class

then iam instantiating this class and assigning these values to the text

box
id. After if i run the application by deafult zero is showing in the two

text
boxes.

I don't want display the zero by deafult it should be blank. How to avoid
this zeros.

Can any one help me on this.

Thanks in advance


Nov 19 '05 #3
Hello Pesani,

Int32 is a value type and therefore can not be assigned to null. It is always
initialized to 0. You should perform a check for zero, handling the situation
as appropriate.

--
Matt Berther
http://www.mattberther.com
Hi experts,

I defined two integer values in the class. Like this

public class IntegerClass
public ID1 as Int32
public ID2 as Int32
End Class
then iam instantiating this class and assigning these values to the
text box id. After if i run the application by deafult zero is showing
in the two text boxes.

I don't want display the zero by deafult it should be blank. How to
avoid this zeros.

Can any one help me on this.

Thanks in advance

Nov 19 '05 #4

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

Similar topics

9
2959
by: JohnSmith | last post by:
I suspect this is easy, but I have been stumped for a day trying to solve this.. I want to be able to have an unlimited number of aspx pages that all use the code in one class file. I want code in that class file to be able to read and write the controls on the aspx pages. For example, on all the aspx pages, I'll have a label named label1. From code in the class file, I want to be able to do something like label1.text = "hello world I...
2
2693
by: J Sahoo | last post by:
Hi, I have a browse page where I am showing few fields from my SQL Server table. One of the field is Image type, all the fields are bound to a single table. I want to show the image from the table on this browse along with the other fields. Here is the code what I have from the HTML view, I am using a datagrid to show the result. It does not show the image rather it shows "System.Byte " on the output. I did not have any code behind...
1
1052
by: Milsnips | last post by:
hi there, i got 2 textboxes and 2 buttons..both are search input and search buttons.. when i have focus of the 2nd textbox and i press enter, it always fires the event for the 1st button. Help????? Paul.
1
2121
by: digitalego | last post by:
Sorry if the title is a little confusing... Here is the problem. I am working with a "default.aspx" page that uses a user control I made: ------------------------------ | default.aspx | ------------------------------ <%@ Page language="C#" CodeBehind="ChartPage.cs"
5
1533
by: Steve | last post by:
Hi... new to ASP.NET... I am creating a DLL using VB.NET which my ASPX page will be calling. I have a class in the DLL (MyClass) which has a property (MyProperty). If the value assigned to MyProperty is set by my ASPX page to be out of bounds, I want to raise an exception that gets captured in the ASPX page, causing it to fail. This is working OK. However, when the page fails, in the browser the SOURCE ERROR part of the error page is...
1
6855
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle and page loading/rendering lifecycle.... Ok, now for the question: I have an ASPX page (page.aspx), and I have a UserControl (control.ascx). The UserControl has one textbox on the control, and one button control. I have added a public property...
4
6258
by: ~john | last post by:
If I have a label on the Master Page that I would like to change its text with a button on one of the content pages, Default.aspx... It's giving me an error saying "Label1" is not found. Can you only find controls on the current page.. ie Default.aspx.cs can only access controls on the Default.aspx page? ~john
1
2357
by: Jai | last post by:
Hi All, As When I am displaying my html page which contains images also inside content placeholder with panel control.....it is only showing text and not the Images.....................please suggest me...how can i do this..... I want to display html page(with images) inside a panel,and that panel is in contentplaceholder(master page)...............
2
9829
by: AlecL | last post by:
Hi All, I have added a user control onto an aspx page and want to make the submit button of that user control the default button when the panel in which the user control is located is visible. I have used the code: Page.RegisterHiddenField("__EVENTTARGET", "Login.btnSubmit") in the Page Load event but this does not make the submit button default(enter) button. Any ideas on how can I do this. I have also tried using just the name of...
0
8437
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8778
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2764
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.