If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Hide div if ASP text box IsNull (OnPageLoad)

Sorry if this is a double posting - I think I have deleted the text from the other (same) question. Not sure how I did that ??

I know this can be done with VB - something like this

Code:

If Not String.IsNullOrEmpty(Request.Form("SOME TEXT BOX NAME")) Then
strSOME OTHER NAME = Request.Form("SOME TEXT BOX NAME")

This can be to indiv boxes or whole divs.
But I am looking for a faster load and I think JS would not need to iterate though the whole form, and this is why I need to help with the JS

What I am trying to do is to set the Display:None or Display:Block of a div OnPageLoad, but this is dependant upon if a certain ASP:TextBox in the div contains data or IsNull.

Hope that make sense.

So, as an example, in this case
MyDiv1 would be style="display:none" as it is not null
MyDiv2 would be style="display:block" as it is null
MyDiv3 would be style="display:none" as it is not null
MyDiv4 would be style="display:block" as it is null

The other JS works really well OnClick (or OnChange) but this new requirement is that last stage in the process.

I have a serise of forms that a RequestForm call from the previous.
I am just trying to neaten up one forms. If there is no data called from the previous one then I don't want to shown an empty div.

Sorry about all the questions. I actually write databases and do the data-analasis for our Co. But with the cut backs the IT dept is now just 4 people (there were 12 last year), so I have been asked (told) to upgrade the on-line systems and lets just say it is a steep learning curve.

As I delete the other post by mistake.
Sorry if I have offended you in some way.

You don't sound very nice. I don't think there is any law that says you had to reply - it obviously made you very angry, so you may have been better just not bothering.

I understand that having made an average of (approx.) 15 posts per day for the past few years (since Feb., 09) you may have become quite possessive of the forum, but may I suggest that you chill out a little.

Thanks for taking the time to point out my errors , although in the end I used some simple VB (you'll be relieved to know)

Now as my mum would advise, you should take a few deep breaths or, better still, have a rest before answering any more posts.

I do understand that you are being called upon to do tasks that you have never learned to do, but Phillip *did* ask you why you weren't doing this in ASP.NET code and you ignored him.

One more time: You really should be doing all this with ASP.NET code. There is no good reason to use JavaScript for this. There are many reasons NOT to use JavaScript code for this.

If you don't know how to use ASP.NET, then maybe you will just have to go to your boss and say you need time to learn ASP.NET if he/she expects you to perform your job.

I really do have a lot of sympathy for you, stuck in a position where you have to make something work when you have no idea how. But at the same time, you need to take the advice of more experienced people and learn the right way to do the task.

You never have shown us any of the ASP.NET code you are using to create all this, so we can't tell you what to change in that code. And *THERE* is my personal source of frustration: What you want to do *SHOULD* be easy in ASP.NET, but a lot of it depends on how you write the ASP.NET code.

If you are willing to show the ASP.NET code, then you are more likely to get the right kind of help you need.

An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.