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
3,888,166
3,888,167
Custom logging in a N-Tier Application
<p>I have an N-tier application, ASP.Net front end, then a .Net C# Business and Data Access Layer. I have created a simple custom logging library. This logging library is then used throughout my application i.e. Log.LogException and Log.LogMessage.</p> <p>For this logging library I want to define the custom path for the logs folder created by my application. I initially thought the correct approach was to use an App.Config for my Logging library and then read in the path from there but the problem is that when I publish my Web App to its Target Location it copes all the binaries across including the logging DLL but not the accompanying App.Config.</p> <p>This leads me to believe that this is not the right approach. I could do some "hack" to copy it across but that is a bad idea if it is not the best design approach.</p> <p>Is this a supported design or am I going down the wrong route?</p> <p>Thanks! </p>
c# asp.net
[0, 9]
5,972,674
5,972,675
Mobile Application design: Menu Driven vs Tab Control
<p>iPhone does not have Menus AFAIK; most of the stuff is driven by on screen controls and widgets. Android has menus, ofcourse. I am working on porting an iPhone application on Android platform.</p> <p>What are the advantages and disadvantages of the Menu driven approach?</p>
iphone android
[8, 4]
3,630,869
3,630,870
File upload returns incomplete (IE7,8,9) when using mod_rewrite on url with jQuery File Upload
<p>When uploading a file in internet explorer through jQuery File Upload (using the auto submit code found on the git page) on pages the where the url is rewritten via .htaccess, the file is uploaded correctly however appears with no link size or delete button until the page is refreshed. It then appears correctly.</p> <p>I have used the exact same code on a url that does not have a rewrite and it works as expected. This is only happening in Internet Explorer. I am running JFU on a LAMP server.</p> <p>At a guess I would presume that the JSON response it not returning correctly however my knowledge of JS is very limited and do not know where to look so am hoping some people will be able to point me in the right direction. </p>
php jquery
[2, 5]
4,765,778
4,765,779
jquery find() method
<p>Please consider the following code :</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;style&gt; p{ width:200px; } &lt;/style&gt; &lt;head&gt; &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;&lt;span&gt;Hello&lt;/span&gt;, how are you?&lt;/p&gt; &lt;p&gt;Me? I'm &lt;span&gt;good&lt;/span&gt;.&lt;/p&gt; &lt;script&gt; $(document).ready(function(){$("p").find($("*")).andSelf().css("background- color","blue"); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The output is the whole document turning into blue color while I only wanted the paragraph and span inside it to turn blue. </p> <p>If I use <code>$("p").find(" * ") instead of $("p").find($(" * "))</code> then everything shows according to my need. Can anyone work out the difference between the two approach?Thanks!</p> <p><strong>Note:</strong> Please everyone note that I know there are easier methods to do this stuff,but I just want to know why this didn't work..</p>
javascript jquery
[3, 5]
3,030,515
3,030,516
How similar is C# to C++
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/291513/differences-between-c-and-c-net">Differences between C++ and C#/.Net</a> </p> </blockquote> <p>I am reading <a href="http://ssw.jku.at/Teaching/Lectures/CSharp/Tutorial/Part1.pdf" rel="nofollow">this C# tutorial</a> and it says "similar to Java (75%) C++(10%)". is that true? I thought C# and C++ were the same language except for few handy abstractions which visual studio provides.</p>
c# c++
[0, 6]
3,887,896
3,887,897
Change an image for a second
<pre><code> ImageView image = (ImageView) findViewById(R.id.imageview); image.setImageResource(drawable.image1); SystemClock.sleep(1000); image.setImageResource(drawable.image2); </code></pre> <p>I am trying to change the image for a second, my code above doesn't work but not sure why? Should I be using a thread? or does anyone have any better ideas?</p> <p>EDIT To clarify on the problem:</p> <p>The image being displayed as "drawable.image2" I want "drawable.image1" to be shown for one second then change to "drawable.image2".</p> <p>EDIT2:</p> <p>This code is used in the onClick. When a user clicks the image it needs to change for one second</p>
java android
[1, 4]
2,482,670
2,482,671
adding unique class for new div
<p>I want add a unique class for each new div after input, how is it in my code?</p> <p>Add class for this: <code>&lt;div class="thing"&gt;&lt;/div&gt;</code></p> <p><strong>DEMO:</strong> <a href="http://jsfiddle.net/wAwyR/2/" rel="nofollow">http://jsfiddle.net/wAwyR/2/</a> => please in here(field) typing a number for adding new input.</p> <pre><code>function unique() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (var i = 0; i &lt; 5; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } $('input').live("keyup", function () { $('.lee').empty(); var $val = $(this).val(); for (var i = 0; i &lt; $val; i++) { $('.lee').append('&lt;input type="text" name="hi" class=""&gt;div class="thing"&gt;&lt;/div&gt;'); $('input[hi]').next('div').attr('class', unique()) } }); </code></pre>
javascript jquery
[3, 5]
2,915,411
2,915,412
When a text box contains the <BR/>, Button is not getting clicked
<p>I have web application in ASP.NET</p> <p>In application I have web page contains a text box for Book Details to entered.</p> <p>I want user to enter <code>&lt;BR/&gt;</code> in that TextBox.</p> <p>When a text box contains the <code>&lt;BR/&gt;</code> string a Button which submit data to server is not getting clicked. I dont want user should enter <code>&amp;lt BR/ &amp;gt</code> line in TextBox instead of <code>&lt;BR/&gt;</code></p> <p>Any help?</p>
c# asp.net
[0, 9]
5,295,475
5,295,476
Javascript / jQuery: Only fire animation if mouse isn't over the element after page load
<p>I have a slider on a page and a function that fades out the previous/next arrows after a few seconds, and then when the user hovers over the slider they fade back in. The only issue is that when the slider loads and the user has their mouse hovering over it, the arrows still fade out, and the user has to move the mouse outside of the arrows and then back in to see them again. Here is my code:</p> <pre><code>var prevNextBtns = $('.direction-nav'), fadeOutArrowsTime = 3000; setTimeout(function () { prevNextBtns.stop().animate({'opacity': '0'}, fadeOutArrowsTime); }, fadeOutArrowsTime); prevNextBtns.closest('.slider-container').hover(function () { prevNextBtns.stop().animate({'opacity': '1'}, 500); }, function () { prevNextBtns.stop().animate({'opacity': '0'}, 500); }); </code></pre> <p>Basically I want the arrows to fade out after <code>3000</code> after the page loads, but <em>only</em> if the user doesn't have their mouse over.</p>
javascript jquery
[3, 5]
5,076,926
5,076,927
jQuery Image Gallery stops working in IE7&8 after using for small period of time
<p>I have the following code I am using for a photo gallery. In Internet Explorer 7 &amp; 8 the gallery stops working. The image fades out after several clicks and the new image does not fade in. After this occurrence happens (about 6 or so clicks) the gallery does not function at all. All other browsers work flawlessly. I have also used this code in several other pages with no problems.</p> <pre><code> $("#list-image-carousel").find('a').click(function(e) { e.preventDefault(); var src = $(this).attr("href"); $("#main-img").find('img').fadeOut(400, function() { $("&lt;img/&gt;").attr("src", src).load(function() { $("#main-img").find('img').attr("src", this.src).fadeIn(400); }) }) }); </code></pre> <p>Any ideas are greatly appreciated. Thanks in advance!</p>
javascript jquery
[3, 5]
2,011,310
2,011,311
Trying to setup binding to a callback with different values
<p>I am trying to build a jquery function that builds a series of buttons and binds them to the callback with different argument values. The issue I am having is that the callback is always called with the argument value of the last buttons[] value "cancel" no matter which button is clicked. </p> <pre><code>var buttons = ["OK|ok", "Cancel|cancel"]; buildButtons(buttons, function(response){ alert(response); }); function buildButtons(buttons){ for (i = 0; i &lt; buttons.length; i++){ var btnTitle = buttons[i].split("|")[0]; var btnName = buttons[i].split("|")[1].toString(); var btnElem = $('&lt;button/&gt;', { type: 'button', id: 'btn_' + btnName, html: btnTitle, }) $(btnElem).on('click', function () { //..some other code fnResponse(btnName); //&lt;&lt;------- Issue Should return 'ok' or 'cancel' }); } } </code></pre> <p>The problem is that the callback is always called with the value [btnName] of the last element.. no matter which button is clicked.</p>
javascript jquery
[3, 5]
837,862
837,863
Getting part of referring url with jquery
<p>I'm trying to set a cookie with a value that is made up of part of a referring url. The referring url looks something like:</p> <pre><code>http://webct.university.ac.uk/webct/urw/lc715920578061.tp721521425061/courseMenu.dowebct? </code></pre> <p>and I need to extract:</p> <pre><code>lc715920578061.tp721521425061 </code></pre> <p>for reuse in another function. Would this be regex? Could anyone help with the syntax?</p> <p>Many thanks Matthew</p>
javascript jquery
[3, 5]
2,814,588
2,814,589
Am I using the correct naming for my javascript?
<p>I have the following and I am putting it in a directory called Prototypes:</p> <pre><code>$.fn.buildTableOfContent = function () { "use strict"; var h2 = this.find('h2'); if (h2.length &gt; 0) { var h1 = this.find('h1:first'); if (h1.length === 0) { h1 = this.prepend('&lt;h1&gt;Help&lt;/h1&gt;').children(':first'); } var menu = h1.wrap('&lt;div class="h1 with-menu"&gt;&lt;/div&gt;') .after('&lt;div class="menu"&gt;&lt;img src="/Content/images/menu-open-arrow.png" width="16" height="16"&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/div&gt;') .next().children('ul'); } return this; }; </code></pre> <p>Does this correctly describe what the function does? In which case how do you think I should name the directory that holds a file containing the following:</p> <pre><code>$.fn.updateTabs.enabledHash = false </code></pre> <p>Hope this question does not get removed as I would like to know how people give directory names to certain javascript code like this.</p>
javascript jquery
[3, 5]
2,987,822
2,987,823
How to set the year of a date based on value from drop down
<p>I have a drop down that has the years basically 2011,2010,2009 etc... and there is a date that i need to append the year selected to, basically I want to check todays date</p> <pre><code>DateTime dt = DateTime.Today; </code></pre> <p>and then change the year of dt to the value selected of my drop down</p> <p><code>dt.Year = ddlMyYear.SelectedValue;</code> but this does not work, not sure how to do this..</p> <p>Thank you</p>
c# asp.net
[0, 9]
796,518
796,519
Which PHP-template to load depends on javascript support
<p>I have the following scenario:</p> <p>A multiple step registration procedure. Let's say it's 4 steps, and each step depends on previous input. This could be solved with or without Javascript.</p> <p>Without JS: A "proceed"-button is attached to each step With JS: The next part is automatically revealed to the user when previous step is done. (No "proceed"-button exists.</p> <p>The problem is: How do my template engine know which one to present? With or without proceed buttons? You can not just try to test a JS-block of code to determine if it is enabled before PHP loads the template.</p> <p>One way I've worked out is the possibility that the initial load of the visit sends an ajax-request to a file on the server which only purpose is to set $_SESSION['JS_ENABLED'] = 1 or something like that.</p> <p>I don't like this. The HTTP request for that file might very well fail leaving the site in belief that the visitor has JS disabled.</p> <p>I think I need a new approach. Please enlighten me =)</p>
php javascript
[2, 3]
576,811
576,812
Simple android app to print text
<p>I recently started watching youtube videos about android development. I watched a few and tried to write my own app. Basically what it does is, the user enters a text in the text field and when the user presses the click button, the entered value is displayed on a text view. </p> <p>I am very confused as to where I should define variables and how to retrieve values and how to show values on a specific item. I want to know this stuff so I can correctly begin developing android apps. This is the code that I currently have:</p> <pre><code>package com.abihnav.numdisplayer; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity { public String YOUR_NUM = "YOUR_NUM"; EditText numEditText; TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); EditText numEditText = (EditText) findViewById(R.id.numEditText); TextView textView = (TextView) findViewById(R.id.textView1); } public void printNum(){ YOUR_NUM = numEditText.getText().toString(); textView.setText(YOUR_NUM); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } </code></pre> <p>Whenever I enter text or a number, the app force closes. HELP?!</p>
java android
[1, 4]
1,083,060
1,083,061
string to array format using asp.net in c#
<pre class="lang-none prettyprint-override"><code>[RESPONSE] code = 211 description = Domain name not available queuetime = 0 runtime = 0.004 EOF </code></pre> <p>I need the above response in the following output format in ASP.NET:</p> <pre class="lang-none prettyprint-override"><code>code = 211 description = Domain name not available queuetime = 0 runtime = 0.003 </code></pre>
c# asp.net
[0, 9]
4,285,601
4,285,602
setTimeout delay not functioning - what have I done wrong?
<p>I've put together a piece of code for a drop-down menu, bound to <code>.hover()</code>, however unfortunately the delay on <code>setTimeout()</code> doesn't seem to work and as soon as the mouse is moved from <code>.button</code>, it sets the display property of <code>#sub-nav</code> to <code>none</code>.</p> <p>Dreamweaver CS 5.5 evaluates the syntax as correct :(.</p> <p><strong>Here's my code:</strong></p> <pre><code>function retract(){ $('#sub-nav').css('display', 'none'); } $('#header-restrict &gt; .button').hover( function() { if($(this).html() == "Offers") { $('#sub-nav').css('display', 'block'); $('#sub-nav').html('&lt;a href="#"&gt;Add a New Offer&lt;/a&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="#"&gt;Edit an Offer&lt;/a&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="#"&gt;Get Offer Links&lt;/a&gt;'); } if($(this).html() == "Rotations") { $('#sub-nav').css('display', 'block'); $('#sub-nav').html('&lt;a href="#"&gt;Add a New Rotation&lt;/a&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="#"&gt;Edit a Rotation&lt;/a&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="#"&gt;Get Rotation Links&lt;/a&gt;'); } }, function() { setTimeout(retract(), 4000); }); </code></pre> <p>If anyone could comment on/answer as to why the delay doesn't seem to be working, it would be greatly appreciated!</p>
javascript jquery
[3, 5]
4,088,278
4,088,279
.NET Framework equivalent of Python's imghdr.what function
<p>Does .NET Framework have a function similar to Python's imghdr.what function to determine what type of image a file (or stream) is? I can't find anything.</p>
c# python
[0, 7]
1,399,711
1,399,712
Calling the inline JavaScript on a link using jQuery
<p>I am modifying an ancient table which has inline JavaScript in the form of <code>&lt;a href="javascript:&lt;lots of shit&gt;"&gt;</code>. The inline JavaScript works, but it would take months to rewrite it so that it fits my assignment, which is when an outer element is clicked the inline JavaScript should be executed.</p> <p>I'm sorry if I'm not making any sense, but I have been as thoughtful as to provide a <a href="http://jsfiddle.net/s8cQb/" rel="nofollow">fiddle</a>. (The table aspect shouldn't matter.) TL;DR: when I click one of the colored <code>div</code>'s I would like its inner <code>alert()</code> to execute and how do I do that?</p> <p><strong>Edit.</strong> Also, the link is actually hidden!</p> <p><strong>Edit #2.</strong> And, as for now, none of the HTML should be tampered with. Only jQuery/JavaScript.</p> <p><strong>Edit #3.</strong> I've updated the script to work with my table. The inner <code>&lt;span&gt;</code> is now not needed, I can select the <code>&lt;a&gt;</code> directly. Now I would just like to know if I'm using <code>stopPropagation()</code> correctly?</p> <p>Code:</p> <pre><code>$(function () { $('table.result-v2 tr.view').bind('click', function () { var $this = $(this), $next = $this.next(); if ($next.attr('class') == 'detail') { var $buttons = $this.find('td.buttons'), $link = null; if ($next.css('display') == 'none') { $link = $buttons.find('a.show-link'); } else { $link = $buttons.find('a.hide-link'); } if ($link != null) { eval($link.attr('href')); // evaluate found link $link.bind('click', function (event) { event.stopPropagation(); // is this needed when the link never can be clicked (it's hidden)? }); } } }); }); </code></pre>
javascript jquery
[3, 5]
1,769,929
1,769,930
jQuery slideToggle callback function and toggleclass
<p>HTML</p> <pre><code>&lt;div class="a"&gt; &lt;div class="b"&gt;CLICK&lt;/div&gt; &lt;div class="c"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="a"&gt; &lt;div class="b"&gt;CLICK&lt;/div&gt; &lt;div class="c"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="a"&gt; &lt;div class="b"&gt;CLICK&lt;/div&gt; &lt;div class="c"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>jQuery</p> <pre><code>$('.c').hide(); $('.b').click(function(){ $(this).next('.c').fadeToggle(); if($('.b').eq(0).is(this)){ $(this).toggleClass('yellow'); } }); </code></pre> <p><strong><a href="http://jsfiddle.net/nMskf/" rel="nofollow">ONLINE SAMPLE</a></strong></p> <p>How do I make once <code>slideToggle</code> finishes then start <code>toggleclass</code>, like the 1st box, I'd like it to change to yellow color once the fadeToggle finishes</p>
javascript jquery
[3, 5]
2,411,340
2,411,341
expert system android
<p>I want to create a program of expert systems in Eclipe android, but I do not understand what is needed, for example looks like this</p> <p><img src="http://i.stack.imgur.com/PzVVJ.png" alt="diagnosis system"></p> <p>and its diagnostic results such as the following view</p> <p><img src="http://i.stack.imgur.com/tbogn.png" alt="diagnosis result"></p> <p>and I was hoping for help from all</p>
java android
[1, 4]
283,927
283,928
Emulate drag-and-drop using JavaScript
<p>I know that jQuery can programmatically trigger events on DOM elements that are listening to those events. For example <code>$el.click()</code> will trigger a click event on <code>$el</code> without having to physically click <code>$el</code> with the mouse.</p> <p>Given two DOM elements <code>dom1</code> and <code>dom2</code>, is it possible to programmatically emulate a drag-and-drop from <code>dom1</code> to <code>dom2</code> using jQuery (or vanilla JavaScript), where <code>dom1</code> is draggable and <code>dom2</code> is droppable using jQuery UI.</p> <p>Note: The reason I want to do this is to build automated UI tests.</p>
javascript jquery
[3, 5]
3,007,412
3,007,413
ajax multiple file upload
<p>im trying to build a ajax multiple file upload because i found every plugin too complicated to configure, i started with a multi file upload in php, but i see that if i have too many file to upload at once when i submit the form it will take too much time to end, how is this latence handled? is this handled with jquery iframe transport? <a href="http://cmlenz.github.com/jquery-iframe-transport/" rel="nofollow">http://cmlenz.github.com/jquery-iframe-transport/</a></p> <pre><code>$("#myform").submit(function() { $.ajax(this.action, { data: $(":text", this).serializeArray(), files: $(":file", this), iframe: true, processData: false }).complete(function(data) { console.log(data); }); }); </code></pre> <p>thanks</p>
php jquery
[2, 5]
4,693,051
4,693,052
jQuery - watch for element height change
<p>I have a element, which is absolute positioned and has a fixed height.</p> <p>This element has a lot of child elements, which could change their contents, and in consequence their height. The problem is that the container element doesn't auto expand to fit its children (because of it's fixed height and absolute position).</p> <p>How can I can resize the main container to match its children height?</p>
javascript jquery
[3, 5]
57,280
57,281
Figuring out that value of input field has changed
<p>I'm using this plugin in my project :</p> <p><a href="https://github.com/bseth99/jquery-ui-extensions" rel="nofollow">https://github.com/bseth99/jquery-ui-extensions</a></p> <p><a href="https://raw.github.com/bseth99/jquery-ui-extensions/master/bseth99-jquery-ui.js" rel="nofollow">https://raw.github.com/bseth99/jquery-ui-extensions/master/bseth99-jquery-ui.js</a></p> <p>Manager choose this plugin based on some criteria. Basic idea behind this is demonstrated in the example :</p> <p><a href="http://bseth99.github.com/jquery-ui-extensions/tests/visual/slidespinner/value.html" rel="nofollow">http://bseth99.github.com/jquery-ui-extensions/tests/visual/slidespinner/value.html</a></p> <p>So user slides right left and the value changes. The issue I currently have with this plugin is that it doesn't fire any kind of change event, when I slide the slider in any direction.</p> <p>But it works properly, the value in the input changes. But if I try :</p> <pre><code>$(document).on("input", "change", function(){ alert("something"); }); </code></pre> <p>Naturally it doesn't fire. So my question is, what would be next thing to try? Can I create some kind of observer that fires when this value is changed on document ready or something else?</p>
javascript jquery
[3, 5]
736,728
736,729
How to get the index of a particular element
<p>I got the following code from the designer:</p> <pre><code>&lt;table class="items"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th id="name"&gt;name&lt;/th&gt; &lt;th id="category"&gt;category&lt;/th&gt; &lt;th id="zip"&gt;zip&lt;/th&gt; &lt;th id="city"&gt;city&lt;/th&gt; &lt;th id="street"&gt;street&lt;/th&gt; &lt;th id="latitude"&gt;latitude&lt;/th&gt; &lt;th id="longitude"&gt;longitude&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td&gt;MyCompany&lt;/td&gt; &lt;td&gt;Company&lt;/td&gt; &lt;td&gt;18360&lt;/td&gt; &lt;td&gt;Stroudsburg&lt;/td&gt; &lt;td&gt;4 Scott Str.&lt;/td&gt; &lt;td&gt;40.9891&lt;/td&gt; &lt;td&gt;-75.1962&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Using jQuery, how can I get the longitude and latitude values by taking into account the <code>th</code> elements with the specified <code>id</code>? The order of the columns might change later so direct indexing is not an option. However the <code>id</code> values will remain the same.</p>
javascript jquery
[3, 5]
3,963,223
3,963,224
How to create a dictionary can be created to exchange languages ​​and translations?
<p>I would like to make a simple dictionary application on android, I plan to make a simple dictionary like google translate, which can be used also for exchange of language in translation, so far I could make a dictionary to translate English into Indonesian, which I want to ask is how to swap the two languages ​​and then made ​​the translation as well? I am still confused how to make it, is there anything that can help me? please help me guys, give me some guidance .. I wait for the answer, thanks</p>
java android
[1, 4]
4,060,343
4,060,344
How do I copy all elements and children between two elements into a temp element?
<pre><code>context = document.createElement("span"); start_element = my_start_element; end_element = my_end_element; // some how iterate through here (assuming start and end are different elements) [start_element .. end_element].each(function(current_element){ context.append(current_element); }); </code></pre> <p>pretty straight forward, just don't know how to do the loop part with the start and end nodes. =\</p>
javascript jquery
[3, 5]
4,865,295
4,865,296
Key things to learn to be a senior developer under the MS platform
<p>I know the following:</p> <p>asp.net webforms, mvc, sql server 2005/2008, web services, and windows services.</p> <p>I want to expand so I can be a little more versatile.</p> <p>What things should I be focusing on? (this is general guidance, with a web focus)</p> <p>I am thinking:</p> <p>SSIS windows workflow sharepoint</p> <p>What other common skills should I know that seem to be go well with what I know already?</p>
c# asp.net
[0, 9]
5,485,890
5,485,891
General jquery function for form submission
<p>I have this small tabbed system developed in PHP/JavaScript.</p> <p>For form submissioni, I bind a JQuery function to the 'submit' event that sends an Ajax query to the server, avoiding to reload the page (and losing other tabs). I have coded one function for every form, but realized that they are the same (take the inputs, send the Ajax query, show the returning message) so I decided to make a general jquery function with arguments that define each form).</p> <p>I have this function:</p> <pre><code>function submit_search(entity){ $('#'+entity.name+'_searchform').submit(function(){ var url = public_path+entity.name+'/search'; var key = $('#'+entity.name+'_search_key').val(); $.ajax({ type: 'POST', url: url, data: {search_key: key}, success: entity.submit_search(result) }); return false; }); } </code></pre> <p>Where <code>entity</code> is a JS object with the name of the entity and the success function I want to execute. This function is written in a script that loads once when the main page is loaded. And when the tab is loaded, I simply call <code>submit_search()</code> with the actual entity.</p> <p>This seems logical to me. But it doesn't work. And the problem is that jquery doesn't recognize the elements, by example, after <code>var key = $('#'+entity.name+'_search_key').val();</code>, key is null.</p> <p>What am I doing wrong?</p>
javascript jquery
[3, 5]
1,608,389
1,608,390
Contact us section
<p>I am having problems with my asp.net application i can run the program with no errors when i fill in the boxes on the contact us section i then get a error saying.</p> <blockquote> <p>SMTPException was unhanded by user code</p> </blockquote> <p>Here is my code</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Net.Mail; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class contactUs : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void submitform(object sender, EventArgs e) { MailMessage email = new MailMessage() { Subject = "Email From CraigavonAquatics Contact Us Section", Body = commentBox.Text, IsBodyHtml = false, From = new MailAddress(emailBox.Text, nameBox.Text) }; email.To.Add(new MailAddress("[email protected]", "Philip Harrison")); SmtpClient server = new SmtpClient(); server.Send(email); msgSuccess.Visible = true; } </code></pre>
c# asp.net
[0, 9]
2,734,097
2,734,098
Using User Control in Master Page - Need Focus
<p>This is the scenario:</p> <p>I have a Master Page, In the Master Page I have a user control In the User Control there is a code that looks like this</p> <pre><code>&lt;div&gt; &lt;a id="p1" runat="server"&gt; &lt;asp:Image ID="Img" runat="server" ImageAlign="AbsMiddle" Style="position:relative; bottom: 0px;" /&gt;&lt;/a&gt; -&lt;a id="p2" runat="server"&gt; &lt;asp:Label ID="lblRate" runat="server"&gt;&lt;/asp:Label&gt; Rates&lt;/a&gt; &lt;/div&gt; </code></pre> <p>Now, when the user clicks on "Rates" it should focus on an item that is another User Control back in the Master Page.</p> <p>How can I do this?, this is existing code and can not modify the current structure but <strong>what is currently happening is that when "Rates" is clicked</strong> it postsback with a parameter <strong>goto=rates</strong> but doesnt do anything.. I need to make so that when it is clicked it focuses on another UserControl in the Master Page. (but this "Rates" link is User Control too)</p> <p>I tried in my Master Page the following</p> <pre><code>if(!Page.Postback) { if(Request.Params["goto"] == "rates"){ uControl.Focus(); } } </code></pre> <p>No luck, please help :(</p> <p>So to recap:</p> <p>MasterPage has UserControl -> UserControl has a link that postsback with parameter goto=rates -> back in the MasterPage I need to focus the screen on another UserControl.</p> <p>I tried to be as clear as I could</p> <p>Thank you</p>
c# asp.net
[0, 9]
958,170
958,171
How can we return the css attributes of an element with jQuery?
<p>One of the most powerful things of jQuery is to select any item on a page like this:</p> <pre><code>$(".block").css("border","3px solid red"); </code></pre> <p>How can I also get the values of the selected items like width height and top left offset?</p>
javascript jquery
[3, 5]
3,777,131
3,777,132
Loading a JSON file with jQuery.getJSON
<p>I am a newbie in JS and I am trying to do something very simple.</p> <p>I have a JSON file named "data.json" and I want to load it, so, I do this:</p> <pre><code>$.getJSON("data.json",function(data){ console.log(data); }); </code></pre> <p>And then I pass that loaded JSON to a function in library that does this:</p> <pre><code>$("#example1").handsontable({ data:data, //&lt;--- error here minRows: 2, minCols: 3, minSpareRows: 1, currentRowClassName: 'currentRow', currentColClassName: 'currentCol', autoWrapRow: true, colHeaders: true }); $("#example1").handsontable('selectCell', 3, 3); </code></pre> <p>Firebug says </p> <pre><code>ReferenceError: data is not defined [Break On This Error] data:data, </code></pre> <p>I thought I already loaded the JSON into the <code>data</code> variable? Any suggestions?</p>
javascript jquery
[3, 5]
73,282
73,283
Finding a visible div that is not hidden Jquery/Javascript
<p>Ok so i have two div's which are hidden using jquery's <code>.hide();</code> onload</p> <p>I have two function to <code>.show();</code> them</p> <pre><code>function showIncorrectChar() { $("#csq-incorrect-characters").show(); } function showMinChar() { $("#csq-min-characters").show(); } </code></pre> <p>Using Jquery/Javascript i need to find whether one of those div's are visible if they are i want it to do nothing if they aren't i need to call it</p> <pre><code>hideResultsTableContainer(); showResultsTree(); </code></pre>
javascript jquery
[3, 5]
5,548,121
5,548,122
Open login page , insert logon information and click loginbutton
<p>I want to open a logon page like www.site.com/login.php</p> <p>insert username and password </p> <p>and login button be invoke .</p> <p>All of this should be done progroamlly in a server (not in a browser )</p> <p>is it possible to do thsi ?</p>
c# asp.net
[0, 9]
4,938,293
4,938,294
Iterate through databound listbox
<p>My listbox is getting its items from a sql database and I'm trying to loop through it and perform an action based on a certain condition. I've done this before but not when it was attached to a db. This is the code I'm using (that doesnt work):</p> <pre><code>foreach (object o in arrList) { foreach (ListItem i in lstInstructors.Items) { if (i.Text == o.ToString()) i.Selected = true; } } </code></pre> <p>While I'm debugging im getting null as <code>ListItem i</code>, and I'm guessing thats because there's no static items added, so what would be the right call to get the databound items instead of using <code>lstInstructors.Items</code>?</p>
c# asp.net
[0, 9]
3,083,473
3,083,474
FindControl inside Repeater
<p>I am trying to find a Label inside a Repeater, I am using:</p> <pre><code> protected void lnkbtnEditRecord_Click(object sender, EventArgs e) { salesEditPanel.Visible = true; resultPanel.Visible = false; zipPanel.Visible = false; ddlPanel.Visible = false; topPanel.Visible = false; Label lblSalesId = (Label)(Repeater2.Items[0].FindControl("lblSalesID")); DataView dv = FillSalesPersonForm(Convert.ToInt32(lblSalesId.Text)); frmViewSalesPeople.DataSource = dv; frmViewSalesPeople.DataBind(); } </code></pre> <p>This works great if the repeater only has one result, but if it has more then one it only gets the id for the first item listed. Any ideas on how to fix this?</p> <p>EDIT: Basically the return is filled with user info and with each user info is a link to another page. So when I click the link I want to get the ID from the label for the record the link was clicked for. So If I click record 4 out of 5 I want and the ID for record 4 is 900 I want to get the 900 to pass.</p> <p>Thanks!</p>
c# asp.net
[0, 9]
5,362,169
5,362,170
Show thumbnails and select the cover photo
<p>We need to display all the thumbnails in one folder (e.g. c:/photos/101/tn/ folder) and then select one image as cover photo. Once the editor clicks on the "Set Cover Image" button, grab the select photo ID. Once the id is grabbed, I will store the info in the database.</p>
c# asp.net
[0, 9]
2,797,625
2,797,626
ASP.Net: Programatic runat="server" and onclick
<p>I am trying to edit a control which doesn't have an .ascx page, it was done completely in code. I am trying to add an optional delegate to be called from an ImageButton which was previously completely handled at the client. So I would like to set runat="server". However, I don't see this property exposed programatically on the object!</p>
c# asp.net
[0, 9]
3,459,780
3,459,781
Javascript repeat/loop help needed
<p>I have the following javascript</p> <pre><code>$('.goto1').click(function() { $('#mttslider').cycle(0); return false; }); </code></pre> <p>What I would like is for it to repeat like so:</p> <pre><code>$('.goto1').click(function() { $('#mttslider').cycle(0); return false; }); $('.goto2').click(function() { $('#mttslider').cycle(1); return false; }); $('.goto3').click(function() { $('#mttslider').cycle(2); return false; }); etc... </code></pre> <p>This is so that I can get every trigger - .goto(n) - to trigger the cycle function. </p> <p>Any help would be much appreciated!</p>
javascript jquery
[3, 5]
2,195,549
2,195,550
Javascript function can write to console but not returning value
<p>I have a function in javascript which can write the output to the console but it is unable to return the value.. </p> <pre><code>fetchData: function(dateToFetch){ if (mP.viewMode == 1){ $.each(mealData.DailymPs, function(k, item){ if( item.Date == formatDate(mP.chosenDate) ){ mP.DayPlan.mPDayData = item; return mP.populateMealDayPlan(); } }) } else if (mP.viewMode == 2){ // debugger; $.each(mealData.DailymPs, function(k, item){ if( item.Date == (dateToFetch) ){ mP.DayPlan.mPDayData = item; console.log(mP.populateMealDayPlan()); var returnObj = mP.populateMealDayPlan(); return returnObj; } }) } } </code></pre>
javascript jquery
[3, 5]
2,462,382
2,462,383
manipulating jquery options on-the-fly
<p>i use a jquery plugin and want the user to be able to manipulate an option (LENGTH parameter) him/her-self. </p> <pre><code>$(document).ready(function() { $('#green').smartpaginator({ totalrecords: &lt;? echo $count;?&gt;, length: 3, recordsperpage: 3, datacontainer: 'theTable', dataelement: 'tr', initval: 0, next: 'Next', prev: 'Prev', first: 'First', last: 'Last', theme: 'green' }); }); </code></pre> <p>i want the LENGTH parameter to be changed. The code for the select box with onchange event is not the matter of interest. the question is how to make the change, also dom-wise, at the jquery options. </p> <p>Since i've never manipulated javascript code i have no idea how to select the options with dom or most efficiently.</p>
javascript jquery
[3, 5]
2,413,753
2,413,754
Set default value for jQuery slider and override when needed
<p><strong>Background:</strong> I currently have a <strong>working</strong> jQuery slider on my website inside my .js file</p> <pre><code>$( "#slider-range-min" ).slider({ range: "min", value: 100, min: 1, max: 100, }); </code></pre> <p>I need to be able to override the "Value" from 100 to some other value sometimes. So I tried this:</p> <pre><code>$( "#slider-range-min" ).slider({ range: "min", value: _Slider_Value, min: 1, max: 100, }); </code></pre> <p>and defined this on my html page</p> <pre><code>&lt;script type="text/javascript"&gt; var _Slider_Value = 50; &lt;/script&gt; </code></pre> <p>which also works! <strong>Except</strong> then on all the other pages I get a javascript error stating "_Slider_Value is not defined". I'd rather not have to copy &amp; paste the value onto all my pages if I can avoid it... doesnt seem like a "good" way to do it?</p> <p><strong>Question:</strong> is there a better way to do this - so I can have a default value for my slider, but occasionally override it when required?</p> <p><strong>Edit:</strong> Another way of saying it: how do I make my slider default to "100" unless I tell it otherwise in my html page?</p>
javascript jquery
[3, 5]
614,775
614,776
How to use string as a object method?
<p>I am trying to use an element class name and call it as a method for my object.</p> <pre><code> var thisClass=$this.attr('class') //thisClass = 'call' obj.thisClass(ID); </code></pre> <p>My codes don't work as I wanted to be. Are there anyways to solve this? Thanks a lot!</p>
javascript jquery
[3, 5]
3,943,779
3,943,780
I retrieved a date from my database using jQuery. The retrieved value is "2012-01-10 00:00:00" (quotes included)
<p>I was unable to perform date comparison operations because it was being retrieved as a string. How can I do that. I tried using below syntax, but it didn't work. </p> <pre><code>DateUtils.convertFormat(emp_date_start,"MM/dd/yyyy","yyyy-MM-dd"); </code></pre>
javascript jquery
[3, 5]
328,073
328,074
jQuery MouseEnter Error
<p>As I am writing an plugin for websites which uses jQuery I am wondering, why some of the sites which are using the script get the error:</p> <pre><code>Uncaught TypeError: Object #&lt;Object&gt; has no method 'mouseenter' </code></pre> <p>The code:</p> <pre><code>plugin.setBehavior = function() { jQuery('#divname').mouseenter(function() { show(); }); } </code></pre> <p>Are there any versions of jQuery without the mouseenter event or what could be the reason for the failure?</p> <p>Thx</p>
javascript jquery
[3, 5]
2,445,511
2,445,512
Javascript error ( missing } )
<p>Just checking my JS and I have an error, but I cannot see where. WOnder if you can ?</p> <pre><code>$(document).ready(function(){ $('input').hover(function() { $(this).popover('show') }); $("#loginnow").validate({ rules:{ username:{ required:true, minlength: 3 }, password:{ required:true, minlength: 6 }, messages:{ username:{ required:"Enter your Username", minlength:"Username must be minimum 3 characters" }, password:{ required:"Enter your password", minlength:"Password must be minimum 6 characters" }, }, errorClass: "help-inline", errorElement: "span", highlight:function(element, errorClass, validClass) { $(element).parents('.control-group').addClass('error'); }, unhighlight: function(element, errorClass, validClass) { $(element).parents('.control-group').removeClass('error'); $(element).parents('.control-group').addClass('success'); } }); }); </code></pre>
javascript jquery
[3, 5]
5,747,435
5,747,436
Copy-Paste from MS Excel fails with IE but works with Firefox
<p>I built a very simple app using a PHP form with a bit of Javascript.</p> <p>In my form, I have a text input which I used to run a database search. In case I have multiple values, I have a bit of code that puts a comma in between each.</p> <p>The weird part is this:</p> <p>In Firefox, I can go do MS Excel, copy 5 values and paste them in the text input control. I can see all 5 values pasted and commas in between.</p> <p>In Internet Explorer version 8, I can go do MS Excel, copy 5 values but only ONE value (the first number) gets pasted in the text input control.</p> <p>This is my html </p> <pre><code>&lt;fieldset&gt; &lt;label for="DBRIDs"&gt;RIDs&lt;/label&gt;&lt;input type="text" id="DBRIDs" name="DBRIDs" onchange = "removespaces(this)"&gt; &lt;/fieldset&gt; </code></pre> <p>This is my Javascript in my page header</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; function removespaces(which) { str = which.value; str = str.replace (/\s|\n/g,","); // replace space or newline by commas document.myform.DBRIDs.value = str; } </code></pre> <p>Pretty basic stuff. What am I missing? How come IE cannot paste like Firefox??</p> <p><strong>EDIT</strong></p> <p>I had a typo so using textarea is working now. I can copy a column and paste it from IE</p> <p>Of course (sarcasm), it is introducing a new problem: It duplicates my commas and I am unclear it's because of textarea or my Javascript.</p>
php javascript
[2, 3]
3,490,290
3,490,291
FadeIn and FadeOut effect weird
<p>I am using JQuery and what I want to happen is: div fades out using <code>fadeOut()</code>. It then loads content from a url using the <code>load()</code>. Then once content loaded it fades back in using <code>fadeIn()</code>. However it does not work,it flashes then loads out then loads in. I think the problem is that the fading is happening before the load is complete.I saw that someone else had the same problem but when i applied their solution there was no change.Here is the code with the solution i found (not working of course). </p> <pre><code>jQuery('.stil_link_img a').click(function() { var x = jQuery(this).attr('href') + ' #continut_eco'; jQuery('#continutul_paginii').fadeOut("slow").load(x,function() { jQuery(this).fadeIn("slow") }); return false }); </code></pre>
javascript jquery
[3, 5]
4,414,393
4,414,394
Handler to grab variable values from another function
<p>This is what I have so far </p> <pre><code>//file uploader /////////////////////////// function uploader(){ var file = $(this).val() var error = $(this).next('.req-error') var fileLimit = $(this).attr('maxlength')-1 var uploadedFiles = $(this).siblings('.uploaded-file').length //make uploaded file label if(error.length ==1){ $(this).next().after('&lt;div class="uploaded-file"&gt;&lt;span&gt;X&lt;/span&gt;'+file+'&lt;/div&gt;') }else { $(this).after('&lt;div class="uploaded-file"&gt;&lt;span&gt;X&lt;/span&gt;'+file+'&lt;/div&gt;') } //count uploaded files if(uploadedFiles &gt;= fileLimit ){ $(this).attr('disabled', true) }else{ $(this).removeAttr('disabled') } //clear input field $(this).val('') }; $(".input-file").change(uploader) function removeFile(uploader){ $(this).remove() } $('.uploaded-file').live('click',removeFile) </code></pre> <p>I made a limit for how many files can be uploaded. Once the limit is reached, the input gets disable but, when a file is removed I want it to enable again if its under the limit. Im just not sure how to get the removeFile function to read the if statement from the uploader function.</p>
javascript jquery
[3, 5]
1,807,886
1,807,887
Error retrieving information from user cookie
<p>When I run the project, I get this line highlighted with an error:</p> <pre><code>string cartID = context.Request.Cookies["Cinemax_CartID"].Value; </code></pre> <p>The message is as follows:</p> <pre><code>Object reference not set to an instance of an object. </code></pre> <p>Thanks for any suggestions! </p>
c# asp.net
[0, 9]
3,366,481
3,366,482
how do I convert special characters for storage in database
<p>I have a textarea, and sometimes people use special characters like</p> <pre><code>à </code></pre> <p>These are stored in a database, but wrong, the value in the database is this:</p> <pre><code>Ã </code></pre> <p>or something like that. What do I have to do to preserve the character?</p>
php jquery
[2, 5]
2,237,167
2,237,168
VariableDeclaratorId and misplace
<p>I'm new to JAva and Android, and I'm working on my first test app.</p> <p>I have this code (This is the whole code):</p> <pre><code>package test.test; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.TextView; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } int num_seeds = 15 ; int num_coins = 100 ; int seed_buy_price = 10 ; int seed_sell_price = 8 ; String S_num_seeds = Integer.toString(num_seeds) ; TextView textView_seeds_current_display = (TextView) findViewById(R.id.textView_seeds_current_display) ; textView_seeds_current_display.setText(S_num_seeds) ; } </code></pre> <p>But Eclipse shows me an error on last line: Multiple markers at this line - Syntax error on token "S_num_seeds", VariableDeclaratorId expected after this token - Syntax error on token(s), misplaced construct(s)</p> <p>I'm new to Java and I still can not understand this quite well. Could somebody please point me what am I doing wrong? I think I'm following the advice from here:</p> <p><a href="http://stackoverflow.com/questions/5821051/how-to-display-the-value-of-a-variable-on-the-screen">How to display the value of a variable on the screen</a></p> <p>Thanks</p>
java android
[1, 4]
5,598,234
5,598,235
Jquery: clearInterval inside ajax response after removing target element
<p>I'm facing a problem in using ajax requests in <a href="http://dillon-sellars.github.com/BeautyTips/" rel="nofollow">jquery bt tooltip plugin</a> , this is the function which i use:</p> <pre><code>$('.button-class').bt({ ajaxPath: 'get_data.php', ajaxCache: false, fill: '#fff', width: 320, positions: ['right', 'top'] }); </code></pre> <p>The ajax response text contain javascripts code and "setInterval()" function , the problem after mouse out of $('#button-id'), the tooltip removed but the "setInterval()" function still working !.</p> <p>This cause problem when mouseover again at the same element or other element have the same class because the interval doesn't start from the predefined value but it work randomly and not the same interval !</p> <p>I mean the sequence changes and also the time delays changes !</p> <p>Also i can't use "clearInterval" as the setInterval() function inside the ajax response text and i don't know what's the action to put inside this response when the tooltip div ('#bt-warrper') removed to clearInterval().</p>
javascript jquery
[3, 5]
3,299,039
3,299,040
How to show a list below an input test?
<p>How could I show a list (like Google does with keywords) below an input text?</p> <p>Thanks</p>
javascript jquery
[3, 5]
727,759
727,760
jQuery .change() only fires once
<p>I have a DropDownList called "ddlCaseFiles". I then have a script which I import that contains the jQuery .change() function to capture the event. Then I have 3 radio buttons which sorts the dropDownList. When the default radio button is loaded, then the event fires. But as soon as I select another radio button, then the event doesn't fire anymore.</p> <p>Here is my DropDownList:</p> <pre><code>&lt;asp:DropDownList runat="server" ID="ddlCaseFiles" DataSourceID="dsMyCaseFiles" DataTextField="Display" DataValueField="FileID" OnPreRender="ddl_PreRender" /&gt; </code></pre> <p>and here is my jQuery .change():</p> <pre><code> $('#ddlCaseFiles').change(function () { debugger; $('#lblNextExhibitNumber').text(''); var temp = $(this).val(); }); </code></pre> <p>Here is a snipper of what the radio buttons do:</p> <pre><code> protected void rbByFileName_CheckedChanged(object sender, EventArgs e) { ddlCaseFiles.DataSourceID = "dsCaseFilesReverse"; ddlCaseFiles.DataTextField = "Display"; ddlCaseFiles.DataValueField = "FileID"; } protected void rbByFileID_CheckedChanged(object sender, EventArgs e) { ddlCaseFiles.DataSourceID = "dsCaseFiles"; ddlCaseFiles.DataTextField = "Display"; ddlCaseFiles.DataValueField = "FileID"; } </code></pre> <p>I have never used the .change() before. So maybe I am missing something</p>
javascript jquery asp.net
[3, 5, 9]
3,571,252
3,571,253
How to manage generated files, how long to keep them using asp.net
<p>I have a web application that generates excel files from a template.</p> <p>When the new file is streamed to the client I deleted the file. This works fine in my computer, but for whatever reason, when accesing the website from another computer, the file is deleted before streamed to the client, so the file is always empty (0 bytes) Here is the code:</p> <pre><code>try { Response.Clear(); Response.ClearHeaders(); Response.ContentType = "application/ms-excel"; Response.AddHeader("content-disposition", "attachment;filename=" + newFN + ".xlsx"); Response.TransmitFile(DestFile); Response.Flush(); Response.End(); } finally { File.Delete(DestFile); } </code></pre> <p>Why this works fine from my computer, and it doesn't from another computer?</p> <p>What can I do to delete generated files and when? I'm thinking in having like a schedule task, to check by date, all files before specific date, and delete them, but is there any other solution?</p>
c# asp.net
[0, 9]
1,711,248
1,711,249
find length of visable/hidden list items faster
<p>I am a jquery newbie and have been adding alert timestamps into my html file to find what lines of code are making things slow. I have found the main bottleneck and am looking for help to know how to change these 2 lines to be faster.</p> <p>My html file has about 600 list items in it. If the file only had 6 list items, the speed would be fine. </p> <pre><code> var visablecount = 0; var totalcount = 0; for (var key in checkArray) { if (checkArray.hasOwnProperty(key)) { $tmp = key.split(" "); $.each($tmp, function(i, val4) { //*********next two lines are the most slow lines********* visablecount = $itemsToFilter.children("li."+val4+":visible").length; totalcount = $itemsToFilter.children("li."+val4+":hidden").length + visablecount; //******************************************************** $("#labelID"+val4).text(val4 +" (" + visablecount + "/" + totalcount + ")"); if ($this.is(":checked")) { if ($('.' + val4 + '').is(":visible") == true) { $('.filters input[value=' + val4 + ']').attr('checked', true); } } }); } } </code></pre>
javascript jquery
[3, 5]
3,840,893
3,840,894
Animating list item with more efficiency
<p>I want to bump up a li on hover and let it get to original state when the mouse leaves. This works but does the hover animat(up) another time when the mouse is leaving which gives me a delay and inefficient code. Do you guys have some suggestions for me to make this more efficient?</p> <pre><code>function HoverListItem() { var menuItem = $('#menu &gt; li') menuItem.on('hover', function(){ console.log('up'); $(this).animate({ 'marginTop': '-10px' }, 150); }); menuItem.on('mouseleave', function(){ console.log('down'); $(this).animate({ 'marginTop': '0px' }, 150); }) }; </code></pre>
javascript jquery
[3, 5]
640,659
640,660
Access to HTML tags
<p>How can I get access to every HTML tag one after another like collections' syntaxes(from JS)? Is it possible?</p>
javascript jquery
[3, 5]
4,415,871
4,415,872
Replacement of the complex character string
<p>The string is "hi\how \ r\ u\" and need to replace "\" with the space.</p> <p>String stringToModify = "hi\how \ r\ u\";</p> <p>stringToModify = stringToModify .replace("\\", "");</p> <p>System.out.println(stringToModify ); </p>
java android
[1, 4]
1,444,140
1,444,141
How to call a javascript function directly from an activity in Android?
<p>I wanted to know if there is any way that I can call a JavaScript function from native Android Activity. </p> <p>I came across: </p> <pre><code>webView.loadUrl("javascript:hello()"); </code></pre> <p>But it did not work for me. </p> <p>Also, how will Android know in which html page does this JavaScript function reside? </p>
javascript android
[3, 4]
4,218,428
4,218,429
Sum the contents of divs when their corresponding checkbox is clicked
<p>I have the following code in a loop reading the contents of a folder:</p> <pre><code>&lt;div class="oddrow"&gt; &lt;span class="title"&gt;1 - 1215 - Magna Carta&lt;/span&gt;&lt;br/&gt; &lt;span class="size"&gt;size: 229.1 MB&lt;/span&gt; &lt;input name="1215 - Magna Carta" type="checkbox"&gt; &lt;div&gt; </code></pre> <p>When the checkbox gets checked I want to have the sizes of each record added up in a separate div:</p> <pre><code>&lt;div id="total&gt;total = &lt;/div&gt; </code></pre> <p>How can I do this?</p>
javascript jquery
[3, 5]
4,591,348
4,591,349
How might you grab information from a page that only populates AFTER that page executes javascript? (C#)
<p>Hey there. I have a CE program which needs to get information from a website. I can't simply grab the source code, because the information is only displayed after the page's javascript is executed. Is there a way to view a page's information/source/links after javascript has fully load the information? Thanks! :)</p>
c# javascript
[0, 3]
588,736
588,737
Equivalent of PHP's 'array_splice' in java
<p>How can I implement <code>array_splice()</code> in java</p> <pre><code>$input = array("red", "green", "blue", "yellow"); array_splice($input, 2); // $input is now array("red", "green") </code></pre> <p><a href="http://php.net/array_splice" rel="nofollow">http://php.net/array_splice</a></p>
java php
[1, 2]
2,871,665
2,871,666
problem with jquery's "live" function
<h2>the problem</h2> <p>this works fine:</p> <pre><code>$('#edit_curriculum .generated').children().blur(function(){ console.log(this); }); </code></pre> <p>but this doesn't:</p> <pre><code>$('#edit_curriculum .generated').children().live('blur', function(){ console.log(this); }); </code></pre> <p><strong>obs:</strong> the functions are wrapped in a <code>$(document).ready</code> event.</p> <hr> <h2>the outputs</h2> <p>working:</p> <pre><code>&lt;input type=​"text" name=​"phones[]​" class=​"medium phone valid"&gt; </code></pre> <p>not working:</p> <pre><code>Uncaught Syntax error, unrecognized expression: ) k.errorjquery.js:17 k.filterjquery.js:17 kjquery.js:17 c.querySelectorAll.kjquery.js:17 k.matchesSelectorjquery.js:17 f.extend.filterjquery.js:17 f.fn.extend.isjquery.js:17 f.fn.extend.closestjquery.js:17 Njquery.js:16 f.event.handlejquery.js:17 f.event.add.k.i.handle.kjquery.js:16 f.event.triggerjquery.js:17 ejquery.js:17 </code></pre>
javascript jquery
[3, 5]
1,751,923
1,751,924
DataGrid Row checkbox filed Not updated in asp.net
<p>hi i m having one datagrid...that have one check box field...whenever i check the check box that time that row will be inserted in database...but check box value is not set true value...it always return false value...i m using C# asp.net 2003 version..please help me...</p>
c# asp.net
[0, 9]
4,481,012
4,481,013
About binding record to gridview from 2 tables in asp.net c#
<p>I have one gridview. I have one table(source) that contains fields like sourceid, name and another table(target) that contains fields like targetid, from, to,date. In that target table from &amp; to fields are ids refer to source table's sourceid's. So i have to bind record of target table i.e to bind fields : from - here name should come respect to that source id from source table to - here name should come respect to that source id from source table date should come from target table.</p> <p>How i can do this? Asp.net c#</p> <p>Thank you.</p>
c# asp.net
[0, 9]
5,001,600
5,001,601
jquery click question
<p>i have an issue.</p> <p>the code is this:</p> <pre><code>$("#button").click(function(event){ $("#threads").html("hi"); }); </code></pre> <p>when i click the button, the text "hi" is just shown in 1 sec. then it disappear. i want it to always be shown after i have clicked. how can i do this?</p>
javascript jquery
[3, 5]
3,721,910
3,721,911
Load new page on postback
<p>I have a master page that has a usercontrol on the left side of the page with a dropdown. When the user selects a value from the dropdown I need to load a different aspx page. The new page has a similar (but not the same) looking usercontrol on the left and different content on the right. How can I do this? Also, when the new page is loaded the dropdown must remember its selection. </p>
c# asp.net
[0, 9]
5,831,867
5,831,868
Autoscrolling a DIV element
<p>I have an auto overflowed DIV on my page, what i want to do is to make it start scrolling slowly towards the end of items of the DIV on page onload. </p> <p>is that easy u think ?</p>
javascript jquery
[3, 5]
834,298
834,299
.NET website lightweight framework
<p>I'm looking for lightweight framework to build my custom website. Originally I'd love to get a platform that implements user registration, login, logout and probably account management at some point. The thing is I don't want to have any "extras" there and I don't want to develop sign-up/login part again...</p> <p>What options do I have? I was looking at mojoPortal, but there's a lot of restrictions and features I'll never use. </p> <p>Any suggestions?</p> <p>PS. .net 2.0/3.5</p>
c# asp.net
[0, 9]
3,082,617
3,082,618
"Magic" constants in C# like PHP has?
<p>I am building a logging control for a C# project and would like to be able to call it with the name of the current source code File, Line, Class, Function, etc. PHP uses "magic constants" that have all of this info: <a href="http://php.net/manual/en/language.constants.predefined.php" rel="nofollow">http://php.net/manual/en/language.constants.predefined.php</a> but I don't see anything like that in the C# compiler language. </p> <p>Am I looking for something that doesn't exist? </p>
c# php
[0, 2]
3,313,722
3,313,723
Can I reduce this jquery script down to one line?
<p>I have written this code</p> <pre><code>if (forw == true) { if ($('.tickertape li.active')[0] != $('.tickertape li').last()[0]) { $('.tickertape li.active').removeClass('active').next().addClass('active'); } else { $('.tickertape li.active').removeClass('active'); $('.tickertape li').first().addClass('active'); } } else { if ($('.tickertape li.active')[0] != $('.tickertape li').first()[0]) { $('.tickertape li.active').removeClass('active').prev().addClass('active'); } else { $('.tickertape li.active').removeClass('active'); $('.tickertape li').last().addClass('active'); } } </code></pre> <p>Which works but really feels like it should only be on one line. This there a way to do this?</p>
javascript jquery
[3, 5]
5,816,187
5,816,188
Javascript events
<p>I am completely confused here. So I am looking for a solution for the following problem:</p> <p>I want to trigger some function(for now an alert box) using jQuery on an input field. Conditions are:</p> <ul> <li>Input field always maintains the focus.</li> <li>Input is fed from a USB device, which acts just like a keyboard input. So for 10 characters, there will be 10 keydown and keyup events.</li> <li>Once input is filled with 10 characters, respective alert box should pop out.</li> </ul> <p>Now the problem I am facing, how do I find out that input fed in is not equal to 10 characters, so throw an error alert box.(lets say just 5 chars came in input, how do I figure out the final count is 5, because there will be 5 keyup events)</p>
javascript jquery
[3, 5]
2,506,307
2,506,308
Creating a widget
<p>Hi i want to create a widget which can be embedded on other websites similar to the twitter profile widget, an example is here;</p> <p><a href="http://twitter.com/about/resources/widgets/widget_profile" rel="nofollow">http://twitter.com/about/resources/widgets/widget_profile</a></p> <p>The way i would approach this is to return the data in json format via my wcf, the problem is looking at the twitter example there seems to be some javascript and i am not to clued up on the purpose. My question to the more experienced devlopers is am i on the right track and what else will i need to do. Thanks alot</p>
c# jquery asp.net
[0, 5, 9]
4,355,985
4,355,986
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]
3,972,283
3,972,284
Hacking Some js
<p>So, I'm using Jilion's Sublime's <a href="http://sublimevideo.net/" rel="nofollow">HTML5 Video Player</a> on my site. And was wondering if there was a way to use some jQuery to animate my video player when certain events are triggered via the player?</p> <p>For example when the play button is hit, the video player would shift into the center of the screen.</p> <p>I had a dig around in the js for the player and it seems to be using things like "play", "pause", "finish" and "end" to trigger what the player does. What I was wondering is if I could that same technique as some jQuery that would say do this when "play" is hit: </p> <pre><code>$('#video').animate({left: '350'}, "fast"); </code></pre> <p>I understand this is sort of a hack job, could anyone point me in the direction of how I'd go about doing something like this.</p> <p>Here's an example of the play function:</p> <pre><code>o.play=function(a){if(a||this.ga==Dc)this.Z=0,this.coords=this.ec;else if(this.Ga())return l;Ic(this);this.startTime=a=oa();-1==this.ga&amp;&amp;(this.startTime- =this.duration*this.Z);this.ue=this.startTime+this.duration;this.rd=this.startTime; this.Z||this.vd();this.la("play");-1==this.ga&amp;&amp;this.la("resume");this.ga=1; var b=ia(this);b in Gc||(Gc[b]=this);Jc();Lc(this,a);return j}; </code></pre> <p>Thanks in advance.</p> <p>UPDATE: Ok, so this is what I've got at the moment, which seems to work.</p> <pre><code>var v = document.getElementsByTagName("video")[0]; v.addEventListener("playing", function() { $('#video').animate({left: '-90'}, "fast"); },function(){ $('#video').animate({left: '-346'}, "fast"); }); </code></pre>
javascript jquery
[3, 5]
123,346
123,347
Problem with adding and removing classes with jQuery when hovering over a list item
<p>I want to add a class to a list item when I hover over it, and then remove it and add it to a different list item if a different list item is hovered over.</p> <p>Here's what I tried:</p> <p>jQuery - </p> <pre><code>$(document).ready(function() { $("#results").text("Tournaments"); $("#Tournaments").addClass("box-active"); $("#box ul li").hover(function() { var show = $(this).attr('id'); $("#results").text(show); $("#box ul li").each(function() { $(this).removeClass("box-active"); }); $("#box ul li#" + show).addClass("box-active"); }); }); </code></pre> <p>HTML - </p> <pre><code> &lt;div id="box"&gt; &lt;ul&gt; &lt;li id="Tournaments"&gt;Tournaments&lt;/li&gt; &lt;li id="Join"&gt;Join&lt;/li&gt; &lt;li id="Forums"&gt;Forums&lt;/li&gt; &lt;li id="GameBattles"&gt;GameBattles&lt;/li&gt; &lt;li id="Practice"&gt;Practice&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;Hovering over: &lt;span id="results"&gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>When I hover over an item, it changes the class, but if I hover over I different one it removes the class over the item I first hovered over, but doesn't add the class to the new item I'm hovering over. Not sure why, and any help would be appreciated.</p>
javascript jquery
[3, 5]
3,184,528
3,184,529
How to popup a Alert on Button Click from code behind in Asp.net 2.0?
<p>I tried this code but is not working ..</p> <pre><code>protected void btnAbc_Click(object sender, EventArgs e) { string script = "&amp;lt;script language='javascript'&amp;gt;alert('abc');&amp;lt;/script&amp;gt;";" ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script,true); } </code></pre> <p>Pls advice.</p>
c# asp.net
[0, 9]
362,135
362,136
JS & PHP - Change dropdown value if other fields are filled
<p>I have a PHP application form for medical health plans where the user fills in his details and selects some options from various controls, one of which is the plan type (private of family plan). Sometimes, although the user fills in his siblings/spouse details, they forget to also select the 'family' option and leave the drop down at it's default value which is the 'private' plan. </p> <p>How can I make sure that if the user fills in his sibling's details, that the 'plan' dropdown will change to the proper option? I know this can be done easily with js but I'm not sure what event I should call it on, <code>onFocus</code> and <code>onClick</code> won't work because the user might simply click on the <code>Sibling Name</code> field but not enter a value, fill in something but later on clear it out etc.</p> <p>I think that a script that counts the length of the 4 available siblings fields and if one of them is not empty, then change the 'plan' select value from 'private' to 'family'.</p> <p>Any ideas would be great, thanks.</p>
php javascript
[2, 3]
5,011,774
5,011,775
Use jquery to generate an arbitrarily deep list
<p>In javascript, I have an array of objects that represents an arbitrarily deep list...</p> <pre><code>data = [ { title, depth }, { title, depth }, { title, depth }, { title, depth }, ] </code></pre> <p>...where depth is how deep in the list the element is.</p> <p>I want to convert this data into html.</p> <p>For example: </p> <pre><code>[ { title: "one", depth : 1 }, { title: "two", depth : 1 }, { title: "three", depth : 2 }, { title: "four", depth : 3 }, { title: "five", depth : 1 }, ] </code></pre> <p>becomes...</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;p&gt;one&lt;/p&gt;&lt;/li&gt; &lt;li&gt; &lt;p&gt;two&lt;/p&gt; &lt;ul&gt; &lt;li&gt; &lt;p&gt;three&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;p&gt;four&lt;/p&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;p&gt;five&lt;/p&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>What is the simplest way to do this, using jQuery?</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,938,424
3,938,425
Set a js variable in a html include
<p>I have a ASP.NET page that uses the include method for header. I am adding a JS variable that I access from JS functions</p> <p>In <code>head.htm</code></p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; var render=&lt;%= RenderProperty %&gt;; &lt;/script&gt; </code></pre> <p>The <code>RenderProperty</code> is a method in the base page class (a .cs file that inherits from <code>System.Web.UI.Page</code>)</p> <p>It looks something like this:</p> <pre><code>private bool _renderProp = false; public bool RenderProperty { get { return _renderProp; } set { _renderProp = value; } } </code></pre> <p>On a page by page basis, I set the <code>RenderProperty</code> in the <code>Page_Load</code> of a aspx page</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { RenderProperty = true; } </code></pre> <p>I get a compile time error that says:</p> <pre><code>The name 'RenderProperty' does not exist in the current context C:\...\head.htm </code></pre>
c# asp.net javascript
[0, 9, 3]
5,859,188
5,859,189
Android must have Expandableview whose id is
<blockquote> <p>Your content must have a ExpandableView whose id is attribute is 'android.R.list'</p> </blockquote> <p>This is the error message I am getting from Logcat. Which is confusing me as my XML is this</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;ExpandableListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="fill_parent"/&gt; &lt;/LinearLayout&gt; </code></pre>
java android
[1, 4]
94,607
94,608
How to stop control creation inside a repeater based on a condtition?
<p>Here is the control i want to be created only if the condition is true. How do I do that using say the "Visible" attribute or something easy like that?</p> <pre><code> &lt;p&gt;&lt;%# (GetAnswer(Eval("AnsQID"))) != 1 ? (Eval("AText")) : ""%&gt;&lt;/p&gt; </code></pre>
c# asp.net
[0, 9]
4,522,242
4,522,243
using multiple id in jquery
<p>I made little jquery script for checking if input box value bigger than 5 .but I have 2 tag with an id and only one of them works.</p> <pre><code>&lt;div id="register"&gt; &lt;form id="register"&gt; &lt;input id="first" type="text" /&gt; &lt;a id="first" &gt;&lt;/a&gt; &lt;br /&gt; &lt;input id="second" type="text" /&gt; &lt;a id="second" &gt;&lt;/a&gt; &lt;/form&gt; </code></pre> <p></p> <pre><code>$('input').keyup(function(){ if($(this).val().length&lt;5) { $('a.first').text("Please fill"); } if($(this).val().length&lt;5){ $('a.second').text("Please fill"); } }); </code></pre> <p>But it shows only first <code>&lt;a id="first"&gt;&lt;/a&gt;</code> tag. Second tag not visible</p>
javascript jquery
[3, 5]
4,709,991
4,709,992
jQuery .live('click') seems to only bind to the first element
<p>So I have a bunch of buttons on a page, interspersed with other HTML, that look like this:</p> <pre><code>&lt;input class="add_new_task" type="submit" value="Add New Task"&gt; &lt;input class="add_new_task" type="submit" value="Add New Task"&gt; &lt;input class="add_new_task" type="submit" value="Add New Task"&gt; </code></pre> <p>And then I have my selector as follows: </p> <pre><code>$JQ('.add_new_task').live('click', function(){ //do some stuff }); </code></pre> <p>However, the live('click') only seems to bind to the first element, and so nothing will happen with the 2nd, 3rd etc. elements. Any suggestions as to what I'm doing</p> <p>EDIT:</p> <p>Turns out I was being stupid - I added some error checking to not allow submission if a text box was empty - but I was targetting the text box (stupidly) by id, and that in turn was selecting the first textbox with that ID - which indeed was empty. Changed to a class based selection system for these now - thanks for all the answers though! </p>
javascript jquery
[3, 5]
400,500
400,501
display content depending on which user in asp.net
<p>i have four differnet data entry users that will be using four different forms on my asp.net application to enter data into a database. </p> <p>i currently have windows authentication so that the user will not see the other user's form.</p> <p>my question is how can i send all the four groups the same link <a href="http://website....default.aspx" rel="nofollow">http://website....default.aspx</a> and have it display content SPECIFICALLY for that users?</p>
c# asp.net
[0, 9]
3,136,700
3,136,701
Can someone explain what the syntax means when defining a jQuery plugin?
<p>I am reading up on creating custom jQuery plugins and am a little confused as to the meaning of the following syntax:</p> <pre><code>(function($){ $.fn.truncate = function() { return this.each(function() { }); }; })(jQuery); </code></pre> <p>I understand that function($) is an anonymous function that accepts the $. I just don't quite understand why this function is wrapped in brackets and how the following sets of brackets with jQuery in them...work. </p>
javascript jquery
[3, 5]
4,703,693
4,703,694
Get the html (source code) index of a selection?
<p>If I have</p> <pre><code>&lt;div&gt; hello &lt;/div&gt; </code></pre> <p>and I select 'hello' with my cursor, the start index is 6, end is 11 (inclusive).</p> <p>Is there a way to get this information cross-browser with JavaScript or jQuery?</p>
javascript jquery
[3, 5]
4,748,305
4,748,306
jquery append() doesn't preserve data or click handlers
<p>I am trying to append some links with data and a click handler to a containing div. </p> <p>jQuery 1.4.3</p> <p>Fails in FireFox 5.0/Chrome 13.0.782, but works in IE9</p> <p>I first create the element as a jQuery object, then add the data and click handler. Then I use .append() to append it to the container:</p> <pre><code>var $selector = $('&lt;a href="#" class="x"&gt;Test&lt;/a&gt;'); $selector.data('testdata', "Test"); $selector.click(function(event) { alert('Clicked: ' + $(this).data('testdata')); return false; }); $('#container').append($selector); </code></pre> <p>I see the link added, but when I click on it, the click handler does not fire.</p> <p>I thought that maybe I needed to do the append first and then add data+click, but that doesn't work either:</p> <pre><code>var $selector = $('&lt;a href="#" class="x"&gt;Test&lt;/a&gt;'); $('#container').append($selector); $selector.data('testdata', "Test"); $selector.click(function(event) { alert('Clicked: ' + $(this).data('testdata')); return false; }); </code></pre> <p>Does append not preserve data and handlers? It seems that when I .append($selector), $selector and the newly added DOM object are not one in the same.</p>
javascript jquery
[3, 5]
4,252,924
4,252,925
how to make a "Tr" visiable and invisable based on radio buttonlist click
<p>i have an <strong>2 "tr"</strong> under </p> <ol> <li>tr one have an file upload control</li> <li><p>tr two have an textbox control.</p> <p>so i have an radio button list woth three values 1:image 2:video 3:Audio by default i need to show file upload control visiable that is the <strong>1"tr".</strong> but once user clicks on video/audio option in radio button list then i need to make <strong>2 "tr"</strong> visiable[ textbox] and <strong>1"tr"</strong> invisiable[fileupload control] so how can i achive this functionality in javascript</p> <p>thank you </p></li> </ol>
asp.net javascript jquery
[9, 3, 5]
2,418,340
2,418,341
jQuery merge objects and json_encode
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/171251/how-can-i-merge-properties-of-two-javascript-objects-dynamically">How can I merge properties of two JavaScript objects dynamically?</a> </p> </blockquote> <p>I am trying to merge two objects in jQuery.</p> <p>first object:</p> <pre><code>var rules1 = { firstname: { required: true, minlength: 3 }, lastname: { required: true, minlength: 3 } }; </code></pre> <p>second object:</p> <pre><code>var rules2 = { test1: { required: true, minlength: 3 }, test2: { required: true, minlength: 3 } }; </code></pre> <p>I want the result to look like this:</p> <pre><code>var merged = { firstname: { required: true, minlength: 3 }, lastname: { required: true, minlength: 3 }, test1: { required: true, minlength: 3 }, test2: { required: true, minlength: 3 } }; </code></pre> <p>I also need to know how might look like the PHP array for <code>rules1</code>, because this object will be tranformed with <code>json_encode</code> function.</p>
javascript jquery
[3, 5]
1,397,329
1,397,330
How to assign a dynamic textbox value to a label control
<p>dropdown event code..... </p> <pre><code> foreach (var res in result) { count = +1; Table tbl = new Table(); TableRow row = new TableRow(); TableCell cell = new TableCell(); TableCell cells = new TableCell(); TextBox tx = new TextBox(); tx.ID = "txt" + res.Filtername.ToString() + count.ToString(); Label lb = new Label(); lb.Text = res.Filtername.ToString() + "&lt;br&gt;&lt;/br&gt;"; lb.Width = 100; lb.Height = 20; cell.Controls.Add(lb); row.Cells.Add(cell); cells.Controls.Add(tx); row.Cells.Add(cells); tbl.Rows.Add(row); Page.Form.Controls.Add(tbl); //Page.Form.Controls.Add(lb); //Page.Form.Controls.Add(tx); } } protected void btnsave_Click(object sender, EventArgs e) { try { Label lbb = new Label(); form1.Controls.Add(lbb); lbb.Width = 300; lbb.Height = 10; TextBox txx = new TextBox(); TextBox tx = form1.FindControl("txx") as TextBox; lbb.Text = "ANSWER" + txx.Text + " , " + txx.Text.ToString() + " , " + txx.Text.ToString(); } catch(Exception ex) { Label1.Text = ex.Message.ToString(); } </code></pre> <p>// this is not working... it showing like ---> ANSWER , ,</p>
c# asp.net
[0, 9]
5,145,487
5,145,488
How to check for undefined type in javascript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5515310/is-there-a-standard-function-to-check-for-null-undefined-or-blank-variables-in">Is there a standard function to check for null, undefined, or blank variables in JavaScript?</a> </p> </blockquote> <p>What is the best way to check <code>undefined</code> type in javascript. I know 1 way to check for undefined type i.e. <code>typeOf</code>. But i have to check if for lots of places, so if there is any short and better way to check then please let me know ?</p> <p>I tried few ways but did`nt get success :</p> <pre><code> alert(undefined === "undefined"); alert(undefined || "defined"); </code></pre>
javascript jquery
[3, 5]
4,823,302
4,823,303
Cannot display image
<p>I had Image control and I added code to display images But there is not any image displayed</p> <p>ASPX:</p> <pre><code>&lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div dir='&lt;%= sDirection %&gt;'&gt; &lt;div id="ContentImage" runat="server"&gt; &lt;asp:Image ID="Image2" runat="server" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p>C#:</p> <pre><code>using (System.Data.SqlClient.SqlConnection con = Connection.GetConnection()) { string Sql = "Select Image From AboutUsData Where Id=@Id"; System.Data.SqlClient.SqlCommand com = new System.Data.SqlClient.SqlCommand(Sql, con); com.CommandType = System.Data.CommandType.Text; com.Parameters.Add(Parameter.NewInt("@Id", Request.QueryString["Id"].ToString())); System.Data.SqlClient.SqlDataReader dr = com.ExecuteReader(); if (dr.Read() &amp;&amp; dr != null) { Image2.ImageUrl = dr["Image"].ToString(); } } </code></pre>
c# asp.net
[0, 9]
5,779,859
5,779,860
jquery draggable/droppable issue
<p>Hey guys I have a drag and drop function that <strong>does not fully work</strong>. What I want to do is be able to drag and drop a picture into a div and have that picture pop up in the div. I have a list of 2 pictures right now, so I have the following function echoed for each picture. Both pictures are draggable and droppable, but the first one is the only one that appears in the div, regardless of which picture gets dragged in. I am not sure what is wrong because the <strong>jquery function seems to be unique to each picture</strong>. If any one has any suggestions I would appreciate it greatly.</p> <pre><code>while ($row = mysql_fetch_assoc($query)) { $image=htmlentities($row['image']); //image name $uniqid=uniqid(); //unique id for jquery functions $dirname = "usercontent/$user/images/$image"; echo "&lt;img id=\"$uniqid\" src=\"$dirname\" width=\"75\" height=\"75\"/&gt;"; echo "&lt;script&gt; $(function() { $(\"#$uniqid\").draggable({ scroll: true, scrollSensitivity: 10, scrollSpeed: 10, revert: true, helper: 'clone', cursorAt: { cursor: 'move', top: 27, left: 27 } }); $(\"#droppable2, #droppable-background , #droppable2-innerer\").droppable({ greedy: true, activeClass: 'ui-state-hover', hoverClass: 'ui-state-active', drop: function(event, ui) { $(this).addClass('ui-state-highlight').find('&gt; p').html('Dropped!'); $('#droppable-background').css(\"background-image\",\"url($dirname)\"); } }); }); &lt;/script&gt;"; } </code></pre>
php jquery
[2, 5]
3,359,794
3,359,795
jquery search each table row for a particular td
<p>Consider there's a table with rows to which a <code>td</code> with class <code>x</code> is added by jqeury on the fly (during DOM manipulation). Later when the user sumbit's this table (table being part of a form), i want to search all the rows for existence of this particular <code>td</code>. If this <code>td</code> is found then the function should return false, else true. However this piece of code does not work, any suggestions?</p> <pre><code>function validate(){ $('form#newuser table tr').each(function(){ if($(this).find('td.x')){ return false; } }); return true; } </code></pre>
javascript jquery
[3, 5]