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
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
Note that the textboxes are always called MyTextBox + #
I am surprsied that you cannot do this yourself given the code you were supplied with before.
I don't do asp, but if there is an issue of som ekind I am sure that Old Pedant will sort it out.
Before you erased your thread you said you wanted the <div> not to display if the corresponding textbox value was 0. If that no longer applies you can easily adjust the above code.
Quizmaster: The Royal Albert Bridge at Saltash in Cornwall was designed and built by which engineer?
Contestant: Islamabad Brunel
Hi thnks for your help.
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.
Why did you start another thread asking the *SAME THING*???
In any case, *CLEARLY* you should be doing this in ASP.NET code and *NOT* using JavaScirpt. Period.
And there is NO REASON to use a <div> and then hide the <asp:TextBox> by hiding the <div>.
Instead, when you determine that you want to hide the form field yet still get its value when the <form> is posted, just use
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.
No anger, just a bit of frustration.
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.
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.
Fair enough :)
I would be interested in seeing how this would be done in ASP ?
But in case anyone else is wondering how they would do this:
Carry a number form one form to another and show/hide divs depending on this number.
Here is one method (there will be others)
This one uses
1st create 2 forms (ASPX)
call them Form1 and Form2
Code for form1
Code for form2
I hope someone will post a much simpler method of doing this - but until then this should start you along the way.
NOTE - I normally work with MySQL/SQL/VBA etc. I DON'T do websites, but due to cutbacks I am now the firm's webbie :confused:
|All times are GMT +1. The time now is 01:14 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.