-
[RESOLVED] Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hello Everyone,
Really, this is an amateur question, but I need to ask it anyway. :)
How do I capture other events in an asp.net textbox on a webpage in more of a way in which a windows app does? For example, if I want to handle when someone just presses a key (keydown) on a textbox in a webpage?
The functionality that we want to create breaks down like this:
- We want to create a "smart" search box at the top of our page.
- When the user starts typing, a little panel or some element should become visible and it will have some check boxes on it.
- They can search for one or many different types of searches: First Name, Last Name, Business Name, ZIP, Customer Number, and Contact Info.
- As they begin typing their search, we need it to execute some code that attempts to figure out exactly what they are searching. So if it can tell they are typing in alphabetic characters and not numbers, then we know to NOT check the Customer Number box, but we will want to check the First Name, Last Name, and Business Name boxes. If they start typing a number, we know that we can check the Customer Number box and leave the First Name and Last Name, etc boxes unchecked. If they type a number that is 5 digits, then we know to check the ZIP and Customer Numbers both. Any other length number characters and the ZIP will be unchecked. And any other rules like these that we might want to implement in the future.
- The idea here is we will almost always be able to tell what someone is searching, but the user can always check any box that they want to search for if they so choose. For example, if a business is named "123 Plumbing Company" and they just want to search the Business Name field for a number, they can over ride it and do that. Otherwise, they just can blindly type their search and hit enter and the program will usually know what kind of search they are trying to do.
I come from a strong windows app development background and have just recently tried to do some web development professionally. A quick few sentences on what philosophy I am missing out on as far as a more robust and "Windows App-like" webpage would be appreciated if anyone wants to coach me on that area and point me in the right direction! :o
Also, in my example we are using master pages. So if you can imagine a typical master page that has a logo top left and a search box and button top right, then you can picture what we have. Its simple looking. But with the content page being a separate aspx page, we are having trouble referencing it after a search is performed anyway. So what I mean by all this is
- The masterpage.master has a search textbox. They type something, hit enter.
- We then want a gridview that is on our default.aspx page to update with the results of the event that was fired from the masterpage.master.
My windows app background tells me to just point to it like I would from two different forms. Like if I had a form1 with a search box on it and I wanted it to show up the results on form2, I would just say Form2.Show: Form2.GridView = whatever.
Of course, with my confusion of what the scope of these asp.net pages is, I am having a difficult time just visualizing everything and how they are inter-related.
So I guess to recap here:
1) How do I tap into more events with textboxes or any other asp.net control. Is the answer AJAX? If so, can you elaborate just a little bit? :)
2) How would I use the keypress or keydown type of event to make a panel or some kind of content holder to become visible when the textbox gets focus from the cursor and go back to being invisible if it loses focus.
3) What about the scope in which asp.net pages behave?
I hope I haven't fudged up the question too bad. I went ahead and put some screen shots online that might help explain what we are trying to pull off. As the topic subject suggestions, this actually reminds me of what the search box looks like here on vbforums.com except that we want there to be some active code that fires without a postback.
http://i49.tinypic.com/t0jbix.jpg
Thanks for your time as always!
Sincerely,
Josh
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hey,
What technologies are you going to be using for this application?
ASP.Net?
ASP.Net AJAX?
Silverlight?
The answer you are looking for will depend heavily on which approach/technologies that you use.
Gary
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Thank you gep13. Gosh knew I'd forget the obvious!
We are using Visual Studio 2008 ASP.NET/VB.NET with the AJAXControlToolkit. No Silverlight at all at this point. .NET Framework 3.5, as well.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hey,
That's the type of info we need.
The Silverlight Control Toolkit isn't essential, so we should be able to proceed without it. There are a number of control in the AJAX Control Toolkit that will fit the bill nicely, so let's proceed on the basis that you are using that. Have you seen the control samples here:
http://www.asp.net/(S(fu2l2uzphr2u3u...olkit/Samples/
Immediately, the AutoComplete Extender stands out as a potential candidate:
http://www.asp.net/AJAX/AjaxControlT...oComplete.aspx
However, what I don't know off the top of my head is whether you are alter the content template to include check boxes.
Are the contents of the fly out consistent, or do they differ depending on what is typed into the box?
The other one (and maybe the best one) would be the PopUp Control:
http://www.asp.net/AJAX/AjaxControlT...upControl.aspx
Notice the second example, which I think is exactly what you have described, obviously with some changes.
Hope that helps!!
Gary
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hey thanks again, Gary!
The contents of the fly out are, indeed, consistent. They will not change in my example.
The only thing that I want to change on them is whether or not certain ones are checked based on what the user is typing. So as they type, I want it to run through the same function somewhere that decides what kind of text they are typing and just check on or off any of those boxes. When they actually click the search button or hit enter, it will then search and do things based on what check boxes were checked (so it doesnt matter if they were checked automatically by the smart function or if the user checked them at that point). This is how they override and fine tune what they want to search. I think its a decent solution as power users and laymen alike can use the same search box.
I've got a love/hate relationship with the AJAXControlToolkit at this point, but I do really like those examples you reminded me of there.
That example where the popup has the option boxes on it looks to be right up my alley, but I am wondering if it allows me to fire off code as they are typing or if it makes me bind some sort of data list to it in order to handle the filtering on its own?
I am going to dig into it right now and let you know how it goes!
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hey,
Unfortunately, I can't give you any exact answers on the questions that you are asking, but what I can say is, it is highly likely that you can customize these controls to do what you need. There is a lot of flexibility in the AJAX Control Toolkit, although it does take a minute to get your head round some of the aspects of it.
Let me know if you have any specific questions, and I will do my best to answer them.
Gary
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hello Gary and Everyone Again,
I've had no luck after trying this late yesterday and all day today. Many, many leads, but no successes. I made a little progress as far as getting a basic panel to show and hide when the textbox got focus, but I still don't understand how to make a VB Function fire off everytime a key is pressed on a textbox. I think this must be so simple that I am looking at it from the wrong angle.
The extenders that I looked at that you suggested just want to control what "value" is going to be in the textbox based on what options someone selects in that popup panel. I want to go at it the other way. I want what the person types in the box to dictate what controls get manipulated on the page...
Anyone know how to make a function fire off on a keypress in a textbox and, within that function, have it check/uncheck certain boxes on the aspx page based on what was typed into the textbox? :)
EDIT: Actually, I am finding several examples of this that all look promising throughout the web. I will check into those before bugging anyone. :)
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hey Josh,
Where have you got with this? Any success?
As a general overview, you should be able to "hook" into the keypress events of the browser, using JavaScript, and then taken some actions based on what you find typed into the TextBox, there should be some information here that set's you on your way:
http://dotnetslackers.com/articles/a...enderTips.aspx
If you need some further help, can you show the code that you are currently using?
Gary
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
AutoCompleteExtender won't let you go as fancy as that.
I think what you're describing can be accomplished with some javascript and some regex. The reason you'd use regex is so that you can identify what's being typed. It doesn't have to be regex but that's just an idea. The logic would be
User types something
Javascript function called
Get textbox contents
Compare with regex or some custom code in an if block
Based on value, make checkbox checked or unchecked unless it's already in a hidden field
Further, handle the onclick event for the checkbox and in there, store the value in the hidden field - this allows the user to override what your JS function would otherwise do.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Here's an example to get you started. Paste this into an .html file and view in a browser.
Code:
<script type="text/javascript">
function customPanel()
{
var input =document.getElementById('searchBox').value;
if(input.length > 0)
{
document.getElementById('chkPanel').style.display = 'block';
}
else
{
document.getElementById('chkPanel').style.display = 'none';
return;
}
if(input.length <= 5 && isNumeric(input))
{
document.getElementById('chkZIP').checked = true;
}
else
{
document.getElementById('chkZIP').checked = false;
}
}
function isNumeric(n)
{
return !isNaN(parseFloat(n)) && isFinite(n);
}
</script>
<input type="text" id="searchBox" onkeyup="customPanel();" />
<br />
<br />
<div id="chkPanel" style="display:none;">
<input type="checkbox" id="chkZIP" value="ZIP" />ZIP <br />
<input type="checkbox" id="chkName" value="Name" />Name
</div>
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Quote:
Originally Posted by
mendhak
AutoCompleteExtender won't let you go as fancy as that.
What about the PopUpControl though, I think that is what josh is trying to implement?
Would you recommend doing away completely with the AJAX Controls, and simply do this in JavaScript?
Gary
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
I was thinking about that. It could go either way. The code that "detects" what the user is typing in could either be in that javascript method or it could be in a PageMethod (in C#/VB.NET) which in turn affects the PopupControl. The only difference would be that the codebehind method would be faster to write, the javascript method would be faster to execute (as there's no XmlHttpRequest call happening) which covers fast typers.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hmm, that's a good point.
The OP could fall into the same issue that motil had over in the other thread where two keys being pressed too quickly caused issues with the code as well.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
I second mendhaks example and logic. The ajax toolkit is great "out of the box" but I find it becomes expotentially complex to customise the further away from the standard controls you get.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
One thing you need to realize (I think) is that your aspx.vb code behind functions live on the server. They can't be called unless there is some sort of postback or ajax call (which is really just an asynchronous postback of sorts).
So when you need to do stuff on the client like you are describing it usually means you're going to need to write some javascript. I think it sucks but that's the way it is right now. So I would start by learning some JS and about the DOM.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Thanks for that example, mendhak. It, of course, did exactly what I needed.
Conceptually, I have been battling with the idea you guys also mentioned just now about the postback that occurs naturally from an AJAX perspective if you want to have code checking the keypress and just wrapping it into a little update panel.
We are a VB.NET shop with no Javascript gurus around. The example here is simple enough, though, and I think it will work for us.
My only concern that I had and one that I know my boss will want to talk about is the fact that when you use the inline javascript like this, isn't it (and any logic) exposed to the user if they want to see it? Some of the business rules we'll have in place for determining which boxes to check are slightly sensitive in nature. So if I could get away from Javascript or anything that can be viewed in the pagesource by a bad guy that'd be great. Is there a way to just hide client side javascript functionality? Or is there still a way for a bad guy to get at and see the code?
Oh and the latency issue with doing a little postback with every keystroke will be fine for our situation the more I think about it because this is going to be used in house (behind our firewall) by our company about 90% of the time and only be used outside in the world (outside the firewalL) a little bit here and there.
Even something like a timer could drive this logic, too, so its not so heavily dependent on server side postbacks with every keystroke. Then at submit time the same logic could be executed to check the necessary boxes in case the timer isn't fired before they hit enter.
Just some thoughts. I really don't know what the hell I am doing, lol.
Thanks for the insights and the help with hashing this out with the best practices! That's much more than I bargained for when asking the questions. Rock n roll!
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hey,
Simple fact it, anything that you write in JavaScript will be visible to the end user. There are way to obfuscate the JavaScript, and make it difficult for someone to read, but if they are determined, then they will be able to get at it.
If you want to "hide" it, then the PageMethod method that Mendhak suggested would work for you. Here the work is done on the server, and out of sight of the end user. But, as mentioned, this would be a postback to the server.
Gary
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Quote:
Originally Posted by
joshjoneswas
Thanks for that example, mendhak. It, of course, did exactly what I needed.
Conceptually, I have been battling with the idea you guys also mentioned just now about the postback that occurs naturally from an AJAX perspective if you want to have code checking the keypress and just wrapping it into a little update panel.
We are a VB.NET shop with no Javascript gurus around. The example here is simple enough, though, and I think it will work for us.
My only concern that I had and one that I know my boss will want to talk about is the fact that when you use the inline javascript like this, isn't it (and any logic) exposed to the user if they want to see it? Some of the business rules we'll have in place for determining which boxes to check are slightly sensitive in nature. So if I could get away from Javascript or anything that can be viewed in the pagesource by a bad guy that'd be great. Is there a way to just hide client side javascript functionality? Or is there still a way for a bad guy to get at and see the code?
Oh and the latency issue with doing a little postback with every keystroke will be fine for our situation the more I think about it because this is going to be used in house (behind our firewall) by our company about 90% of the time and only be used outside in the world (outside the firewalL) a little bit here and there.
Even something like a timer could drive this logic, too, so its not so heavily dependent on server side postbacks with every keystroke. Then at submit time the same logic could be executed to check the necessary boxes in case the timer isn't fired before they hit enter.
Just some thoughts. I really don't know what the hell I am doing, lol.
Thanks for the insights and the help with hashing this out with the best practices! That's much more than I bargained for when asking the questions. Rock n roll!
The PageMethod would be a partial postback that occurs. When a key is pressed, that part of the page will be sent to the codebehind and your PageMethod method will get raised, it can then determine what to do, and it then sends the HTML to replace that area of the page with. It won't expose the logic, but it does still expose it in the sense that anyone can run Fiddler and have a look at the requests going back and forth.
You mentioned that it's an in-house application so I'm not sure who you want to hide this from. There might be UI issues associated with the partial postbacks occurring while the user is typing info into the textbox, and you'll also want to observe the results of a fast typer in the box.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
menhak, you are correct about the fast typing. That is the first thing I have noticed, but I have had only a little bit of time the last few days to mess with it.
Just a little update here on what I have done.
I ended up doing the webservice (I guess that's what you call it) with the pagemethod psotback. Took me a little bit of messing around with it, again, because I am not that well versed in ASP.NET just yet.
I now have an onkeyup() event on a regular HTML textbox that is calling a javascript function that is, then, calling a code behind function in that webservice that determines the nature of the text in the box. If its not blank, it updates the "visibility" property of my panel
ie:
Code:
document.getElementById('chkPanel').style.visibility = 'visible';
or it makes it invisible if there is no text in there.
Now, my only problem is the fact that the webservice sub that I have can't reach out to my master page and check/uncheck the controls. It doesn't know they exist. At first, the scope here confused me, but the more I read about webservices the more it made sense (I think :) ). I guess the nature of a webservice is to be separate from an app and to only accept and send back information---not directly interact with the controls on the webpage.
So, I figure I will pass some value ByRef back to that Javascript function (if it'll let me) which the javascript function can then use to check/uncheck the boxes on the form.
Unless anyone knows of a way where I can have the javascript call a server side function that can, then, just update the webpage and its controls with VB code so I don't have to do it in Java?
In other words, the java function calls a server side method that says
vb Code:
'(pseudo-code)
MasterPage.CustomerNumber.Checked = True
That'd be my victory of the week! Any thoughts? :)
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Quote:
Originally Posted by
joshjoneswas
At first, the scope here confused me, but the more I read about webservices the more it made sense (I think :) ). I guess the nature of a webservice is to be separate from an app and to only accept and send back information---not directly interact with the controls on the webpage.
Very good, yes. That's exactly what web services are about.
Quote:
So, I figure I will pass some value ByRef back to that Javascript function (if it'll let me) which the javascript function can then use to check/uncheck the boxes on the form.
Unless anyone knows of a way where I can have the javascript call a server side function that can, then, just update the webpage and its controls with VB code so I don't have to do it in Java?
In other words, the java function calls a server side method that says
vb Code:
'(pseudo-code)
MasterPage.CustomerNumber.Checked = True
That'd be my victory of the week! Any thoughts? :)
But that aside, remember that javascript is simply a browser implementation, so you can't have the serverside code return any old JS. Which means in turn that ByRef is meaningless. You need to pass the explicit ID of the control that you want to enable or disable if you'd do such a thing, but that isn't what you want either.
Think about the logic here a bit - you're passing what's in the textbox to a web service method. The purpose here is to get "a response" from the web service and based on that, check uncheck certain checkboxes. It's not 1 checkbox so you can't do a true or false. It'll have to be multiple values.
So what you can do is return a string array or a comma separated string with true and falses in it. Because it's a PageMethod service, it's OK to do it this way but not a good idea in real world services. So yeah - return an array or comma separated string:
true,false,false,false,true
When the JS receives it, it can split the string, look at each true/false and it then 'knows' that the first value is for CheckBox1, second for CheckBox2 and so on. You have to do it this way because JS isn't aware of the concept of master pages either and because your web service method is actually page agnostic (it may as well be in an ASMX), the only way for you to perform this operation is to do it via the JS rather than the PageMethod's own code.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Well its good to know I've got a concept down at least! This **** has confused me for months on end.
I never could get a JavaScript function to receive anything back from a webservice. I don't know what I was doing wrong, but I don't even want to bother trying to explain it because it felt like I needed to take a cold shower after attempting it anyway. This whole idea of using Javascript is not what I thought ASP.NET, Visual Studio 2008, etc was all about. I mean, technically, I don't want to ever have to look at JavaScript. I know that is not going to happen as its all over the web, but I was under the impression the average programmer wouldn't have to mess with it.
You described my problem perfectly, btw:
ASP.NET Textbox, they type, onkeyup() gets fired, launches a local javascript function, which then launches a server side function, which evaluates what is in the textbox, then (somehow) checks or unchecks certain boxes on the webpage (within a little update panel, actually)
I do not see why this is such a difficult thing. For the first time in a long time I really want to give up on something.
I saw some tricks where you could make JavaScript click an ASP.NET button on the page (which would be a neat little hack around) but I cannot get that to work even though all the folks are chiming in on the boards saying "WOW WORKED GREAT".
Code:
document.getElementById('<%= Button1.ClientID %>').click();
When I do that code in my JS function, it pukes on me. Says:
"The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)."
I figured it might have been because I had some commented code within my page there so I removed it. Still doesn't work.
So why that happens to me I do not know. It sucks because that would have worked for what I was trying to do, too.
I can make JavaScript click a regular HTML button, but that's pointless since that HTML button can't fire a server side function (I think).
I cannot get JavaScript to fire off any server side functions any way that I know of.
This really stinks. I just want to focus on a mostly VB environment without these hacks (which aren't working anyway) or these daisy-chained, horrid-looking, illogical call stacks that stem out for miles and are hard to follow and make the code look like heck. I don't think it will be sustainable in a real world environment without a team of gurus. That's not good.
Am I missing any other concepts, mendhak? I noticed you said:
Quote:
you can't have the serverside code return any old JS
Does that mean that when a JS function fires a webservice, the webservice needs to return actual rendered JS code that will then be executed on the client?
Also, any sample of a JS function calling a webservice with a parameter (text) and receiving a return value back would be greatly appreciated. That, indeed, would solve my trick! (Hate to ask for code outright like that, lol, but I'm seeing a bunch of junk around the web when googling like crazy these last several days).
Mendhak, Gary, and you others: Thank you. Sincerely.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hey,
One of the core things that I think you have to understand is that JavaScript is something you are going to have to get to grips with. At the end of the day, C# and VB.Net are very powerful languages, but the code that you write can only run on the server, it can't interact directly with what is going on in the client. The best method to do this is with JavaScript. Sure there are ways for JavaScript to communicate with the Server code, but this is something that you are going to have to invest some time in to understand, and I would recommend that you do this, as it will pay off in the future.
I personally don't like to see this:
Code:
document.getElementById('<%= Button1.ClientID %>').click();
As you are mixing the client and server code. You will see this technique all over the internet though, as it is the easy way to do it, but that doesn't mean to say that it is the right thing to do.
Having said that, what they are trying to do, although implemented incorrectly, IMO, the technique itself should have had the desired effect.
Can you show all the code that you were using? If this is too long, I would suggest that you start a new project, and just try and get this small part of the puzzle working and building from there.
Gary
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Quote:
Originally Posted by
joshjoneswas
Well its good to know I've got a concept down at least! This **** has confused me for months on end.
I never could get a JavaScript function to receive anything back from a webservice. I don't know what I was doing wrong, but I don't even want to bother trying to explain it because it felt like I needed to take a cold shower after attempting it anyway. This whole idea of using Javascript is not what I thought ASP.NET, Visual Studio 2008, etc was all about. I mean, technically, I don't want to ever have to look at JavaScript. I know that is not going to happen as its all over the web, but I was under the impression the average programmer wouldn't have to mess with it.
Hmm, but it is. The web is all about loosely defined standards that somehow manage to work together in a delicate, fragile way :D And you'll also have to accept that web development is about HTML, CSS and JavaScript. ASP.NET is just a technology that lets you facilitate the creation of HTML, CSS, JavaScript. Also, I consider it to be very important to understand because if you don't understand JS, then some of the behavior of ASP.NET in general will confound you.
Quote:
You described my problem perfectly, btw:
ASP.NET Textbox, they type, onkeyup() gets fired, launches a local javascript function, which then launches a server side function, which evaluates what is in the textbox, then (somehow) checks or unchecks certain boxes on the webpage (within a little update panel, actually)
I do not see why this is such a difficult thing. For the first time in a long time I really want to give up on something.
I saw some tricks where you could make JavaScript click an ASP.NET button on the page (which would be a neat little hack around) but I cannot get that to work even though all the folks are chiming in on the boards saying "WOW WORKED GREAT".
Code:
document.getElementById('<%= Button1.ClientID %>').click();
When I do that code in my JS function, it pukes on me. Says:
"The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)."
Stop stop stop stop, don't go for the hacks! You were doing alright - but if you got stuck, show us your code and we can help. Try doing it by calling a server side method. But instead of approaching it all at once, split it into discrete steps. And it can be done in an easier way to start with since it's best you don't get caught up in understanding SOAP and ASMX just yet, save it for later.
1. Create a webpage, getaction.aspx, remove everything in its markup except for the @Page directive
2. In its Page Load method, do a Response.Write("hello")
3. On the search page, create a javascript method
4. In this JS method, do an XmlHttpRequest to
'getaction.aspx?check=' + document.getElementById('textbox1').value
5. Get the response (it should be hello)
6. Hook up the onkeydown to call this JS function
See where this is heading? You should then start tweaking things.
7. Change the Page Load in #2 to read Request.QueryString["check"] and do your actual validation there. Have it Response.Write("1,2,5") or whatever format you want.
8. Change the JS method in #4 to accept the 1,2,5 (or whatever format) and split it and check the various checkboxes.
Later, when you're more comfortable with ASP.NET, you can convert #1 to a proper web service.
Quote:
Am I missing any other concepts, mendhak? I noticed you said:
Does that mean that when a JS function fires a webservice, the webservice needs to return actual rendered JS code that will then be executed on the client?
It can but you don't want that because of the slightly sensitive nature of the logic, so returning JS would be against the point.
So, try that and post when you're stuck.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
My apologies if I inadvertantly "bump" this thread, but I just wanted to report back that I am still working with this thing and should be able to post sample code by the end of the week so everyone can see what I am working with so far. Perhaps, if I am lucky, I will be posting the solution and not just more questions! :)
You folks have been great. Thank you so much. Talk to you in a few days.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hey,
Good stuff, will be interesting to see how you get on. And don't worry about asking more questions, we like questions :)
Gary
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Here is the example code that an independent developer that does side work for us came up with to pull this off. He did it just as a quick favor for me. He used JSON and some other methods with a webservice to get it to work.
I added the logic for determining which boxes to check. I am still in the process of trying to go through and understand what the THE WORLD he did, lol, so any input on the logic would be appreciated as I am going to try to be learning it this afternoon.
Here is the link (800kb ZIP file which is over the 500kb limit for vbforums I guess):
Here is what the developer said to me when he sent the code to me:
Quote:
I am sending you a working example using jQuery. But it can be script manager making an ajax call just as easily. Sorry, I am no expert in VB.
Anyways, the server side is inside the WebService1.asmx, which has a Script Service attribute. I made it return json, therefore I’ve included a script for parsing json response. I had it on my machine for some time ago, you might find a better one on the internet. The jQuery script is also kinda old, the latest version I believe is 1.3.2.
But again, it does not have to be jQuery or json, the principle is all the same.
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
Hey,
Looks like there is quite a bit going on in there :)
Are you familiar at all with jQuery and JSON? If not, there will be a bit to catch up on.
One thing I did notice in the sample you posted is that once shown, the div with the checkboxes never goes away, is that intentional?
Gary
-
Re: Dynamically make visible certain panels (like the "search" here at vbforums.com)
It is, indeed, alot to try to digest as I am not familar with them at all. lol.
I am not too sure on the DIV thing you mentioned. I mean I don't *THINK* I care if it goes away or not, I just wanted it to be visible and not visible. That is what it does on my computer. Seems to work just fine. So I guess if you are asking if that DIV goes away as in is removed and is out of scope, then no.
I think it is about time to mark this one as completed. What do you think?
Guys, this has been the best help I have ever received on a web board.. EVER. I've been on the net since the mid-90's and have been on alot of boards, too, so that is saying alot.
Thank you all so very much! I mean it.
-Josh
-
Re: [RESOLVED] Dynamically make visible certain panels (like the "search" here at vbf
Hey,
Yes, this is what I meant, I would have thought that if I lost scope on the textbox, then the DIV (an html element) that shows all the checkboxes would have disappeared, re-appearing if I went back to the textbox. This is not a big issue, just something that I might have implemented.
Thank you for the nice words!!
Gary
-
Re: [RESOLVED] Dynamically make visible certain panels (like the "search" here at vbf
Yeah, it comes down to preferred style in the end. You could return XML, plain strings or JS back from the service because the main point is that you need to get the 'yes' and 'no' or 'isordernumber' and 'iszipcode' information back.