Then, i started making tests, but i wanted handle events with javascript the client part, and the server side with c#. Then I do some tests and all worked great...
Now, i have more 'pages' than the home page, so i re-used that select because i need it all the time, so i have the select and when the selected value changes, the select fires the onchange event, but... all work great with one page, but when i select the values from the select on the 'new' pages, definitely dont work. (example)
localhost/Home -> If this is the first time I load the page, as i said , all works great, if I select some values, i can manage them.
Then,
localhost/Whatever -> Now i acces (by linking) to this page, (Lets we say the last previously selected option was B), now i can't handle another 'change' in the select, because I'll always see the B option as the selected one, (because it was selected previously).
If i do the same, starting with localhost/Whatever, and then select some values; but then change to localhost/Home, its the same...
it always show me the last selected option from the previously loaded page.
Below I'll attach the project then you can see what I say for yourself. You have a select, do some selects, then navigate to another page, select some values and you will see that those are the same as the previously values; it remain static as if the (change) event is not fired. (I tried with the '.change' event from jquery and I get the same...)
http://www.sendspace.com/file/p4u4pa
So, whats wrong with that?
Please , help. Thanks.
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
" rel="shortcut icon" type="image/x-icon" />
<%: Styles.Render("~/Content/mobileCss", "~/Content/css") %>
<%: Scripts.Render("~/bundles/modernizr") %>
<% Html.RenderPartial("LoginUserControl"); %>
<%: Scripts.Render("~/bundles/jquery", "~/bundles/jquerymobile") %>
I isolated the problem, now... the code I pasted is a sample code of what I'm trying...
I have a div that when you click on it, it shows a message and changes his content, (it could be, change content, change the css whatever is needed) this div is repeated on every page, so this is why I need this behaviour being repeated on every page.
If you take a (Project>Asp.net mvc4 application>Mobile Application) simple template and easily paste this code on the Site.Master page, you will see what I'm wondering... why happens this?
If I'm in (/Home) and we click on the DIV:
- Skips an alert with the content of that DIV
- Changes the content of the DIV (From ' ' to A)
If we click again:
- Skips an alert with the content of that DIV
- Changes the content of the DIV (From 'A' to 'B')
So far so correct, but if now...
If we go to another page (accessing by the link) (/About or /Contact) and we click on the DIV...
- Skips an alert with the supposed content of that DIV (Now we are in a new page the content of the div should be ' ' but it shows me 'B' like last time it skiped me the alert)
- Also as previously, the content of the DIV should change, but it doesn't change anymore.
If we click again...
- It will skip 'A' but the correct thing should be ' ', then A, then B. Not load the previous content and follow from there... and also the content should change.
Posted Aug 27, 2012, 7:28 AM