Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
5,346,230
5,346,231
body background-image fade in
<p>I'm trying to replicate the fade in the background image of this <a href="http://movies.io" rel="nofollow">site</a>. How would I go about doing so with jQuery?</p>
javascript jquery
[3, 5]
3,832,368
3,832,369
Making a Javascript game, Having a little problem with scrolling
<p>I have a <code>#wrapper</code> div and a <code>#grid</code> div nested inside. currently I can scroll around with this function below.</p> <pre><code>getCursorPos : function(){ // set the empty cursor object var cursor = {}; //get the offset from the left of the grid container var grid //offset loop $(function getCursorPos(){ grid = $('#grid').offset(); setTimeout(getCursorPos, game.loopSpeed); }); //continuosly get the position var that = this; $(document).mousemove(function(e){ //if game mode is menu exit if(game.mode === 'menu'){ return; } // NOTE: this looks a litle over done but don't remove anything // its like this because javascript uses floating points // and so in order to line up to the nearest hunderedth I // had to make the cursor and div position intergers by // muliplying by ten. one the two are added I reduced them // and rounded them. that.x = Math.round(((e.pageX * 10) - (grid.left * 10)) / 10); that.y = Math.round(((e.pageY * 10) - (grid.top * 10)) / 10); }); }, </code></pre> <p>the problem is that the mouse coordinates only update when the mouse moves. is there any way to get the coordinates with out moving the mouse?</p>
javascript jquery
[3, 5]
1,653,911
1,653,912
No overload for 'save_Click' matches delegate 'System.EventHandler'
<p>I have an asp:button <code>&lt;asp:Button runat="server" ID="save_players" Text="Save Changes" OnClick="save_Click" /&gt;</code> which wants to run the following code, but gets an error "No overload for 'save_Click' matches delegate 'System.EventHandler'".</p> <p>I recon this is because the method signature does not match EventHandler delegate - but I dont know how to fix it. Any help here please? Here is my C# method:</p> <pre><code>protected void save_Click(object sender, ListViewCommandEventArgs e) { foreach (ListViewItem item in ListViewAddPlayers.Items) { if (item.ItemType == ListViewItemType.DataItem) { string tournyName = (string)(Session["TournyName"]); Label gameNumber = (Label)e.Item.FindControl("lblGame"); TextBox txtPlayer1 = (TextBox)e.Item.FindControl("txtPlayer1"); TextBox txtPlayer2 = (TextBox)e.Item.FindControl("txtPlayer2"); string updateCommand = "//QUERY HERE//"; SqlDataSource2.UpdateCommand = updateCommand; } } Server.Transfer("tourney-standings.aspx?name=" + (string)(Session["TournyName"])); } </code></pre>
c# asp.net
[0, 9]
4,110,501
4,110,502
What's a good hash to use between PHP and Python?
<p>I have the luxury of starting from scratch, so I'm wondering what would be a good hash to use between PHP and Python.</p> <p>I just need to be able to generate the same hash from the same text in each language.</p> <p>From what I read, PHP's md5() isn't going to work nicely.</p>
php python
[2, 7]
782,406
782,407
casting an object with "as" still giving an error
<p>I have an object MyObject and I'm storing that in the session.</p> <p>I write this:</p> <pre><code>MyObject TheObject = HttpContext.Current.Session["TheObjInSession"] as MyObject; </code></pre> <p>I'm getting error <code>Object reference not set to an instance of an object</code> Why? I thought that if you use <code>as</code> to cast and the cast produces an error then it just returns null and execution continues. How should I rewrite this line?</p> <p>Thanks for your suggestions.</p> <p>PS: The error is produced because I removed the enable session line <code>[WebMethod(EnableSession = true)]</code> I'll put the line back in but I want to make sure there are no exceptions in case anything goes wrong.</p>
c# asp.net
[0, 9]
1,356,385
1,356,386
Difference between homegrown cms and wordpress cms
<p>Can any one please explain the difference between the wordpress cms using php and home grown cms using asp.net.</p>
php asp.net
[2, 9]
5,898,524
5,898,525
How can a link open a window in same page using JQuery? It works in Javascript as shown
<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;title&gt;Open Div from Link&lt;/title&gt; &lt;script src="http://code.jquery.com/jquery-1.4.4.js"&gt;&lt;/script&gt; &lt;meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /&gt; &lt;style type="text/css"&gt; /*&lt;![CDATA[*/ body { background-color:#aaaaff; } #one { position:absolute; top:80px; left:40px; } object { width:980px; height:660px; border:solid 1px #000000; } /*//]]&gt;*/ &lt;/style&gt; &lt;script language="javascript" type="text/javascript"&gt; //&lt;![CDATA[ // written by: Coothead function updateObjectIframe(which) { document.getElementById('one').innerHTML = '&lt;'+'object id="foo" name="foo" type="text/html" data="'+which.href+'"&gt;&lt;\/object&gt;'; } //]]&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="one"&gt; &lt;object id="foo" name="foo" type="text/html" data="http://www.w3schools.com/"&gt;&lt;/object&gt; &lt;/div&gt; &lt;div&gt; &lt;a href="http://www.google.com" onclick="updateObjectIframe(this); return false;"&gt;Retreive Existing Records&lt;/a&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
5,952,465
5,952,466
Disabling checkboxes that are not checked with jQuery?
<p>How do I disable ALL checkboxes on a page that are not checked? Do I need to first scan through all the checkboxes or is there a simpler way? I'm still a jQuery newbie</p>
jquery asp.net
[5, 9]
4,407,558
4,407,559
How do you hide/show forms in Android?
<p>I come from Windows .Net forms development.</p> <p>This is a pretty basic/fundamental question.</p> <p>I'm attempting to build an Android app that will have multiple screens/forms (like most do)</p> <p>My question is how do you achieve this in Android?</p> <p>For example, a listview loads with menu items. When the user clicks a menu item, how is the new layout/form loaded?</p> <p>Do you simply set visibility of your UI controls based on user actions? Or is there a built in mechanism to control the loading of "forms"?</p> <p>I hope this makes sense. I have some java background and have actually done a small amount of Android development. (But have yet to do an UI type things)</p> <p>Edit: A better way to phrase this might be: What is the Android equivalent of forms?</p> <p>Thanks Kevin</p>
java android
[1, 4]
73,328
73,329
Passing TextBox value from jquery dialog to variable in a function
<p>I have the following files:</p> <p>FILE1.ASPX</p> <pre><code>function DDialog(url, title, height, width) { HideDialogs(); var dialogButtons = [{ text: "Save", click: function () { var data = {}; data.HolidayDate = $('#txtHireDate').val(); alert(data.HolidayDate); var jsondata = $.toJSON(data); ajaxManager.add({ type: "POST", url: "ChangeHireDate.aspx/DoIt", data: jsondata, contentType: "application/json; charset=utf-8", dataType: "text json", beforeSend: function (xhr) { xhr.setRequestHeader("Content-type", "application/json; charset=utf-8"); }, success: function (msg) { alert("WORKS"); }, /* error: function (XMLHttpRequest, textStatus, errorThrown) { alert("Could not save holiday."); }*/ error: function (xmlRequest) { alert(xmlRequest.status + ' \n\r ' + xmlRequest.statusText + '\n\r' + xmlRequest.responseText); } }); ... </code></pre> <p>FILE2.ASPX (dialog window) TextField gets date from calendar extender</p> <p>Problem is I dont know how to pass the date from the textfield to the data.HolidayDate when the button is clicked.</p>
javascript jquery asp.net
[3, 5, 9]
2,105,165
2,105,166
Select 'F1 Packages' option after the page is loaded
<pre><code>&lt;select name="select-your-sporting-event" id="select-your-sporting-event" class="select"&gt; &lt;option&gt;-------------&lt;/option&gt; &lt;option&gt;Cricket Packages @ Lords&lt;/option&gt; &lt;option&gt;Football Packages&lt;/option&gt; &lt;option&gt;F1 Packages&lt;/option&gt; &lt;option&gt;Moto GP Packages&lt;/option&gt; &lt;option&gt;Golf Packages&lt;/option&gt; &lt;option&gt;Tennis Packages&lt;/option&gt; &lt;option&gt;Footbal World Cup 2014&lt;/option&gt; &lt;/select&gt; </code></pre>
php jquery
[2, 5]
3,607
3,608
How to take a picture of in panaroma mode?
<p>I want to make an application that allow the user to take a picture of text either from android device Gallery or from android Camera application in a Panorama mode .But i can not find any source or tutorial to do this.How can i do this in my application? how to make an application that take picture from android camera application in a panaroma mode?</p> <p>Thanks in advance.</p>
java android
[1, 4]
5,804,323
5,804,324
How to load multiple html pages?
<p>How to load all html pages stored in a directory using javascript or jquey into another html page? note:the name of the html pages are unknown..</p>
javascript jquery
[3, 5]
1,828,883
1,828,884
Background-position +/- X pixels
<p>How do I offset the <code>background-position</code>, let's say 20px, from its original position?</p> <p><strong>Like:</strong></p> <pre><code>$(".selector").animate("slow").css("backgroundPosition", "center -=20px"); </code></pre> <p>(That obviously doesn't work... But how do I do this??)</p>
javascript jquery
[3, 5]
893,715
893,716
array inside array
<p>There is an array of values from the checkbox. It needs to be sent together with additional value. In php i am getting this:</p> <pre><code>&gt; Array ( &gt; [0] =&gt; [object Object] &gt; [1] =&gt; value ) </code></pre> <p>My code is:</p> <pre><code>$.post('index.php', {'info[]': [$("input[name='site_select_[]']:checked"), $(this).val()]}, function(data){data}); </code></pre>
php javascript jquery
[2, 3, 5]
4,866,030
4,866,031
How to set textview text using javascript android
<p>I want to set text in textview in my android class using a javascript which contains a same named variable as in the class for textview to which I want to assign some text. Something like this:</p> <p>In js:</p> <pre><code>function validClick() { fromJS.append("vikrant"); valid.performClick(); document.getElementById("ok").value = "Accepte"; } </code></pre> <p>fromJS is my textview in android class.</p> <p>and the code in the class looks like:</p> <pre><code> valid.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Context context = getApplicationContext(); CharSequence text = fromJS.getText(); CharSequence text = clsVariable; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } }); </code></pre> <p>EDIT: Also, I' writing </p> <pre><code> wbvw.addJavascriptInterface(valid, "valid"); wbvw.addJavascriptInterface(fromJS, "fromJS"); </code></pre> <p>in my onCreate method.</p> <p>Can anybody please help?</p> <p>Thanx in advance.</p>
javascript android
[3, 4]
2,319,751
2,319,752
Which is Android/Java corresponding method to the C#/C++ method GetTickCount()?
<p>I wanna know a corresponding method in Android/Java that is like the GetTickCount method in C#/C++?</p>
c# java c++ android
[0, 1, 6, 4]
1,993,499
1,993,500
Select appropriate tr in table - jquery
<p>How can I select the tr tag containing USDTRY value in its second td and change its value with TRYUSD using jquery?</p> <pre><code>&lt;table class="k-selectable" cellspacing="0" role="grid" data-role="selectable"&gt; &lt;tbody&gt; &lt;tr role="row" data-uid="9d1c0ae7-ec5d-4377-ad61-9eace8158802"&gt; &lt;td role="gridcell"&gt; &lt;img src="/Images/up.png"&gt; &lt;/td&gt; &lt;td role="gridcell"&gt;USDTRY&lt;/td&gt; &lt;td role="gridcell"&gt;1.30514&lt;/td&gt; &lt;td role="gridcell"&gt;1.30527&lt;/td&gt; &lt;/tr&gt; &lt;tr class="k-alt" role="row" data-uid="0ff48da9-2019-4cf8-b631-a09c3ce98d63"&gt; &lt;tr role="row" data-uid="2c9ae0ba-c744-4bbb-9a23-fd15a3b65b6c"&gt; &lt;/tbody&gt; </code></pre> <p></p>
javascript jquery
[3, 5]
1,717,424
1,717,425
Creating dynaimc controls in c# and placing them in html
<p>I have an datatable which I would like to use to generate controls i.e. <strong>textbox, checkbox, dropdown</strong></p> <p>From the datatable I need to create those controls using c#, can any one help me out in syntax. How do I go ahead and bind these controls in HTML tags?</p>
c# asp.net
[0, 9]
1,132,143
1,132,144
JavaScript / jQuery why doesn't this work?
<pre><code>function checkSession(){ $.ajax({url: "session.php", success: function(data){ if( data == 1){ var postFilen = 'msg.php'; $.post(postFilen, function(data){ $("#msg").html(data).find("#message2").fadeIn("slow") } } else { $('#message2').hide(); } }}); // setInterval('checkSession()',1000); } </code></pre> <p>Basically, this is checking if data is 1 in session.php, and if it is, it should run msg.php´s div #message2 in #msg</p>
javascript jquery
[3, 5]
176,166
176,167
jquery toggle() not working with variable
<p>I wan't to be able to "toggle" a div using jquery through a function but it gives me </p> <p>"Uncaught TypeError: Cannot read property 'defaultView' of undefined"</p> <p>in the chrome debugger. here is my code</p> <pre><code>function hide(id){ $(id).toggle(); } </code></pre> <p>I have also tried</p> <pre><code>if (document.getElementById(id).style.display=="none"){ document.getElementById(id).style.display="block"; } else if (document.getElementById(id).style.display=="block"){ document.getElementById(id).style.display="none"; } console.log(document.getElementById(id)); console.log(id); return document.getElementById(id).style.display; </code></pre> <p>and I get an error that says </p> <p>"Uncaught TypeError: Cannot read property 'style' of null"</p> <p>More info:</p> <p>I call <code>hide()</code> from the HTML, I input the HTML using js</p> <p>here is the basic code</p> <pre><code>function inputHtml(id){ var div = document.createElement("div"); div.innerHTML = '&lt;div id="'+id+'"&gt;&lt;div onclick="hide('+id+')"&gt;hide&lt;/div&gt;&lt;/div&gt;'; main.appendChild(div); } </code></pre>
javascript jquery
[3, 5]
781,036
781,037
why an object created in the code behind is not available in the aspx page?
<p>I have a simple question. When we create an object in the code behind(".aspx.cs"), why is it not available in the aspx page.</p> <p>For example, if I have a class(present in another .cs file and not in the code behind) and in that class I have a property declared, lets say "Name". </p> <pre><code>namespace BLL.SO { public class SOPriceList { private string _name; public string Name { get { return _name;} set { _name = value; } } } } </code></pre> <p>Now when I create an object, lets say "obj" in the code behind(".aspx.cs"), with scope within the partial class.</p> <pre><code>namespace Modules.SO { public partial class PriceListRecordView : PageBase { SOPriceList obj = new SOPriceList(); protected void Page_Load(object sender, EventArgs e) { } } } </code></pre> <p>Using this object "obj" I can access the property. Then why can't I use the same object "obj" to get the property in the aspx page in this manner,</p> <pre><code>&lt;%= obj.Name%&gt; </code></pre>
c# asp.net
[0, 9]
3,000,097
3,000,098
difference of load/ready events between window and document
<p>Is there a difference between <code>$(window).ready(function(){})</code> and <code>$(document).ready(function(){})?</code></p> <p>If so, what is it?</p> <p>In that same vein, what is the difference between <code>$(window).load(function(){});</code> and <code>$(document).load(function(){});</code>?</p>
javascript jquery
[3, 5]
5,257,460
5,257,461
List created in OnInit not persisting
<p>I having a problem maintaining a list of strings. The list is instantiated in OnInit and set as the data source for a <code>GridView</code>. (The basic idea is that the user enters something in the text box, and it appears in the <code>GridView</code>, as many times as they want.)</p> <p>It works just fine for the first entry, whatever the user enters shows up in the <code>GridView</code>, pretty as can be. However, on following entries, any previously entered values disappear - <code>OnInit</code> is executed again, the <code>List&lt;string&gt;</code> is re-instantiated, and the previous values are over-written. I tried moving the <code>OnInit</code> logic into <code>OnPreInit</code> but just got a Null Reference Exception on the list.</p> <p>Here's a contrived example of what I'm trying to do:</p> <p>I have a <code>TextBox</code>, a <code>Button</code> and a <code>Gridview</code>:</p> <pre><code>&lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="Button1" runat="server" Text="Add" onclick="Button1_Click" /&gt; &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true"&gt;&lt;/asp:GridView&gt; </code></pre> <p>In the code behind:</p> <pre><code>protected override void OnInit(EventArgs e) { List&lt;string&gt; gvValues = new List&lt;string&gt;(); GridView1.DataSource = gvValues; GridView1.DataBind(); } protected void Button1_Click(object sender, EventArgs e) { gvValues.Add(TextBox1.Text); GridView1.DataBind(); } </code></pre> <p>I've created objects in <code>OnInit</code> in the past, and haven't had a problem with their state persisting. Obviously I'm missing something here. Someone please point out the flaw in my logic and suggest a method for achieving this functionality.</p>
c# asp.net
[0, 9]
4,183,491
4,183,492
Adding radiogroup, buttons and controls in asp.net using c#
<p>Here is the complete code. I want to display a radiogroup when I select 1 in the dropdown list box. I get the error 'System.Web.HttpException: Control 'RadioButton1' of type 'RadioButton' must be placed inside a form tag with runat=server'. </p> <pre><code> namespace HostelRoomManagement { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { } protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e) { if (DropDownList1.SelectedValue == "1") { RadioButton rb1 = new RadioButton(); rb1.ID = "RadioButton1"; rb1.Text = "C block"; rb1.GroupName = "BlockGroup"; RadioButton rb2 = new RadioButton(); rb2.ID = "RadioButton2"; rb2.Text = "C block"; rb2.GroupName = "BlockGroup"; Page.Controls.Add(rb1); Page.Controls.Add(rb2); } } protected void RadioButton2_CheckedChanged(object sender, EventArgs e) { } } } </code></pre> <p>I get the error 'System.Web.HttpException: Control 'RadioButton1' of type 'RadioButton' must be placed inside a form tag with runat=server'</p>
c# asp.net
[0, 9]
430,399
430,400
how to cancel customvalidators action?
<p>I have a webform with a textbox and 3 buttons (add, save and cancel), I'm learning how to use customvalidators (ASP.NET 4.0).</p> <p>Once the page is loaded, you can only see the add button, after you click on it you can see the textbox and the other 2 buttons.</p> <p>If textbox is empty I can't save the record (I get this done successfully with customvalidator and javascript, it shows me the error message "textbox can not be left empty"), but what happens if I don't want to save the record anymore and want to cancel instead (by clicking on the cancel button while textbox is still empty)?</p> <p>I get the customvalidator error "textbox can not be left empty". I have to type something i it so I can do what i need.</p> <p>Any suggestions? Thanks in advance</p>
c# asp.net
[0, 9]
774,539
774,540
Progress bar in web application using C# and asp.net
<p>I need to have 2 progress bars in my application:</p> <ol> <li><a href="http://developers.sun.com/docs/web-app-guidelines/uispec4_0/15-progress.html#15.3" rel="nofollow">Circular graphical progress bar</a> (<em>busy indicator)</em> <ul> <li>as shown in the link <strong>[15.1.3]</strong> when the page does a postback and </li> </ul></li> <li>A <a href="http://developers.sun.com/docs/web-app-guidelines/uispec4_0/15-progress.html#15.3" rel="nofollow">determinate progress bar</a> <ul> <li>as shown in the link <strong>[15.1.1]</strong> with showing a percentage when I update or load data into the grid which I use in my application.</li> </ul></li> </ol> <p>Can anyone help me with code snippets and how I can proceed with my .aspx and .aspx.cs files in order to obtain these progress bars for my application?</p>
c# asp.net
[0, 9]
3,126,404
3,126,405
easy visualization of usage statistics (web app)
<p>I have some usage queries for my web app's database, the results of which I want to display graphically. Is there an easy-to-use API that exists for this purpose?</p> <p>I want to show things like average query-time per user (a small user-base), average query time per day, and things like that. I think it would be cool to show these on a two-axis graph.</p> <p>I am displaying this data on my site, so a jQuery/Javascript/HTML solution for rendering information into graphs would be ideal.</p>
javascript jquery
[3, 5]
3,841,405
3,841,406
jQuery scroll page so cursor stays at the "logical center"
<p>i have a huge html form , with near 350 controls that take 5-6 times of the user screen height. user starts completing each input field from the beginning of the page and goes on. once the cursor rich near the bottom of screen user must be able to see some next input fields so here is the problem : i want to avoid the scrollbar usage. i want to set some "margines" ( say 200px for each page side )</p> <p>if user clicks a control that is near the screen edge, here this mechanism must work also</p> <p>i'm looking for a jQuery solution</p> <p>playing around with jQuery.ScrollTo, but can't figure out how to embed my logic into code.</p>
javascript jquery
[3, 5]
4,731,691
4,731,692
How to draw images over image and save it as a single image in android
<p>Hi guyz i am new to this,</p> <p>I want to draw an image over image and want to save it as a single image(one image is smaller than other one). Please tell me how to do this.</p> <p>I Have tried RelativeLayout to draw an image over image using imagview and able to implement drag and drop for the smaller one. but I am not able to Save them as a single image. Any Help or Idea would be great????????</p> <p>Thanks Davender </p>
java android
[1, 4]
2,728,751
2,728,752
execute a fuction on the first element matching selection using Jquery
<p>I know <code>$('.test').each(testFuntion);</code> invokes the <code>testFunction</code> for all matching <code>.test</code> elements on the page. How do I tell it to do just the first matching one.</p> <p>I tried <code>$('.test:first').each(testFuntion);</code> and it still seems to run for all of them.</p>
jquery asp.net
[5, 9]
792,517
792,518
PHP chart Libraries VS JavaScript Chart Libraries
<p>I am just stuck a little in making a choice between PHP chart Lib and JavaScript Chart Lib. I do understand that PHP if for the server side and Javascript for the client side. My problem is what difference does it make when using their charting libraries. Is it performance issue or what? </p> <p>I want to understand the difference in using PHP chart Libs and JavaScript Chart Libs. Please am not looking for examples of their chart libraries. I am looking for why i should choose one over the other.</p> <p>I tried to google 'php chart vs javascript chart' but didn't get any links that can give me the difference.</p> <p><strong>EDIT 1</strong></p> <p>1)</p> <p>If this question has been answered before, then point me there.</p> <p>2)</p> <p>Am developing the application for internet</p> <p><strong>EDIT 2</strong></p> <p>1)</p> <p>I have found out about PHPChart <a href="http://phpchart.net/" rel="nofollow">PHPChart </a> which has both PHP source code and JavaScript source code. If anyone has experience in that library, does it may be solve the problem of server side load (bandwidth issues) etc.. I am thinking since it has both the PHP and JavaScript source then it may be the best to use. Am just assuming. :-)</p> <p>Thank you very much</p>
php javascript
[2, 3]
794,324
794,325
jQuery JS scroll to top on click works only once?
<p>I'm trying to make a page scroll to top when a link is clicked. Heres what I got so far.</p> <pre><code>&lt;script&gt; jQuery(document).ready(function () { jQuery("ul.pager a").click(function() { scroll(0,0); return false; }); }); &lt;script&gt; </code></pre> <p>Problem with that code is that it works only on first click.</p> <p>How to make it work every time I click on a link?</p>
javascript jquery
[3, 5]
5,091,509
5,091,510
dynamically select multiple options in a select box
<p>have an array of values [1,2,4] representing the values of a multi-select box, how do i set them as selected using either jquery or plain javascript?</p> <p>thanks for your help.</p>
javascript jquery
[3, 5]
45,876
45,877
Hiding routeparameters from URL when using RouteTable
<p>I'm using a <code>RouteTable</code> and I'm looking to hide the routeparameters from the URL. The relevant code is:</p> <pre><code>RouteTable.Routes.Add("EditItem", new Route("{editMode}/{itemId}.aspx", new PageRouteHandler("~/EditPage.aspx"))); </code></pre> <p>And the code that refer to that page is:</p> <pre><code> &lt;a href="&lt;%# Page.GetRouteUrl("EditItem", new {editMode = "view", itemId = Eval("EntryId")}) %&gt;" </code></pre> <p>The thing is that I would like to block the user from seeing the itemId parameter and still be able to view the item. Is it possible to send the parameter to the new page without showing it in the URL?</p> <p>An example for such a "problematic" URL is <code>www.mysite.com/view/1234.aspx</code> and ofcourse, I wouldn't like the user to see the 1234 part. (itemId)</p>
c# asp.net
[0, 9]
571,870
571,871
how to get the full domain with http type (http or https) of a link in asp.net?
<p>My asp.net application will be distributed to different users. It should retrieve the domain and http type of a link automatically.</p> <p>For example:</p> <ol> <li><a href="http://abc.com/test.aspx" rel="nofollow">http://abc.com/test.aspx</a></li> <li><a href="https://abc.com/test2.aspx" rel="nofollow">https://abc.com/test2.aspx</a></li> </ol> <p>I need a method to retrieve either: <a href="http://abc.com" rel="nofollow">http://abc.com</a> and <a href="https://abc.com" rel="nofollow">https://abc.com</a> from those links automatically.</p> <p>How can I do that?</p> <p>thanks in advance. </p>
c# asp.net
[0, 9]
2,534,460
2,534,461
Get class of cloned element jquery
<p>I am looking for a way to get the class of a cloned element, if it's possible, here is my script:</p> <pre><code>var numberOfDoc = $("input[type=checkbox]").each( function (index) { $(this).addClass("doc" + index); }) $("input").change( function () { if(this.checked) { var checked = $(this).parent().find("span"); $("span.noneAttached").fadeOut('slow', function () { checked.clone().appendTo(".attachedDocuments").after("&lt;br /&gt;").text(); }); } else if ($("input:checked").length == 0) { $("span.noneAttached").fadeIn("slow"); } }); </code></pre> <p>As you can see, I am giving each checkbox it's own class name based on it's index number. When a checkbox is clicked, it finds it's parent, then the span, clones it, and appends the text of the span to another div.</p> <p>Right after the span is cloned, I need to be able to find the class name that the checkbox has been given and add it to the span that is being cloned and appended to keep track of where each span actually came from.</p> <p>Any thoughts here? Is there a better way to do this?</p>
javascript jquery
[3, 5]
820,806
820,807
How to return an Array or an Element all from the same Object? (jQuery)
<p>I am trying to cut down jQuery to a very specific set of functions to use in a product (as well as my general learning). Looking through the source, this seems to be the main structure behind the jQuery library. And it works fantastically. </p> <p>The big part i can't get my head around, is how jQuery can return an element array, as well as retaining the jQuery object. </p> <p>Ie, $("body") will return the body in an array, but i can still say $("body").hide() (so i'm essentially calling 'hide' on an array?)</p> <p>The question: How can I return both an Array AND the jQuery object created in the first function?</p> <pre><code>var MyNewLibrary = function (selector, context) { return new MyNewLibrary.fn.init(selector, context); }; var $$ = MyNewLibrary; MyNewLibrary.fn = MyNewLibrary.prototype = { el: null, length: 0, selector: "", init: function (selector, context) { var elem; elem = document.getElementById( selector[0].substr(1, selector[0].length)); if (elem) { this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; }, //Example of chained function Html: function (str) { if (typeof str == "string") { this[0].innerHTML = str; } if (typeof str == "undefined") { return this[0].innerHTML; } return this; } }; MyNewLibrary.fn.init.prototype = MyNewLibrary.fn; MyNewLibrary.BasicFunction = MyNewLibrary.fn.BasicFunction = function () { return "A string returned by $$.BasicFunction()"; }; </code></pre>
javascript jquery
[3, 5]
1,550,413
1,550,414
Reference file outside of Web site directory
<p>How do I reference a file outside my web site's root directory?</p> <p>For example my website is located at C:\dev\TestSite I am using ASP.NET with XSP. The webapp will be deployed on Apache using mod_mono. I have images in C:\images and I would like to do this:</p> <pre><code>&lt;img src="C:\images\logo.gif"/&gt; </code></pre>
c# asp.net
[0, 9]
2,446,311
2,446,312
Animated Loading Gif with Jquery?
<p>Is it possible to rotate an image continuously (as in a loading gif) using jQuery? For a static image. Ideally, could it continually turn at 45 degree angle?</p>
javascript jquery
[3, 5]
4,410,230
4,410,231
Javascript: Setting variable to work in attr line
<p>Kinda of a noob question, can't seem to solve it, but I may just be tired.</p> <p>What I'm trying to do is insert a PHP variable in to Javascript (Jquery), and then that variable in to an attr line.</p> <p>The script I'm using to create the variable:</p> <pre><code>$.extend({ getUrlVars: function(){ var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&amp;'); for(var i = 0; i &lt; hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; }, getUrlVar: function(name){ return $.getUrlVars()[name]; } }); </code></pre> <p>Setting the variable:</p> <pre><code>var searchresult = $.getUrlVar('s'); </code></pre> <p>And then, where I'm stuck, inserting the variable within the line so that'll come out correctly when I send it off to my iframe.</p> <pre><code> $(function() { $("#searchbutton").click(function() { $("#theiframe").attr("src","http://whateverdomain.com/index.php?s=VARIABLE HERE WITHIN JAVASCRIPT"); }) }) </code></pre> <p>I know, kinda beginners question going here, but I admit it, I'm stuck.</p>
php javascript jquery
[2, 3, 5]
6,013,500
6,013,501
What are pros and cons when choosing jquery as my primary javascript library?
<p>I have started a new web application and have decided to use jquery as my primary javascript library... But still i want to get some pros and cons tips from SO users who used jquery ...</p>
javascript jquery
[3, 5]
3,627,406
3,627,407
How can I append a bunch of numbered list to a ul?
<p>Here is what I have, which results in an error:</p> <pre><code>for (var x = 0; x &lt; 10; x++){ $('.wrapper ul').append('&lt;li&gt;Root Option 'x'&lt;/li&gt;'); }; </code></pre>
javascript jquery
[3, 5]
2,555,220
2,555,221
how to change format 1 to format 2
<ol> <li>when i store my kml string to databse,i be this :</li> </ol> <p><img src="http://omploader.org/vNDR3Mg" alt="alt text"></p> <p>2.</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;kml xmlns="http://www.opengis.net/kml/2.2"&gt; &lt;Placemark&gt; &lt;name&gt;Simple placemark&lt;/name&gt; &lt;description&gt;Attached to the ground. Intelligently places itself at the height of the underlying terrain.&lt;/description&gt; &lt;Point&gt; &lt;coordinates&gt;-122.0822035425683,37.42228990140251,0&lt;/coordinates&gt; &lt;/Point&gt; &lt;/Placemark&gt; &lt;/kml&gt; </code></pre> <p>so how to change it using jquery or javascript</p>
javascript jquery
[3, 5]
1,825,695
1,825,696
How to select elements while hovering
<p>How can I select elements while I hover them on HTML. Like if I hover a div or its child then I need my control over it. I want to show a border around it. my code is</p> <pre><code>jQuery(document).ready(function(){ $(window).bind('mousemove', function(e) { current_id = $(e.target).attr('id'); jQuery('#'+current_id).css('border','2px solid yellow'); }); }); </code></pre> <p>But this code will gives me control if I hover a specific div but I need I can show a border even if I am hovering inside a div and same if that div contains a child than on hovering it I can get a border around that child not that parent div.</p>
javascript jquery
[3, 5]
5,915,052
5,915,053
How do I create an object in TimerTask in Android?
<p>I'm trying to make the canvas draw some pictures in a fixed period of time. It's like an item showing on the screen and it disappears after 5 seconds. Then after another 3 seconds, a new item is drawn and last for another 5 seconds. I used Timer and TimerTask as below</p> <pre><code> public class PowerUpMaking extends TimerTask{ public void run() { test = 1; powerUp = new Powerup(players.get("player1"),getHeight()); } } </code></pre> <p>I declared powerUp in the constructor. Whole thing is in a class that extends View. What I want to do is just to create a new object for the reference variable. It turns out the first line is working but the second line is not by checking the log. How am I supposed to deal with this situation? Many many thanks if anyone can help. First time to ask a question here actually.</p>
java android
[1, 4]
5,146,282
5,146,283
Dynamically deny access to locations
<p>I'm looking to dynamically instruct ASP.NET to deny access to specific locations. So, instead of having something like the following in the Web.config, I'd like to do that through C# code.</p> <blockquote> <pre><code>&lt;location path="specialDir"&gt; &lt;system.webServer&gt; &lt;security&gt; &lt;authorization&gt; &lt;add accessType="Deny" roles="FileDeny" /&gt; &lt;/authorization&gt; &lt;/security&gt; &lt;/system.webServer&gt; &lt;/location&gt; </code></pre> </blockquote> <p>Any ideas?</p>
c# asp.net
[0, 9]
4,258,109
4,258,110
Weird behavior when removing an element from a cloned element in loop
<p>I'm making an ajax application, which receives a list, making a <code>&lt;li&gt;</code> html using clone() and append it to <code>&lt;ul&gt;</code>.</p> <pre><code> $.each(arr, function(i) { var item = $('#template').clone(true); if(arr[i].isTypeA) { item.find('.TypeB').remove(); } else { item.find('.TypeA').remove(); } }); </code></pre> <p>But appended items in <code>&lt;ul&gt;</code> have no element (.TypeA) after looping.</p> <p>Does this problem comes from clone()? or from closure?</p> <p>I'm searching the solution, but couldn't find yet.</p>
javascript jquery
[3, 5]
922,536
922,537
Implementing SQLCIPHER for SQLITE Encryption in android?
<p>I had a problem with SQLLITE Encryption, i did it in dotnet and tried to open in C# but i failed. so iwas looking on SQLCIPHER, but how do i start with this. I am not able to attach any passowrd to the SQLITE and one more thing is , do i need to purchase this to implenment in android?</p>
c# android
[0, 4]
4,295,538
4,295,539
Why not Server.Transfer why only Response.Redirect
<p>I am having 2 text boxes and a button and a Href tag to open a calendar when clicks on it. The same i have on another page</p> <p>I write a code to transfer to a particular page as follows using Respose.Redirect</p> <pre><code>protected void Button1_Click3(object sender, EventArgs e) { Response.Redirect("Demo/Default.aspx");//Works fine //Server.Tranfer("Demo/Default.aspx"); // Does not works } </code></pre> <p>This works cleanly but if i use Sever.Tranfer on the second page i am unable to load the calendar control when user clicks on Href tag</p>
javascript asp.net
[3, 9]
2,588,880
2,588,881
Jquery .post then use .show and .hide
<p>So I'm learning JQuery and I'm stuck on this:</p> <p>I have a page that displays a HTML table and inside that table I want to have a cell that can be updated via a dropdown menu, so you click on edit, the current value disappears and dropdown menu appears, and when the value is changed the database is updated and the new value is displayed. (with the menu disappearing) </p> <p>The problem seem to be putting the .text and .show inside the data callback function - if I alert the data it is returning the correct data from the PHP file, and if I comment out the .post line and replace the (data) with ("test_text") it replaces the menu as I want it to.</p> <p>Hopefully my question is well enough written to make sense, thanks.</p> <p>Here's the code</p> <pre><code>$('.cat_color_hide_rep').hide(); $('.act_status_dropD').click(function () { var record_id = $(this).parents('tr').find('.record_id').text() $(this).parents('tr').find('.cat_color_hide_rep').show(); $(this).parents('tr').find('.cat_color_show_rep').hide(); }); $('.cat_color_hide_rep').change(function () { var record_id = $(this).parents('tr').find('.record_id').text() $(this).parents('tr').find('.cat_color_hide_rep').hide(); $.post('TEST_ajax_rep_list_status.php', { ID: record_id }, function (data) { $(this).parents('tr').find('.cat_color_show_rep').text(data); $(this).parents('tr').find('.cat_color_show_rep').show(); alert(data); // for testing }); }); </code></pre>
php jquery
[2, 5]
5,493,652
5,493,653
Checkbox not selecting/deselecting
<p>i adding a couple of checkboxes via jQuery's html() but thats not an issue, because ive tried a single snippet in a blank html and it works. although, the checkboxes are still not getting selected/deselected. what's weird is that binding the click event to each checkbox via jQuery, clicking each checkbox works (as i added a simple alert box and i get the alert), but the checkboix doesn't stay selected. ideas as to what it could be? thanks</p>
javascript jquery
[3, 5]
565,675
565,676
How can I establish a long-lived connection with jQuery for push notification?
<p>I am trying to establish a long lived connection using jQuery. I have a URL in the form of:</p> <pre><code>http://www.sample.com/Notify?sessionId=xxxxxx </code></pre> <p>Now if I call this URL with the sessionId, it is equivalent to registering for Asynchronous notifications. I am aware of ajax calls using jQuery but as I understand it, after getting some data, jQuery terminates the connection. Is there a way to make it retain the connection so that the server miht be able to push information?</p>
javascript jquery
[3, 5]
3,510,573
3,510,574
Generate my links automatically
<p>I would like to generate my links automatically via a static class in each of my aspx pages (or in a common BasePage).</p> <p>Currently I use this:</p> <pre><code>private const string TEMPLATE = "~/One.aspx"; public static string Link () ( string link = String.Format(TEMPLATE); return link; ) </code></pre> <p>But the name of my page, One.aspx is hardcoded. Is it possible to generate the path instead of this hardcoded constant TEMPLATE. You should know that I do not instantiate the class before creating the link.</p> <p>The idea is to never hardcode a link but use a variable in my Redirect()</p> <pre><code>HttpContext.Current.Response.Redirect(PageOne.Link); </code></pre>
c# asp.net
[0, 9]
5,420,545
5,420,546
how to format time with jquery/javascript
<p>I have a JSON feed that drupal spits out time in this format: <strong>2010-12-16T04:41:35Z</strong></p> <p>How do I go about formating it to X minutes/hours ago?</p>
javascript jquery
[3, 5]
3,272,857
3,272,858
How to implement `using` in javascript?
<p>I would like to make something like this (similar to <a href="/questions/tagged/c%23" class="post-tag" title="show questions tagged 'c#'" rel="tag">c#</a>):</p> <pre><code>using("content/jquery.js"); $("div").fadeOut(); </code></pre> <p>So if <code>content/jquery.js</code> is not on a <code>script</code> in the <code>head</code> I would like to load it and continue the execution after it loads.</p> <p>Is it possible to implement this or something similar? Note: I could have more than 1 <code>using</code></p>
javascript jquery
[3, 5]
313,183
313,184
How to access content inside class library when run in a website
<p>I have a class library name "VirusScanManager" that contains a folder named "Lib". This folder contains a command-line scanner exe and supporting files. All these files have "Build Action" set to "Content" and "Copy to Output Directory" set to "copy always".</p> <p>Inside the library I get the path to the folder using the following line:</p> <pre><code>string virusCheckFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Lib"); </code></pre> <p>I have a Tests class library with a reference to VirusScanManager. When the tests are run the <code>virusCheckFolder</code> is set to </p> <p><code>C:\...\Projects\WebSiteMobileAdmin\Tests\bin\Debug\Lib</code> </p> <p>and this works because the files are copied there.</p> <p>I also have a BusinessLogicLayer class library with a reference to VirusScanManager. When I run my website the <code>virusCheckFolder</code> is set to </p> <p><code>C:\...\WebSites\WebSiteMobileAdmin\Lib</code></p> <p>this doesn't work because the files are actually copied to </p> <p><code>C:\...\Projects\WebSiteMobileAdmin\BusinessLogic\bin\Debug\Lib</code></p> <p>I then tried reflection as suggested by Beaner:</p> <pre><code>string pathToDLL = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "")); string virusCheckFolder = Path.Combine(pathToDLL, "Lib"); </code></pre> <p>This gives me</p> <p><code>C:\...\WebSites\WebSiteMobileAdmin\Bin\Lib</code></p> <p>But this folder does not exist. I have a reference to BusinessLogicLayer in WebsiteMobileAdmin, and a reference to VirusScanManager in BusinessLogicLayer . It appears that when I do a build, the dll is created in both BusinessLogicLayer\bin\debug and WebsiteMobileAdmin\bin, but the lib folder is only copied to BusinessLogicLayer\bin\debug.</p> <p>So, is there a way to get the path to the internal library that works for both scenarios?</p>
c# asp.net
[0, 9]
2,419,373
2,419,374
Listview cacheColorHint having problem?
<p>I'm trying to scroll the item in listview. It works properly with (android:cacheColorHint="#00000000"). But, now i want to scroll with selecting item only should change it's color like orange. How to do this? Is it Possible? Thanks in Advance.</p>
java android
[1, 4]
1,657,181
1,657,182
Is there any limit that application state can store ??
<p>Is there any limit that application state in asp.net can store ?? Am trying to know the limit so that I can avoid any slow on my application performance. </p>
c# asp.net
[0, 9]
3,202,248
3,202,249
How can I dynamically do write a value into a function call?
<pre><code>&lt;asp:LinkButton class="uibutton normal submit" ID="LinkButtonMAR" OnClick="MarkClientNoteRead(&lt;%# Eval("NoteID") %&gt;)" runat="server"&gt; Mark as Read&lt;/asp:LinkButton&gt; </code></pre> <p>This is all within a repeater that will return a list of notes. I want to grab the NoteID and throw this into the <code>OnClick="MarkClientNoteRead()"</code> method call.</p> <p>Is this possible?</p>
c# asp.net
[0, 9]
700,393
700,394
jQuery inArray - problems
<p>Say I have a variable <code>a</code> with the value:</p> <pre><code>1 </code></pre> <p>Then I have an array <code>b</code> with the values:</p> <pre><code>[1, 2] </code></pre> <p>Why does <code>$.inArray(a, b)</code> give me a -1? I should be getting <code>0</code>, right?</p>
javascript jquery
[3, 5]
948,795
948,796
Is learning C# a better solution for me than learning extensive python frameworks?
<p>I've learned (atleast the basics) of python but it seems frustrating to have to learn every framework in the world to be able to do anything reasonable. Looking at C#, now it could be my ignorance but it seems alot of the tools are included in the whole package (GUI, Networking).</p> <p>This makes me want to switch my primary language to learn to C#. Am I wrong in this analysis or is it pretty much the same process in C# as it is in python learning all these frameworks.</p> <p>Sorry if this question is confusing but I didn't know how to really ask. </p>
c# python
[0, 7]
1,611,073
1,611,074
get every page under a website
<p>I need a program to get all the web pages under a website. The website is Chinese, I want to get all those English words out. Then I can extract all the information I need. Any ideas for this? Is there any software for this purpose?</p> <p>If NO, I would like to write one. Any suggestions?</p> <p>Thanks much.</p>
java php
[1, 2]
2,185,432
2,185,433
Disable click event on ajax loaded content of a DIV
<p>I need to disable click event on ajax loaded content of a DIV. </p> <pre><code>&lt;div id="left_column"&gt; &lt;div class="menu"&gt;------&lt;/div&gt; &lt;div class="menu"&gt;------&lt;/div&gt; &lt;div class="small_panel1"&gt;------&lt;/div&gt; &lt;div class="small_panel1"&gt;------&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I want disable click event from all div inside leftcolumn.</p> <p>I am trying below code but it is not working :- </p> <pre><code>$("#left_column").children().bind('click', function(){ return false; }); </code></pre> <p>Please suggest me what should I use here. Thank in advance</p>
javascript jquery
[3, 5]
4,979,935
4,979,936
Jquery treeview via asp.net
<p>How can I populate a jQuery Treeview via asp.net?</p> <p>And then afterwards populate access to Text and Value of selected node Treeview at clientside?</p>
asp.net jquery
[9, 5]
1,827,891
1,827,892
How to verify Digital Signature generated in C# for JAVA
<p>I have a string digitally signed in C#. The target to which the string is needed to be send use JAVA.</p> <p>How can i verify Digital signature in JAVA before send it to other end.</p>
c# java
[0, 1]
2,335,714
2,335,715
jquery hasClass, can it be given the beginning of class name, to get the full class name
<p>I'm trying to do something similar to <a href="http://stackoverflow.com/questions/10333210/how-can-i-get-the-class-name-as-a-string-that-begins-with-test-using-jquery">this question</a>, but it's a bit different, so the solution there isn't working for me. </p> <pre><code>&lt;span class="a-class another-class test-top-left"&gt;&lt;/span&gt; </code></pre> <p>I have an element (this code shows a <code>span</code> but it could be <code>div</code> <code>span</code> or anything). This element has a class beginning with <code>test-</code> (<code>test-top-left</code>, <code>test-top-right</code> etc.) I've triggered a click event on classes starting with <code>test-</code> and saved the clicked object as <code>var object = this;</code>. Simple stuff so far. </p> <p>What I'm trying to do now is get the full name of that class (<code>test-top-left</code>). I know it starts with <code>test-</code> but what's the full name. <strong>The thing is that there are other classes <code>a-class</code> <code>another-class</code> and <code>test-top-left</code>.</strong> Can <code>hasClass</code> be used to get the full name of the class? I'd prefer not to use <code>find()</code> or <code>filter()</code> just because there may be additional elements within that also have <code>class="test-"</code></p> <p><strong>Edit:</strong></p> <p>The code I have now is, but it gives me ALL the classes. What I need is the single class beginning with <code>test-</code>. </p> <pre><code>var object = this; $(object).attr('class'); </code></pre> <p>So now I for loop through all the classes and test each one separately, which seems like a lot of unnecessary code. I'm hoping jQuery has a clever way to get the exact class that was clicked right away.</p>
javascript jquery
[3, 5]
3,129,442
3,129,443
jquery on click event input
<p>Imagine this: i have multiple divs with attr "data-question-id" and inside this divs i have one or more inputs that may or may not have a attr "has-next-question". See the example below:</p> <pre><code>&lt;div data-question-id="5"&gt; &lt;input type="radio" has-next-question="true" value="2"&gt; test1 &lt;input type="radio" value="3"&gt; test2 &lt;/div&gt; &lt;div data-question-id="6"&gt; &lt;input type="radio" has-next-question="true" value="5"&gt; test3 &lt;input type="radio" has-next-question="true" value="7"&gt; test4 &lt;/div&gt; </code></pre> <p>As you can see in the first div i have two inputs, but one doesnt have the attr "has-next-question". My question is, how can i bind a click event on the input that have a parent div with attr "data-question-id" and this div have at least an input with attr "has-next-question".</p> <p>I already accomplish this:</p> <pre><code>$(document).on('click', 'div[data-question-id] input', function(e) { alert('click'); }); </code></pre> <p>any help? thanks guys</p> <p>Edit: Changed attr "has-next-question" because its a invalid html attribute.</p> <p>Imagine this: if i click in "test1" it should trigger the event, but if i click in "test2" it should too, because the parent div with attr "data-question-id" have at least one input with attr "has-next-question", corresponding to the "test1". If there is none input with attr "has-next-question" in the parent div, the event shouldnt trigger.</p>
javascript jquery
[3, 5]
4,992,967
4,992,968
alert box empty for php javascript
<p>why does this script show empty alert box. I am trying to use php value in javascript</p> <pre><code>&lt;script type="text/javascript"&gt; alert(&lt;?php echo count($myorder) ?&gt;); &lt;/script&gt; </code></pre>
php javascript
[2, 3]
5,246,986
5,246,987
jQuery setting specific numbers in select menus
<p>I am working on this website here <a href="http://offline.raileisure.com/" rel="nofollow">http://offline.raileisure.com/</a></p> <p>on the right there are some options to book a reservation..</p> <p>Where it says No. of Adults and No. of Children, i need this to be limited to x per property..</p> <p>i.e. if the Station Masters House is selected its maximum occupancy is 8 people..</p> <p>So if 5 Adults are selected i need the Children select menu to only show the differemce between 5-8 if that makes sense..</p> <p>Otherwise someone could book 5 children and 5 adults... and that would be more than the maximum 8...</p> <p>Same as if the carriage is chosen the maximum occupancy is 4</p> <p>Thanks</p> <p>Lee</p>
javascript jquery
[3, 5]
4,698,015
4,698,016
C# code all of a sudden crashing IE
<p>My C# code, ASP.NET, was working perfectly fine on my computer untill I moved it to another pc through remote desktop control. The exact same code works on my computer but on the other computer shortly after I run the application IE crashes...Visual studio gives the below errors. IE version is the same on both PCs and the errors look something permission related, what do you think?</p> <p><img src="http://i.stack.imgur.com/WwAwP.png" alt="enter image description here"></p>
c# asp.net
[0, 9]
783,107
783,108
setTimeout() won't trigger the function
<p>I'm trying to trigger the function in 5ooo second again and again with first_pic variable that contains different integer. Every time this function runs it adds plus 1 to first_pic variable, apparently it won't work, please help.</p> <pre><code>function slide(){ var total_pic = $("#slide_show").children().length; var first_pic = $("#slide_show li:first-child").css('z-index',total_pic).index()+1; $("#slide_show li:nth-child("+first_pic+")").fadeOut(4000, function(){ first_pic = first_pic + 1; }); setTimeout(slide, 5000); }; slide(); </code></pre> <p>variable adds 1 nicely, but setTimeout doesn't trigger function again</p>
javascript jquery
[3, 5]
4,039,550
4,039,551
How can I stop this setTimeout function from running?
<p>I use the function below to check on the status of a JSON file. It runs every 8 seconds (using setTimeout) to check if the file has changed. Once the JSON's status becomes 'success' I no longer want to keep calling the function. Can someone please show me how to do this? I suspect it involves the use of clearTimeout, but I'm unsure how to implement this.</p> <p>Cheers!</p> <pre><code> $(function() { var checkBookStatus = function() { var job_id = "#{@job.job_id}"; var msg = $('.msg'); var msgBuilding = $('#msg-building'); var msgQueuing = $('#msg-in-queue'); var msgSuccessful = $('#msg-successful-build'); var msgError = $('#msg-error'); $.ajax({ url: '/jobs/'+job_id+'/status.json', datatype: 'JSON', success:function(data){ if (data.status == "failure") { msg.hide(); msgError.show(); } else if (data.status == "#{Job.queue}") { msg.hide(); msgQueuing.show(); } else if (data.status == "#{Job.building}") { msg.hide(); msgBuilding.show(); } else if (data.status == "#{Job.failure}") { msg.hide(); msgError.show(); } else if (data.status == "#{Job.success}") { msg.hide(); msgSuccessful.show(); } }, }).always(function () { setTimeout(checkBookStatus, 8000); }); }; checkBookStatus(); }); </code></pre>
javascript jquery
[3, 5]
3,472,363
3,472,364
Adding data dynamically to a asp literal control inside a grid view
<p>I'm tring to add data to a literal which place inside a gridview. Currently code look like this</p> <pre><code>protected void GvListingRowDataBound(object sender, GridViewRowEventArgs e) { var qurey = DisplayAllData(); Literal info = (Literal)e.Row.FindControl("ltritemInfo"); if(qurey != null) { foreach (var listing in qurey) { var list = DisplayListById(listing.id); info.Text = "&lt;h3&gt;" + list.title + "&lt;/h3&gt;"; info.Text += "&lt;h4&gt;" + list.description + "&lt;/h4&gt;"; } } } </code></pre> <p>This will generate an error "Object reference not set to an instance of an object."</p> <p>if anyone have idea about this it will be great help</p> <p>Thanks</p>
c# asp.net
[0, 9]
1,414,875
1,414,876
Using JQuery, how do I turn a .click() event into something that happens with no user action?
<p>I'm currently working with the following code:</p> <pre><code>$("li.className").click(function () { $(this).fadeTo(1000, 0); }); </code></pre> <p>which turns the <code>&lt;li&gt;</code> opacity down on click. How do I make this happen with no user interaction at all, such as when the page loads or after a certain duration of time?</p>
javascript jquery
[3, 5]
1,838,646
1,838,647
Is a webmethod in codebehind as secure as the page it is on?
<p>This is kind of confusing me. I would assume the webmethod would follow the same authorization rules set in the web.config as the page it is on. Will it execute the normal page lifecycle first? In my case there is extra logic in a basepage that checks further permissions. Will this logic be executed before the webmetod is called to prevent access from users not permitted to access that page?</p>
c# asp.net
[0, 9]
3,378,210
3,378,211
How to initalize a JavaScript function
<p>My understanding is that a function in JavaScript can have states. Some states need to be initialized just once. How do you do that so that calling the function does not re-initialize them?</p> <p>For example, <code>$()</code> in jQuery is a function, not an object, and yet it seems to have states and act like an object.</p> <p>I thought about creating an object for this, but what I want is really a facade function, much like the way <code>$()</code> works.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,169,945
3,169,946
How to limit drop down list FindByText to first result
<p>I'm using this code to find an item by text:</p> <pre><code>ddlCountry.Items.FindByText("someCountry").Selected = true; </code></pre> <p>I receive an exception that says the drop down list cant multiselect which sounds reasonable to me. I'm not sure how to refactor the code above to tell it to select only the first item it finds.</p> <p>Note: It's a group drop down list with quick picks which is why there is duplicates.</p>
c# asp.net
[0, 9]
684,043
684,044
How to chain selectors in Javascript without jQuery
<p>While trying to manipulate the layout of external sites I am often forced to use a chain of selectors to target the specific element I want. The first time I encountered this I was offered a jQuery solution and it is very easy to get results. I would prefer not to rely on jQuery and would like to know how feasible this is in standard Javascript. Here is an example jQuery 'chain' -</p> <pre><code>$('div[id="entry"] &gt; p[class="header"] &gt; span[id="title"] &gt; div[class*="entry"] &gt; p[class="title"] &gt; a[class*="target"]').. etc </code></pre> <p>So say the HTML structure is roughly</p> <pre><code>&lt;div id="entry"&gt; &lt;p class="primary"&gt; &lt;p class="header"&gt; &lt;span class="side"&gt; &lt;span id="title"&gt; &lt;div class="secondary entry"&gt; &lt;p class="return"&gt; &lt;p class="title"&gt; &lt;a class="img"&gt; &lt;a class="mytargetelement"&gt; </code></pre> <p>So how is this possible normally? Thanks.</p>
javascript jquery
[3, 5]
747,018
747,019
web.config defaultRedirect not working
<p>I have a problem to redirect to my error page. In global.asax I have implemented Application_Error, so I can catch and log errors.</p> <p>If I put this:</p> <pre><code>&lt;customErrors mode="On" defaultRedirect="~/Errore.html" /&gt; </code></pre> <p>everything works...</p> <p>with this: </p> <pre><code>&lt;customErrors mode="On" defaultRedirect="~/Errore.aspx" /&gt; </code></pre> <p>it is show the page: <a href="http://localhost:3821/Errore.aspx?aspxerrorpath=/pagine/Ricerca.aspx" rel="nofollow">http://localhost:3821/Errore.aspx?aspxerrorpath=/pagine/Ricerca.aspx</a></p> <p>BUT on Errore.aspx Page_load() or OnError() are not called, and the page showed is just the standar one, (runtime error) that suggest to change to off the mode in customErrors.</p> <p>This is on my pc, so there is not IIS... ...and I don't use authentication (not yet)</p> <p>Any clue?</p> <p>Thanks, Alberto</p> <p>UPDATE: The error occur in Global.aspx, in Application_Start() . When the error occur, redirecting to an .aspx page will cause an error because the app is not up. The solution is to redirec to an html page. Thanks to everyone Alberto</p>
c# asp.net
[0, 9]
2,193,323
2,193,324
Problem in opening doc/docx/excel files in browser(Asp.net, C#)
<p>I am storing some files like PDF,Doc, Docx, xls etc. in the file system.</p> <p>Now I have to show those files on the browser for the users to view.</p> <p>So basically a link button is there in a datagrid, upon clicking on which the user will be able to view.</p> <p>So far my code goes like this</p> <pre><code> Response.Clear(); // Response.ContentType = "application/pdf"; //Response.ContentType = "application/x-msexcel"; //Response.ContentType = "application/msword"; string strFilePath = @"C:\test.pdf"; // string strFilePath = @"C:\test.doc"; Response.WriteFile(strFilePath); Response.End(); </code></pre> <p>This works fine for pdf files but fails for word or excel files. In the browser I am able to view the pdf but the other files are not opening in browser but are asking for the </p> <p>"Save" , "Open" dialog box option. If I click on "Open", it will open in a normal window instead of browser.</p> <p>How can I achieve my target? The browser is IE</p> <p>Thanks in advance</p>
c# asp.net
[0, 9]
4,498,647
4,498,648
C# date AddDays output
<p>I have following code:</p> <pre><code>string date = "13.04.2012"; string date2 = (DateTime.Parse(date).AddDays(1)).ToString(); </code></pre> <p>This is working correctly without a problem but after the <code>DateTime.Parse</code> function the variable date2 is '14.04.2012 00:00:00' but i would like to have only the date '14.04.2012' without the timestamp.</p> <p>I thought about using the substring function like this:</p> <pre><code>string sub = date2.Substring(0, 10); </code></pre> <p>That would work like this but isn't there a better way to get that result?</p>
c# asp.net
[0, 9]
1,054,164
1,054,165
javascript: how to parse a date string
<p>The format is: MMDDHHMM</p> <p>I want to take month, day, hour, minute individually, how to do that?</p>
javascript jquery
[3, 5]
6,032,091
6,032,092
Can I have send two AlarmManager in a application
<p>I have two class, A, B in these classes. Both of them I have a alarmmanager like next;</p> <pre><code>class A{ PendingIntent sender; AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); .......... am.set(AlarmManager.RTC_WAKEUP, atTimeInMillis, sender); </code></pre> <p>}</p> <pre><code>class B{ // some code like Class A} </code></pre> <p>Then, both A and B send the PendingIntent to a BroadcastReceiver B. I think it's wrong to have two AlarmManger in a Application. can you tell me the truth. I want to do like that, because I want to trigger a notifiction in c instead of a service. because I think service is a waste to do that.in class A I want to trigger something else. Besides what I want to do can't be do in class A .so I want to do it in class B individually.</p>
java android
[1, 4]
3,755,336
3,755,337
What is the logic for this action?
<p>I have an array which is page:['null',0,1000,2000] I have a variable scrollx, which detect user scrolling x position I have a function scrollto(), input a number will scroll to that position with animation</p> <p>What I want to do is when scrollx is smaller than half of page[3] which is 1500, it will scrollto(page[2]), like scrollx 1200,1300,1400, it will goes to page[2], otherwise it goes page[3].</p> <p>but I cant think of a good solution...</p> <pre><code>$viewport.on('touchend',function(event){ for(i=1;i&lt;=total;i++){ if(scrollx &lt; page[i]/2 || scrollx &gt; page[i]/2){ scrollto(page[i]); } }) </code></pre> <p>I messed up, thats seems not logical...which page it goes to... now I have the current page positions,all the other pages positions but..what should I do?</p>
javascript jquery
[3, 5]
3,151,661
3,151,662
Change GridView row color based on condition in C#
<p>I want to change a particular row color of gridview based on some condition, i am using ASP.NET with c#.Thank you.</p>
c# asp.net
[0, 9]
5,054,203
5,054,204
Force a usercontrol on web page to reinitialize iteself
<p>There are 2 user controls, one is inside the other. </p> <p>These controls are located on an .aspx. </p> <p>One control is a modal popup the other is a custom search control (the search control is inside the modal popup). </p> <p>After a user has completed a search and closes the form, the next time the popup opens (for the same user) the old values are still present. </p> <p>How can I clear the values out each time the form loads? </p> <p>Edit: Is it possible to capture the popup closing event?</p>
c# asp.net
[0, 9]
2,962,131
2,962,132
fullscreen & centred background image script
<p>I have made a simple function that adapts the size of an image according to the size of the window. I can't determine when exactly, but sometimes the img does not fill the width of the screen, but continues to stick to the height. Any idea why this could be?</p> <p>If i console log (iRatio &lt;= wRatio) anything seems to fit, but the shown result is incorrect.</p> <p>The img is set as <code>postion: absolute; with: 100%; top:0; left:0;</code> in the css. <code>$win</code> contains <code>$(window)</code> and <code>$img</code> the background image</p> <pre><code>function autoImageSize($img, $win){ var wHeight = $win.height(), wWidth = $win.width(), iHeight = $img.height(), iWidth = $img.width(), iRatio = iWidth / iHeight, wRatio = wWidth / wHeight; if(iRatio &lt;= wRatio){ $img.css({ width: "100%", height: "auto", top: "-" + ((iHeight - wHeight)/2) + "px", left: 0 }); }else{ $img.css({ width: "auto", height: "100%", top: 0, left: "-" + ((iWidth - wWidth)/2) + "px" }); } return [$img.width(), $img.height()]; }; </code></pre>
javascript jquery
[3, 5]
3,428,824
3,428,825
Let user know of long operation when initiating request to download file
<p>I have some routine code which downloads a file (as below). However, while this is processed (there is lag time between the request to download the file and the save dialog box coming up), I want to add some sort of JavaScript modal alert to let the user know of the pending operation. How could I easily do this from a user control?</p> <pre><code> System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.ClearContent(); response.Clear(); response.ContentType = "text/plain"; response.AddHeader("Content-Disposition", "attachment; filename=" + zipFileName + ";"); response.TransmitFile(zipFilePath); response.Flush(); response.End(); </code></pre>
c# asp.net
[0, 9]
48,958
48,959
paging of datacontrol in jquery dialog
<p>I'm using Jquery dialogs in my Asp.net web application for all my messages. Now I've tried to fill a listview with customers inside a dialog and its working, but I want to allow the user to use paging in the listview for choosing his customer out of the list. When I press the button to move up 1 page, it ain't working...</p> <p>Maybe it's just not possible? Or does someone have an example of paging a datacontrol in a Jquery dialog?</p> <p>Greetz, Ben</p>
c# asp.net jquery
[0, 9, 5]
1,743,083
1,743,084
Android button that sends a keystroke to server
<p>Ok so I'm new to android programming and have taken on a project way outside my wheelhouse. I found an opensourced project that does "kinda" what I want it to do its remote droid 2.0 but I don't need the mouse aspect of it. I just need to place a button that sends the keystroke of 'w' but I cant find anything on the web to tell me how. I know how I would do this in PHP and javascript, I would just add an onclick event but no idea in android.</p> <p>So in closing please help a newby out examples or any tutorials that would get me to the end effect i need</p> <p>Its funny how I've made fun of people in the past for saying "i just wanna <strong><em>_</em>__<em>_</em></strong> why is that so hard" and i always say code doesn't understand what you want until you tell it. now im faced with swallowing my own sarcasm.</p>
java android
[1, 4]
1,075,498
1,075,499
time count after registry
<p>I saw some website that after you have registered, you can use the service like posting a comment immediately.</p> <p>You may have to wait for 5 or 10 minutes to be able to start, like this StackOverflow website.</p> <p>Once you have asked question, you have to wait 20 minutes to select your answer.</p> <p>If I want to do it in JavaScript or PHP can anyone show me how to do it? I assume you have to compare the time with current time-stamp, but don't know how to exactly implement it. Thanks in advance!</p>
php javascript jquery
[2, 3, 5]
2,043,019
2,043,020
setup format for columns of DataTable or GridView
<p>How can I setup some format for cells in some column in my DataTable or GridView ?</p> <p>I need to make some double columns rounded , for example :</p> <p>3.564643 -> 3.56</p> <p>3.546723 -> 3.55</p> <p>6.654644 -> 6.65</p> <p>thank you.</p> <p>DataFormatString ? where ?</p> <p>Question still active, I didn't solved the problem :-/</p>
c# asp.net
[0, 9]
5,450,534
5,450,535
Keep Checking until True
<p>Basically, I have a form that is handled by a CMS which I cannot edit it's javascript, but I more or less want to add in a "Loading" or "Sending" message to my users. For example. </p> <p>Currently, the default form once submitted, will append a html success message to a div called 'success' once sent, but basically, I want to run a function on the submit button that keeps checking the 'success' for anything other than '' and once it isn't empty, turn off the loading symbol. </p> <p>Something like this perhaps:</p> <pre><code>$('#submitBtn').click(function(){ $('#loadingDiv').show(); while (!$('#success').html() == ''){ $('#loadingDiv').hide(); } }); </code></pre> <p>Any help would be greatly appreciated. I'm just not quite sure how to write it, I'm not great with jquery or javascript</p> <p>Kind regards, Shannon</p>
javascript jquery
[3, 5]
1,142,808
1,142,809
populate datagrid with codebehind dropdownlist value
<p>i have the following query in asp.net codebehind</p> <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Server=hussein-pc;database=datbase;integrated security=true" SelectCommand="SELECT * FROM [Spreadsheet]...... </code></pre> <p>where spread sheet is the name of a table i want to change the name of the table according to the value of my drop down list in asp.net code behind! </p>
javascript asp.net
[3, 9]
2,915,796
2,915,797
extracting multidimension json array in javascript
<p>I am reading a json response from a server which is sending a multidimensional array from a sqlite database using the following php code:</p> <pre><code>while ($data = $result-&gt;fetchArray(SQLITE_NUM)) { echo json_encode($data); </code></pre> <p>This works Ok and sends its data out as a string in the following format: [1,"Board1","Floor1",1,100,1,"D1","D2","D3","D4","D5","D6","D7","D8","D9","D10"] [1,"Board2","Floor2",1,100,1,"D1","D2","D3","D4","D5","D6","D7","D8","D9","D10"] [1,"Board3","Floor3",1,100,1,"D1","D2","D3","D4","D5","D6","D7","D8","D9","D10"] </p> <p>I am using jQuery to request this data from the server using the following code and want to save the recieved data in a javascript array so that I can access individual items using for example data[0][1] would to refer to the "Board2" element - but cannot seem to do this?</p> <p>The code works with a single array, but not with multi-arrays?</p> <p>JAVASCRIPT CODE:</p> <pre><code>function requestMtrConfig() { $.ajax({ url: '/php/getmtrconfig.php', async:false, // synchronous read success: function(datas) { data[0] = datas[0]; data[1] = datas[1]; data[2] = datas[2]; } }, cache: false }); } </code></pre> <p>How can I put the returned json array into a multi-dimensioned javascript array? PS: I have already created a global multidimensioned javascripy array variable called data.</p> <p>Any help would be much appreciated thanks Frank dobbs</p>
javascript jquery
[3, 5]
2,252,297
2,252,298
Is there any way to tell which property does a value come from?
<p>I know its a long stretch but... just had to try.</p> <p>For example if I made a DateTime control with a SelectedDate property, if in the server-side code it is being set to Person.DateOfBirth, in the DateTime control is there any way to tell that the SelectedDate came from Person.DateOfBirth?</p>
c# asp.net
[0, 9]
810,398
810,399
dynamically create a row of text box and label while click on add button using asp.net
<p>In my Table in Every row I had label and text box.in page load I show 3 text boxes and 3 labels.But When I click Add more button Every click we need create one label and One text box Dynamically...By Using Asp.net ,C#.net please help me I am stuck here.</p>
c# asp.net
[0, 9]
4,910,010
4,910,011
display 1st image inside id
<p>Interested to know if I can use jQuery to find the first image on the page and display it inside a resized to a thumbnail with click to enlarge. For example, on this particular blog, when the client adds an image to the post, jQuery will find the first image, display it as a clickable thumbnail in a particular location. It would be ideal if the detailed image could display in thickbox, facebox or another jQuery overlay window.</p> <p>Thanks in advance for your ideas. Jackson</p>
javascript jquery
[3, 5]
1,712,466
1,712,467
Gridview : How to make the header text multiline?
<p>I have a gridview and sqldatasource.</p> <p>The default header text for each column is for a single line. Is there any way of making the header *multiline so I can add another line of text under the first one.?</p> <p>Thanks</p>
c# asp.net
[0, 9]