ASP.NET Dynamic Data field value disappears in the browser - asp.net

I have an ASP.NET Dynamic Data web application, with an entity called ActivationResource. One of the properties of this is a CellPhone field. Now, whenever I open a List or Details view of one of these entities, the cell phone number displays for a moment then disappears.
Anyone have any ideas as to the cause of this mysterious behavior?

Strange that it would disappear after showing up. This sounds like a client issue instead of server, since the server is out of the loop after returning the page (AJAX aside).
Things to try:
If you View Source on the page, do you see the phone number after it disappears?
If you write a static HTML page with a similarly formatted phone number, do you get the same behavior?
What browser are you using, and does it happen with others?
Sometimes, browser pluggins like to mess with what they detect as phone numbers to make them do special things (e.g. I think Skype does that).

Related

Scraping in R, aspx form don't know how to get data

Hello Im traying to scrape data from https://eservicios2.aguascalientes.gob.mx/sop/geobras/UI/frmObrasTodas.aspx
I can get the data from the main page but I don't know how to get the data from the form,
a) when choose a row and ask for "Detalle" , means detail goes to a form.
b) don't know how to follow the link
Need to get data from each row, can anybody help me.
the main issue and problem is that this is a asp.net web site. So, when you select a row, this likely uses a server side event. you MIGHT be able to write some JavaScript to select a row. But then the next issue is even more of a challenge. Once you select a row, then you have to click on a button. That button is going to run server side code. And that server side code is going to look at and grab the row value selected - VERY likely again server side code. Unlike say a simple web site with hyper-links?
.net sides are full driven from vb.net or c# code. We don't use silly things like hyper-links, or even silly parameters in the web URL.
So, after you select a row (perhaps possible in js), then you would then have to click on the details button. This again can be done with JavaScript
Say, in jQuery like this:
$('#NameOfButton').click();
So asp.net sites don't use simple code like what you see and get from someone who take that 3 day web developer program promising that now you are a experienced web developer. Asp.net sites as a result don't use simple HTML markup code and things like a simple hyper-link to drive the web site. There are no "links" for each row, but only code on the server side that runs to pull the data from the database, and then render that information, and THEN send it down as a html markup.
The bottom line?
The site is not simply HTML and simple hyper-links that you click on. When you click on that button, then the code behind (written in a nice language like c# or vb.net) runs. There is thus no markup code or even JavaScript code that is required here. You talking about clean and nice server side code. (and code written in a fantastic IDE - Visual Studio).
This means that aspx web sites are code behind driven, and as a result they are rather difficult to web scape in a automated fashion. You can get/grab the page you are on, but since there are no hyper-links to the additonal data (such as details), then you don't have a simple URL to follow/trace here.
Worse yet, the setup code (what occurs when you selected a single row) also in most cases has to be run. Only if all values are setup 100% correctly BEFORE hitting the "details" button will this thus work. And even worse, if you note, on the details page, there is no parameters in the URL. This means that not only is code behind required to run BEFORE the 2nd details page launches, but the correct setup code behind has to run. And even worse yet, is the 2nd page URL VERY likely also checks and ensures that the previous URL page was from the same site (as a result you can NOT JUST type in a url for the 2nd page - it will not work.
And in fact, if you look even closer? When you hit details button, the web pages re-loads, re-plots and renders what is CLEARLY a whole new web page and layout.
But note how the URL DOES NOT change!!! They are NOT even using a iframe for this.
This is because they are using what is called a server side re-direct. The key "tell tell" sign is that the URL remains the same, but the whole page layout is 100% different. What occurred is the server side did a re-direct to a 100% whole new page. But since the browser did not and was not causing this navigation? The code behind actually loads + displays a whole new web page and sends it down to the web client side.
However, note how the URL remains the same!!! This is due to the code behind is loading + displaying a whole new different web page - but since the navigation to that new page occurred with server side code?
Well then the server can load + send out anything it wants to the client - include a whole new web page, and you don't get nor see a web url change.
Again, this is typical of asp.net systems in which server side code drives the web site, and not much client side code.
You "might" be able to automate scraping. But you would need some custom code to select a given row, and then some code to click the details button. And that's going to be a REAL challenge, since any changes to the web page code (by you) also tend to be check for, and not allow server side.
The only practical web scrape approach would be to use some desktop tools to create a WHOLE instance of the web browser, let you the user navigate to the given web page that displays the data, and then hit some "capture" button in your application that now reads and parses out the data like you doing now for the main page.

HTML Change button state permanenty

I am completely new to web development. The question I have is rather simple (I guess), but after multiple hours of using google and experimenting I am still without any solution. The problem I have is probably not how to do it, but which keywords to use while searching.
I want to create a simple website. (For testing I use Caddy Server). For my website I use a simple index.html file. On my website I want to have 9 buttons, which will be disabled once clicked. After refreshing the page, every client should also see the changes, so the button-state has to be stored somewhere on the server.
Then there will be another button, which sets the web page to its initial state (all buttons enabled). The purpose of this web page is that 2 persons can click buttons successivley until only one button is left enabled (the web page reloads itself every second on every client). This will be used to select a certain map from a map-pool of 9 maps.
My main problem is, to store the button states, so after refreshing the page the buttons should be still disabled if they were clicked. All clients should see the buttons as diabled once they refresh their pages. Do I have to implement a database for this or store the button states in xml or json? Do I need javascript, jquery, php or ajax for this? I do not want to make it very complicated, so if I need for example a database for this, I will probably just give up.
What I'm asking for: Any point in the right direction on how to implement a simple button that keeps its state after reloading the page would be much appreciated. I found a solution for this using JQuery, but it does not work for me (button does not preserve state after refreshing See here).
Thank you so much for any help!
Your server will need a data store (database) to save the values desired for each button.
Client Side
Set disabled attribute on all relevant buttons in your HTML. On (client-side) page load, fetch the value(s) from your server (database) and depending on what the returned value(s) are, .clearAttribute("disabled") on all buttons accordingly.
Server Side
Have your server set the disabled attribute on the HTML <button> elements based on values in your database prior to serving the HTML to your client(s).

Possible to only update part of page and change query string parameters at same time in asp.net?

Is there a way to only update part of the page and update the query string parameters at the same time without completely refreshing the whole page in ASP.NET?
I only need to update the "main" section of my page and not the whole page. I understand I can do a partial page postback (or use asp ajax) to do the partial page update, but then how do I update the query string parameters in the URL at the same time? Is that even possible?
Or is it not possible and I'll have to just do a Response.Redirect in the code behind of the partial page postback redirecting to the same page with new query params and just let the whole page refresh?
Use pushState.
This new feature offers you a way to change the URL displayed in the browser* through javascript without reloading the page. It will also create a back-button event and you even have a state object you can interact with.
window.history.pushState(“object or string”, “Title”, “/new-url”);
Described here
You have absolutely zero programmatic access to the address bar. The only way to change it is to redirect.
You could, however, do it like some sites do and provide a "send a link to this page to your friends" area. Youtube comes to mind - see how it provides a URL, querystring parameters included, for you to copy, should you wish to send someone a link to a video starting from some specific point.
Also check the handy "Share" link right under your question. You could provide a link like that, with the target URL, so for the user it's just a matter of right-clicking and copying from the context menu. A link well structured into your site is more user friendly than having the user copy directly from the bar, or from a text box. Specially for mobile browsers, where the sequence is usually press-and-hold, then copy. Copying from the address bar, on the other hand, may involve selecting the address bar text, which in some Android devices is a pain in the ass.

ComboBox not recognizing first character

I have a really weird issue that affects only a few users...
I have an ASP.NET site with an AJAX Control Toolkit combobox. When these users try typing in the combobox, the first character they type is often not recognized. They often need to hit the key twice to get it to register.
At first I thought this was an issue with their keyboards, so I had one of the users try on my keyboard. She was able to duplicate the behavior. However, when I try, it's usually fine. (I've only been able to successfully duplicate this once)
Is this a keyboard issue, or is there something else I can look at? The standard browser here is IE9.
EDIT
I've been able to reliably duplicate the "problem"...
When a user engages the dropdownlist and then starts typing, the first keystroke sets focus back in the textbox. This creates the illusion that the first keystroke didn't register. I hate to say it, but this appears to be by design. Any thoughts?

asp.net page stops working for no reason (gridview/sqlexpress search)

I have an asp.net page with a gridview and a couple of input text boxes and a search button.
Once I put something on both text boxes and press search, I get a result list (gridview) from a MS SQLExpress 2008 database.
Everything runs great BUT for some unknown reason the search stops working every now and then.
I type values on the two text boxes and press Search.
Instead of getting a result like always, the text on the text boxes dissapear, on the bottom says status "Done" but in fact is not displaying anything.
it gives no errors at all...it just runs...but doesn't display any data.
I have tried used several other Pc's as clients, same problem.
I have closed and restarted IE/Firefox but does't fix it.
Turning off-on the web server's pc fixes it sometimes, but of course I don't want to be doing that every 30 minutes
Any comments/ideas are appreciated
Sounds like it's giving you a redirect to GET. My guess is you're set to use Forms Authentication, and it's timing out. Try increasing the timeout, or removing authentication.
You could use Fiddler to verify that it's redirecting you.

Resources