for this button, i have written a javascript function:
function btnClose_Click()
{
document.cookie = 'cookieName=closed; value=dontshowagain';
}
In merchant.login page
In the code behind of the other page, it has to check if the value of the cookie is set to "dontshowagain". If it is set to the value, the function should not show the popup again. My task is not to show the popup in different pages. If it is closed once, it has to stop showing again until the browser is closed.
<asp:LinkButton CssClass="button" ID="btnApply" runat="server" OnClick="btnApply_Click()" OnClientClick="Apply1('btnApply')" > hi ihave this functin in .vb file Protected Sub btnApply_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnApply.Click end sub
We have a flash video that was created for our project, we dont the source so we have to work around the compiled flash file. We are going to host the video on our domain and the video creates a sol cookie (flash cookie) file to store how far the user has proceeded though the video. So my plan is to access this cookie to see how far the user has progressed and then fire an event when they have finished the movie.
I have been googling for some help but haven't found to much. I have found out that its possible to do in javascript and I have found some .net sol file viewers but haven't seen any examples I can get my mind around. I have watched the traffic that gets created with fiddler and every time the next button is clicked a new request is fired with the swt file that is being accessed. I would also be happy with tracking every time one of these swt files has been accessed as well.
I am trying to replace the JavaScript onclick event handler in ASP.NET that is added to a button control when using validation controls. This is what is output into the HTML from ASP.NET in this scenario:
I have looked pretty estensively, and unfortunately there doesn't seem to be a way to modify the function server side before it is injected into the page.
Since I am developing a control and desire it to be non-invasive and self contained, and I am interested in obtaining the validationGroup parameter of the WebForm_PostBackOptions object, it seems that the easiest solution would be to use JavaScript to replace the WebForm_DoPostBackWithOptions function name with my custom wrapper function and leave all of the rest of the parameter information intact - then I can extract the information I am interested in, call my custom functions, and then forward the call on to WebForm_DoPostBackWithOptions.
NOTE: I am using jQuery to build my custom function, so if there is an easier way to do this with jQuery it is an option I will consider.
Here is the code I tried to replace the onclick event handler (not working):
Using alert(), I verified that the text is being changed correctly, however whether or not I use the eval() function, the onclick handler doesn't seem to recognize it as JavaScript.
I thought of using a regular expression to get the validationGroup value, but this seems like it will be far more elegant and flexible if I can get it working...
Note: If there is a way for my control to interrogate the page it is on to find all of the buttons that will post back (regardless of what type of buttons they are) so I can retrieve the property server-side, this is also something I will consider.
If I create a cookie in Javascript document.cookie = 'unseen' how do I delete it when I navigate away from this page? This is the only cookie I am creating on the page.
It looks like JavaScript does not have access to authentication cookies ('ASP.NET_SessionId', '.ASPXFORMSAUTH') in the http headers I can see cookies but document.cookie object does not have them.
The IDs for the 'pane' divs are GUIDs of domain objects in a database. Everything works as it should. But when I include the cookie option in the function call on
$(document).ready(function () { //$("#tabs").tabs(); //Without tabs works fine $("#tabs").tabs({ //This call with cookie option breaks everything. cookie: { expires: 1 } }); });
By 'breaks' I mean - the contents of my final tab (which includes a 'submit' button) ends up being displayed at the bottom of every tabbed page although the tab itself looks fine. None of the tabs open the corresponding pane when clicked, but I can see the correct tab id in the address bar on the browser when I click a tab. I've compared the source of both pages (with and without the cookie option) and they are identical apart from the call to the JQuery tab function. But the Javascript console reports an error: cannot call method 'apply' of undefined
Is there something else I need to do to get this to work? The documentation suggests not. I've inluded the cookies plugin as suggested by Nalum, but this hasn't solved the problem. Drilling into jquery-ui-1.8.9.custom.min.js gets me the offending bit of code:
This code seems to be expecting [b] to be something like ui-tabs-1 which is the way in which the tabs are IDed if you add tabs via the tabs.add(...) function. And of course I don't add my tabs this way - all my tabs have GUID IDs which are related to elements which come from a DB and are output by a Repeater control. Some HTML below for reference:
<div id="tabs"> <ul> <li> <a href='#TabDiv471de30d-aaec-4485-8a50-1b2fdbc58053'> Tab A </a> </li> <li> <a href='#TabDiv951e2fee-9272-4a8c-becb-3f3a07770347'> Tab B </a> </li> </ul> <div id='TabDiv471de30d-aaec-4485-8a50-1b2fdbc58053'> This is Pane A </div> <div id='TabDiv951e2fee-9272-4a8c-becb-3f3a07770347'> This is Pane B </div> </div>
In asp.net page, How can i call the javascript methods for form processing-submitting if the user browser supports javascript and use code behind events if the browser does not support javascript.I have the javascript code to send the form data to an ajax server page using jquery. Don't know how to invoke the needed one based on the browsers javascript availability
The script are put in the following and the block is in the .ascx page.
<script type="text/javascript"> </script>
However, the function UserControlNameInit() does not run when the page loads. It is showing in the page source. I can still call this function through FireBug console by manually typing the name of the function.
I did the same way with other user controls, and it works. Just 1-3 user controls are not working...
I am busy building a shopping cart with cookies. I have datalist which I populate from the cookies with a delete button next to each cookie
[Code]....
Now the problem is that when I hit the delete / remove button to expire the cookie, what happens when repopulating the datalist is that it shows the original cookie with all it's values as well as a new entry where all the values are blank.
I want to change the value in a cookie: HttpCookie hc = new HttpCookie("HiddenColumns"); hc.Value = customView.HiddenFields; hc.Expires = DateTime.Now.AddDays(365); Response.SetCookie(hc);
I'm trying to use a webservice that first expects the clients to login, to retrieve a cookie to re-use. This is done through a login(string user, string pass) method on the webservice.
Doing this through a browser works fine, we get a cookie, and we can see the cookie via Fiddler or whatvever proxysniff thingy.
Time to do the same in ASP.Net, so we use the WSDL and generate a nice proxy class, and it works fine to call the login() method, but Never Ever does a cookie get set !
I already used the "cookiejar" technique - which means i create an instance of a CookieContainer and assign it to the proxyclass like this;
I am a bit baffled here; using IE7, ASP.NET 2.0 and Cassini (the VS built-in web server; although the same thing seems to be true for "real" applications deployed in IIS) I am looking for the session-id-cookie. My test page shows a session id (by printing out Session.SessionId) and Response.Cookies.Keys contains ASP.NET_SessionId. So far so good.
But I cannot find the cookie in IEs cookie-store! Nor does "remove all cookies" reset the session (as it does in FF)... So where - I am tempted to write that four letter word - does IE store that bloody cookie? Or am I missing something? By the way there is no hidden field with a session id either, as far as I can see. If I check in FF there is a cookie called ASP.NET_SessionId as I would expect. And as mentioned above deleting that cookie does start a new session; as I would expect.
I am writing an ASP.Net application. I am making use of master page in it. I have several child pages with me, which consist of some java script functions; Let's say;
function ChildPageFunction() { //Do something; }
And master page java script function as;
function MasterPagefunction() { //Need to call ChildPagefunction(); here }
Now is it possible to call ChildPageFunction() from MasterPageFunction()?
I'm working on an MVC application and I ran into a little snag.
I've got a form with the usual textboxes and dropdowns. I decided to use jquery ajax (GET) to load the dropdowns on load (State Names & Salutations).
No matter what I try, for example:
Code: <AcceptVerbs(HttpVerbs.Get)> _ Public Function ReturnSalutationDropdown() As ActionResult Dim dropdown As New DropDownList With {.TabIndex = 1, .DataTextField = "Value", _ .DataValueField = "Key", .ID = "ddl_coSalutation"} dropdown.DataTextField = "Value" dropdown.DataValueField = "key" dropdown.DataSource = AppEnumerations.BindToEnum(GetType(AppEnumerations.Salutation)) dropdown.DataBind() Dim sb As New StringBuilder Dim tw As New IO.StringWriter(sb) Dim hw As New HtmlTextWriter(tw) dropdown.RenderControl(hw) Return Content(sb.ToString) End Function
The ID of the dropdown ends up like: ctl00$MainContent$ddl_coSalutation
It doesn't matter if I use a stringbuilder and a loop to create a <select> with <option>'s, the ID always ends up like above.
Do I have to create a javascript function to create it instead?