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 |
---|---|---|---|---|---|
2,548,137 | 2,548,138 | jQuery .is(":focus") doesn't recognize focus on checkbox in browsers other than IE | <p>I have a checkbox and a text input. Here's how it works: The cursor goes to the text input when the checkbox is checked. When the text input loses focus, I look to see whether the text input value is empty. If it is, I uncheck the checkbox.</p>
<p>Problem is when it loses focus because I click on the checkbox a second time... The checkbox unchecks and then is checked again, so I can't uncheck it.</p>
<p>I fix this by looking to see if the new focused element is the checkbox. If it isn't, I proceed as normal. This works perfectly in IE, but not in the other browsers I've tested (Chrome, Firefox, Safari).</p>
<p>Anyone have any ideas how to get this to work? Or maybe a different solution?</p>
<p>My actual problem with blur function: <a href="http://jsfiddle.net/4mJuU/5/" rel="nofollow">http://jsfiddle.net/4mJuU/5/</a> (only works in IE)</p>
<p>Simple focus with just a text input <a href="http://jsfiddle.net/HWFHv/2/" rel="nofollow">http://jsfiddle.net/HWFHv/2/</a> (works)</p>
<p>Simple focus with just a checkbox <a href="http://jsfiddle.net/sXqcG/1/" rel="nofollow">http://jsfiddle.net/sXqcG/1/</a> (doesn't work in Chrome/Safari)</p>
<pre><code>$('#cbx').live('click', function() {
if ($(this).is(':checked')) {
$('#txt').focus();
}
else {
$('#txt').val('');
}
});
$('#txt').live('blur', function(event) {
//var doesCbxHaveFocus = document.activeElement.id == 'cbx';
var doesCbxHaveFocus = $('#cbx').is(':focus');
console.log(doesCbxHaveFocus);
if (!doesCbxHaveFocus) {
if ($(this).val() == '') {
$('#cbx').prop('checked', false);
}
else {
$('#cbx').prop('checked', true);
}
}
});
</code></pre>
| javascript jquery | [3, 5] |
5,755,204 | 5,755,205 | Hiding a div with the same class as another using jQuery? | <p>Basically, I would like to accomplish the following with jQuery:</p>
<pre><code> <div class="120 most-voted">
<!-- DON'T HIDE THIS DIV -->
</div>
<div class="110 voted">
<!-- some stuff here -->
</div>
<div class="120 voted">
<!-- hide this div with class '120' since there's already
another div with class '120' at the top -->
</div>
<div class="23 voted">
<!-- some stuff here -->
</div>
</code></pre>
<p><strong>EDIT: The numbers are dynamically generated by a PHP function:</strong></p>
<pre><code> <?php $postid = get_the_ID(); // capture the id ?>
<div id="<?php echo $postid; ?>" class="most-voted">
</code></pre>
<p>I don't want to hide the div at the top.</p>
<p>Any suggestions (I don't mind wrapping another div in the div at the top to accomplish this result)?</p>
| php jquery | [2, 5] |
4,315,557 | 4,315,558 | Parsing preferences data in our Dictioanry in android | <p>In my sqlite database, i have a table for preferences Blob type</p>
<p>In <code>Iphone</code> we can do this </p>
<pre><code>NSDictionary *preferencesDictionary = [preferencesData objectFromJSONDataWithParseOptions:JKParseOptionStrict];
</code></pre>
<p>I have initialized <code>preferencesData as byte[]</code> in Android</p>
<p>If i have to implement same thing in <code>android</code>. How can i get my blob data from database and then store it in dictionary.</p>
| java android iphone | [1, 4, 8] |
4,846,842 | 4,846,843 | regular expression for string that starts with 'http://' | <p>Hi guys just like in the title - I need regular expression that will match anything that starts with 'http://'</p>
| php javascript | [2, 3] |
3,159,730 | 3,159,731 | To delay javascript function call using jquery | <p><strong>CODES:</strong></p>
<pre><code> $().ready(function(){
function sample()
{
alert("This is sample function");
}
$("#button").click(function(){
t=setTimeout("sample()",2000);
});
});
</code></pre>
<p><strong>HTML:</strong></p>
<pre><code><input type="button" name="button" id="button" value="Call sample function with delay">
</code></pre>
<p>Once i click button sample function is not called with a delay of 2 seconds. I dont know whats wrong. Please notify me how to do this</p>
<p><strong>Question:</strong> To call javascript function using setTimeout via jquery</p>
| javascript jquery | [3, 5] |
4,501,024 | 4,501,025 | JS/AJAX Auto submit form: Disabling enter key to prevent page refresh | <p>I am using a function that will submit with ajax and without the help of a button click. But I am currently undergoing two issues which with trial and error haven't found plausible solutions: </p>
<p>First is there any way I can disable the enter button click(this causes the whole page to refresh)?</p>
<p><a href="http://jsfiddle.net/pXA6U/3/" rel="nofollow">JSFIDDLE</a> basic example in how the JS function works</p>
<p>Second, It feels like I am going the roundabout way to display what has been posted. How can I change this part of the function <code>$('#special').html('<p>' + $('#resultval', result).html() + '</p>');</code> to have it POST just inside a div called <code>#special</code> without the need of <code>span or <p> #resultval</code>?</p>
<p>Everytime i echo through php I have to do set it like this to display a result: <code><div id="special"><span id="resultval">This is the result.</span></div></code></p>
<pre><code><script>
$(document).ready(function() {
var timer = null;
var dataString;
function submitForm(){
$.ajax({ type: "POST",
url: "posting.php",
data: dataString,
success: function(result){
$('#special').html('<p>' + $('#resultval', result).html() + '</p>');
}
});
return false;
}
$('#ytinput').on('keyup', function() {
clearTimeout(timer);
timer = setTimeout(submitForm, 050);
var name = $("#ytinput").val();
dataString = 'name='+ name;
});
});
</script>
</code></pre>
| javascript jquery | [3, 5] |
410,491 | 410,492 | How to call WebUserControls based on users request? | <p>I'm building a website where i need to call WebUserControls (.ascx) based on the user request, how can I accomplish this? Is this even possible?</p>
<p>Example:</p>
<pre><code>protected void userclick_click(object sender, EventArgs e)
{
if(textbox1.Text == "2")
{
call WebUserControl1.ascx
}
else
{
/*do nothing*/
}
}
</code></pre>
<p>I'm using C# for this.</p>
<p>Thank you in advance.</p>
| c# asp.net | [0, 9] |
4,604,920 | 4,604,921 | jQuery.clone() causes browser to hang | <p>Why does the following jQuery code cause my browser to hang?</p>
<h3>Caution: do not run this unless you are prepared to force quit your browser</h3>
<pre><code><!DOCTYPE HTML>
<title>Simple clone</title>
<script type="text/javascript" src="jquery.js"></script>
<div>
<script>$('div').clone().appendTo('body');</script>
</div>
</code></pre>
<h3>Edit</h3>
<p>For those in the "infinite loop" camp, that should not be an issue. A perfectly safe (non-jQuery) version is:</p>
<pre><code> <div>div
<script>
var el = document.getElementsByTagName('div')[0];
document.body.appendChild(el.cloneNode(true));
</script>
</div>
</code></pre>
<p>So the issue is specifically related to how jQuery does clones.</p>
<h3>Edit 2</h3>
<p>It seems that jQuery causes script elements in clones to be executed. That isn't standard behaviour and is something about how jQuery does clones that is quite unexpected.</p>
| javascript jquery | [3, 5] |
577,025 | 577,026 | Onclick is not working in google chrome for the alternate times in asp.net | <p>I have a button in my aspx page which has on click event.</p>
<pre><code><asp:Button ID="Button2" runat="server" onclick="Button2_Click"
Text="Save changes" />
</code></pre>
<p>Now the Button2_click is not called for the alternate times, i.e. it will be called when clicked for 2nd,4th,6th..but not for the 1st,3rd,5th... time.</p>
<p>The pageload is called each time but the button_click is not called.This is working fine in IE but having this issue in chrome.</p>
<p>Please tell me what can be done over this.</p>
<p><strong>Update</strong></p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
contentID = Convert.ToInt32(Request.QueryString["contentid"]);
if (contentID != 0)
{
if (!IsPostBack)
{
getContentBody(contentID);
TextBox1.Text = content;
msg_lbl.Text="Inside if"+content;
}
else{
msg_lbl.Text="Inside else";
}
}
else
Response.Write("Invalid URL for article");
}
protected void Button2_Click(object sender, EventArgs e)
{
//string textboxvalue = Request.Form[TextBox1.UniqueID];
Response.Write("Inside button");
mycon.Open();
string query = "update content set content='" +TextBox1.Text + "' where contentID= '"+contentID +"'";
msg_lbl.Text = query;
try
{
MySqlCommand command1 = mycon.CreateCommand();
command1.CommandText = query;
command1.ExecuteNonQuery();
mycon.Close();
getContentBody(contentID);
TextBox1.Text = content;
//msg_lbl.Text = "text" + TextBox1.Text;
// msg_lbl.Text = "text" + TextBox1.Text;
}
catch (Exception ex)
{
msg_lbl.Text = "Exception in saving data" + ex;
}
finally
{
mycon.Close();
}
}
</code></pre>
| c# asp.net | [0, 9] |
3,941,121 | 3,941,122 | What's the average line number per method/class? | <p>I'm interested what's the <strong>average</strong> line number per <strong>method or class</strong>. Programming language is <strong>JAVA</strong> and it's an <strong>Android</strong> project.</p>
<p>I know there is no specific number, but I'm interested what's the <strong><em>good programming practice</em></strong>?</p>
<p><strong>EDIT:</strong> For example in android I have 10 buttons <em>(3 for action bar, 7 for every day of the week so I can quickly choose some day of the week and get relevant information and so on, doesn't really matter what the application is about)</em> and only this "type of code" needs ~100 lines of code (per button I need at least 10 lines of code to <strong>initialize</strong> it and set up a <strong>onClick listener</strong>), is there a way to shrink this down a bit?</p>
<pre><code>someButton = (Button) findViewById(R.id.button);
someButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// do something
}
});
</code></pre>
| java android | [1, 4] |
3,355,094 | 3,355,095 | java & phpseclib, RSA and OAEP? | <p>I am encrypting in Java using <code>Cipher.getInstance("RSA/ECB/OAEPWITHSHA-512ANDMGF1PADDING")</code> and <code>setEncryptionMode(CRYPT_RSA_ENCRYPTION_OAEP)</code> in phpseclib, but the phpseclib is not decrypting the data correctly. </p>
<p>It worked perfectly when I used <code>RSA/ECB/PKCS1Padding</code> in Java, and <code>setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1)</code> in phpseclib.</p>
<p>Here are the supported ciphers in Java: <a href="http://download.oracle.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunJCEProvider" rel="nofollow">http://download.oracle.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunJCEProvider</a></p>
<p>Are none of those ciphers compatible with phpseclib's OAEP implementation?</p>
| java php | [1, 2] |
372,556 | 372,557 | What exactly does !function ($){...}(window.jQuery) do? | <p>I'd like to know exactly what's going on here. I know what <code>$(document).ready(function() {...});</code> does and when it comes into effect. Same goes for <code>jQuery(function($) {...}</code>.</p>
<p>But what does this do?</p>
<pre><code>!function ($) {
$(function(){
var $window = $(window)
//normal jquery stuff
})
}(window.jQuery)
</code></pre>
<p>Is it loaded when jQuery is loaded instead of when the document is 'ready'?</p>
| javascript jquery | [3, 5] |
4,854,933 | 4,854,934 | JQUERY - .html() can also view php | <p>The following script sends data with ajax for login</p>
<p>I want to format the data returned by using, in essence, a session variable ($ _SESSION)</p>
<p>I can do it</p>
<pre><code> $("#login").click(function(){
username=$("#user_name").val();
password=$("#password").val();
$.ajax({
type: "POST",
url: "inc/login.inc.php",
data: "username="+username+"&password="+password,
success: function(msg){
if(msg!='false')
{
$("#login_form").fadeOut("normal");
$("#shadow").fadeOut();
$("#profile").html("<\?php print(\"$_SESSION['name'].\" <a href='inc\/logout.inc.php' id='logout'>Logout k2<\/a>\");\?>");
//valori menù
if(tipo=='1')
{$("#admin").css('display','none')}
}
else
{
$("#add_err").html("Username o password errata");
}
},
beforeSend:function()
{
$("#add_err").html("<img hspace='84' src='img/loading.gif' alt='Loading...' width='32' height='32'>" )
}
});
return false;
</code></pre>
<p>});</p>
<p>especially this is possible, in this way would print the name of the user just logged. otherwise I would not know how to do</p>
<pre><code>$("#profile").html("<\?php print(\"$_SESSION['name'].\" <a href='inc\/logout.inc.php' id='logout'>Logout k2<\/a>\");\?>");
</code></pre>
| php javascript jquery | [2, 3, 5] |
1,928,761 | 1,928,762 | creating popup content with jquery | <p>Let's say i have this code</p>
<pre><code><p id="test">
some content
<p>
<a href="#" id="test-link">Open</a>
</code></pre>
<p>Now i want -using javascript/jquery- to create a popup window, the window content is the content of <code>test</code> paragraph, when <code>test-link</code> is clicked.
How could this be done?</p>
| javascript jquery | [3, 5] |
2,675,118 | 2,675,119 | Regular expression for decimal? | <p>I want to avoid characters like "^+%&/!'&(" in the textbox(decimal).
What is the correct regular expression?</p>
<p>For instance:
Valid: 1,3 or 1,34 or 1<br>
İnvalid: ^4,^' or %2,4 or !!</p>
| c# javascript | [0, 3] |
2,878,762 | 2,878,763 | this != this in javascript (well, sometimes....) | <p>Example 1</p>
<pre><code>var Reptile = function () {
var reptile = this;
this.showBla = function() {
alert(reptile.bla);
}
}
var turtle = new Reptile();
turtle.bla = 'whatever';
turtle.showBla();
</code></pre>
<p>Example 2</p>
<pre><code>var Reptile = function () {
this.showBla = function() {
alert(this.bla);
}
}
var turtle = new Reptile();
turtle.bla = 'whatever';
turtle.showBla();
</code></pre>
<p>Is example 1 legit? As it sometimes seems to screw things over to define "this" directly in the constructor...?!?</p>
| javascript jquery | [3, 5] |
3,568,797 | 3,568,798 | Creating dynamic hyperlink in asp.net using c# | <p>In my application I have DataSet containing name and Id of user and I want to create a dynamic hyperlink of the all the user name. Please anyone tell me how to create dynamic hyperlink using C#.</p>
| c# asp.net | [0, 9] |
364,960 | 364,961 | Referencing a JavaScript variable | <p>I have 2 variables in a script tag that get populated with string values.
I also have an <code>.each</code> loop that goes through each select box I have on the page. I want a way to append the index value of the loop to the name of the variable, and retrieve its value.</p>
<pre><code>var secQuestion1 = "bla"
var secQuestion2 = "bla"
selectbox.each(function( index ) {
var question = ['secQuestion' + (index+1) ];
console.log("question = ", ['secQuestion' + (index+1)] )
});
</code></pre>
<p>I thought I might be able to use bracket notation to retrieve the value.
Any ideas on how to do this, so on each index in the loop I would get my questions values?</p>
| javascript jquery | [3, 5] |
5,751,779 | 5,751,780 | undo, redo, copy, paste, cut with jQuery | <p>Is it possible and if yes then how to implement undo,redo,copy,paste and cut with jQuery on textarea for example.</p>
<p>I did checked <a href="http://docs.jquery.com/Plugins/Undo" rel="nofollow">jQuery undo plugin</a> but it didn't work that well also i tried to implement keypress by myself using jQuery extensions methods. Created keypress event and assigned value to it. Still didn't work.</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
1,451,323 | 1,451,324 | How can I get the index of non-sibling elements in jquery? | <p>HTML:</p>
<pre><code><ul>
<li>Help</li>
<li>me</li>
<li>Stack</li>
<li>Overflow!</li>
</ul>
<br>
<ul>
<li>Can</li>
<li>I</li>
<li>connect</li>
<li>these?</li>
</ul>
</code></pre>
<p>Javascript/JQuery:</p>
<pre><code>$("li").live('click', function(){
alert($(this).index());
});
</code></pre>
<p>I put together a simple jsfilled page to help describe my problem: <a href="http://jsfiddle.net/T4tz4/" rel="nofollow">http://jsfiddle.net/T4tz4/</a></p>
<p>Currently clicking on an LI alerts the index relative to the current UL group. I'd like to know if it was possible to get a 'global index' so that clicking on "Can" returns the index value of 4.</p>
<p>Thank you,
John</p>
| javascript jquery | [3, 5] |
5,074,290 | 5,074,291 | Jquery append() isn't working | <p>I have this <code><ul></code></p>
<pre><code><ul id="select_opts" class="bullet-list" style="margin-left:15px;"></ul>
</code></pre>
<p>This javascript code which is meant to go throug a JSON object and add the options
to the UL:</p>
<pre><code>$.each(q.opts, function(i,o)
{
var str='';
str+="<li id='li_" + i + "'><input type='text' id='opt_" + i + "' value='" + o.option + "'>";
str+=" (<a href='javascript:delOpt(" + i + ");'>Delete</a>) </li>";
$("#select_opts").append(str);
});
</code></pre>
<p>If I do console.log() I can see that the looping is working. If I do:</p>
<pre><code>console.log($("#select_opts").html());
</code></pre>
<p>It shows the HTML being updated as expected. However in the browser window, it shows the
UL as empty!</p>
<p>What am I doing wrong?</p>
| javascript jquery | [3, 5] |
978,908 | 978,909 | jQuery bubble like the one on stackoverflow? | <p>I like the orange bubbles that appears on SO as a warning: Is there a jQuery plugin for that? </p>
| javascript jquery | [3, 5] |
4,307,073 | 4,307,074 | pass a javascript via ajax and process with php | <p>I need to pass a javascript object , info is a javascript object.</p>
<pre><code>register.php?t="+accessToken+"&u="+info
</code></pre>
<p>in php i tried to change </p>
<pre><code>$data = $_GET['u'] ;
var_dump($data);
</code></pre>
<p>It's not working help me to slove,</p>
| php javascript | [2, 3] |
2,848,827 | 2,848,828 | Generating Javascript from PHP? | <p>Are there any libraries or tools specifically designed to help PHP programmers write Javascript? Essentially, converting the PHP logic into Javascript logic. For instance:</p>
<pre><code>$document = new Document($html);
$myFoo = $document->getElementById("foo");
$myFoo->value = "Hello World";
</code></pre>
<p>Being converted into the following output:</p>
<pre><code>var myFoo = document.getElementById("foo");
myFoo.value = "Hello World";
</code></pre>
<p>So the <code>$html</code> that is passed in won't initially be modified by the PHP. Instead, the PHP will convert itself into Javascript which is then appended onto the end of the <code>$html</code> variable to be ran when the variable it output and converted into the client-side DOM.</p>
<p>Of course it would be excellent if more complicated solutions could be derived too, perhaps converting objects and internal methods into javascript-objects, etc.</p>
| php javascript | [2, 3] |
1,163,215 | 1,163,216 | jQuery Set Cursor In Home Key | <p>I want after type two number in filed append <code>/</code> and set cursor in home. </p>
<p>My mean of the home is, <code>Home</code> key on the keyboard :
<img src="http://www.barcodeman.com/altek/mule/kbemulator/keypics/key.home.up.png" alt="enter image description here"></p>
<p>I try as: (In my code instead run Home key this adding <code>$</code>)</p>
<pre><code><input type="text" class="num" maxlength="2"/>
$(".num").keypress(function(e){
var val = this.value;
var value = val + String.fromCharCode('36');
(val.length == '2') ? $(this).val(value+'/') : '';
});
</code></pre>
<p><strong>DEMO:</strong> <a href="http://jsfiddle.net/3ePxg/" rel="nofollow">http://jsfiddle.net/3ePxg/</a></p>
<p>How can done it?</p>
| javascript jquery | [3, 5] |
4,192,474 | 4,192,475 | asp.net WebControl event order and ViewState | <p>I have a custom class creating a dropdownlist control as below:</p>
<pre><code>public class IHGridView : System.Web.UI.WebControls.WebControl
{
private string _dataSource = "not set yet";
public string DataSource
{
get { return _dataSource; }
set { _dataSource = value; }
}
}
</code></pre>
<p>EDIT:</p>
<pre><code> protected override void OnInit(EventArgs e)
{
// VIewState is alive. When I select an option and submit, after postback it's selected value is the one I selected.
this.Controls.Add(_dropDownList);
}
</code></pre>
<p>or</p>
<pre><code> protected override void CreateChildControls()
{
// VIewState is dead. When I select an option and submit, after postback it's selected value is the default one.
this.Controls.Add(_dropDownList);
}
</code></pre>
<p>So, now I come up with the result that I have to add control in "OnInit" void.
But, this "OnInit" is the first void that this class writes.
If I want to use a property like "DataSource" before, "OnInit" void...
How would I do that?</p>
<p>EDIT:</p>
<pre><code> protected void Button1_Click(object sender, EventArgs e)
{
IHGridViewTest2.DataSource = "fired";
}
</code></pre>
<p>DataSource is set when the button in aspx page is fired.</p>
| c# asp.net | [0, 9] |
791,091 | 791,092 | Finding value from a hidden field | <p>I am adding value in my webpage as hidden like this:</p>
<pre><code>cell.append('<input type="hidden" class="isTestValue" value="' + bill.IsTestBill + '">');
</code></pre>
<p>Now I wrote to get this value:</p>
<pre><code>function getIsTestId(billIndex) {
var selectedRow = getSelectedRow(billIndex);
var lastCol = jQuery(selectedRow).find('TD:last');
return (lastCol.find('INPUT:hidden.isTestValue).val());
}
</code></pre>
<p>However, in my function when I am calling this getIsTestId: </p>
<pre><code> var testId= getIsTestId(billIndex);
</code></pre>
<p>In testId the value is undefined. What am I doing wrong here?</p>
<p>PS: How should I check my isTestValue in immediate window?</p>
| javascript jquery | [3, 5] |
5,119,547 | 5,119,548 | Binding database data to the GridView in ASP.Net | <p>I try to bind database data to the gridview in c# and asp.net. But I couldn't see the datas in the gridview.Rows are added to the gridview but they are empty. When I run that query in SQLServer, it gives the correct result.I didn't add or change any code to the asp part.Should I? I couldn't find where is the problem :( please help..</p>
<pre><code>myConnection = WebConfigurationManager.ConnectionStrings["KutuphaneConnectionString"].ConnectionString;
connect = new SqlConnection(myConnection);
command = new SqlCommand();
connect.Open();
command.Connection = connect;
string komut = "SELECT K.ad,K.yazar,K.baskiNo,O.sonTeslimTarihi FROM OduncIslemleri O,Kitap K WHERE O.kullaniciId=" + Session["id"] + " AND O.kitapId = K.id;";
try
{
SqlCommand sqlCommand = new SqlCommand();
sqlCommand = connect.CreateCommand();
sqlCommand.CommandText = komut;
SqlDataAdapter sda = new SqlDataAdapter(sqlCommand.CommandText, connect);
SqlCommandBuilder scb = new SqlCommandBuilder(sda);
//Create a DataTable to hold the query results.
DataTable dTable = new DataTable();
//Fill the DataTable.
sda.Fill(dTable);
GridView1.DataSource = dTable;
GridView1.DataBind();
}
catch (SqlException)
{
//Console.WriteLine(e.StackTrace);
}
reader.Close();
connect.Close();
</code></pre>
| c# asp.net | [0, 9] |
3,724,975 | 3,724,976 | ParseInt() method on array | <p>I am wondering to how to get number from an array. I have tried its give me NaN error</p>
<pre><code><script type="text/javascript">
$(function(){
var Arr = [ 'h78em', 'w145px', 'w13px' ]
alert(parseInt(Arr[0]))
})
</script>
</code></pre>
| javascript jquery | [3, 5] |
2,146,888 | 2,146,889 | Adding .NET namespaces automatically | <p>I need to add this namespace to my c# file:</p>
<blockquote>
<p>using System.Data;</p>
</blockquote>
<p>Is there a way to automatically add this to newly created pages in c#.net?</p>
<p>I don't want to add this namespace to new pages.</p>
| c# asp.net | [0, 9] |
919,107 | 919,108 | jquery addClass adding subclass not working | <p>this is my 1st time posting here, so thanks to everyone who can give me some advice!</p>
<pre><code><html>
<head>
<style>
</style>
<script src="jquery-1.5.2.js"></script>
</head>
<body>
<div
class="super"
style="
border: solid black 1px;
height:100px;
width:100px;
">
</div>
<div
class="super .eight"
style="
background: blue;
">
</div>
<script>
$(".super").click(function () {
$(this).addClass(" .eight");
});
</script>
</body>
</html>
</code></pre>
<p>So basically the problem is that I want to add for example a background or some other type of element onto class that is already defined as super. I am trying to use subclasses but it does not seem to be working.</p>
<p>Please ask me if there is anything unclear, I apologize if there is. </p>
| javascript jquery | [3, 5] |
4,231,311 | 4,231,312 | mouse click somewhere else on page (not on a specific div) | <p>I want to close a little pop-up box in page when user has clicked anywhere on the page other than box area. how to find it?</p>
| javascript jquery | [3, 5] |
230,619 | 230,620 | dynamically populated jquery carousel | <p>I am trying to dynamically populate a jquery carousel with linked images. I would like to pull them out of a database (the file ids are in the database, the images themselves are in a file on the site) using specifics, for example I have the images labelled (in the database) as either jpegs, pngs or vector eps(though a jpeg would be used for a preview), and I would like a carousel to pull out the jpegs, and a second carousel to only pull out pngs, etc. starting with the most recently added... can someone explain how to do this in layman's terms or link me to a page where someone else does? Where do I start? Thanks!</p>
<p><strong>EDIT</strong> What I have figured out so far is that basically I just need to learn how to pull files out of the database, and I've figured out that I can (I think) use an array in a url to get the images, so like, example.com/imgs/id?id= [here would be some array/php stuff]... so now I need to figure out how to make that array pull from the database, and also I still need to figure out how to make sure if I have 6 images like above, that they are pulling from the most recent uploads to the database in their respective order... hope that makes sense, and the last thing is to be able to organize them. So for example, I have a database table with each image that are given a unique id and placed in one of several categories, so basically i need to be able to tell that array to get files in x category starting with most recent, ending with the oldest files.</p>
| php jquery | [2, 5] |
2,496,210 | 2,496,211 | Resize 2x divs width with Jquery Animate - Is this a poor approach? | <p>I've been trying to find a more elegant way to do this function but have not yet figured it out. I have 2 divs that I'd like to resize upon execution of a function. One will slide away (width:'0%') and the other fills the remaining space (width:'100%'). The code below works great but seems a little heavy. Any suggestions for making it cleaner?</p>
<pre><code>function testAct(){
$('#sideBar').animate({width:'0%'},500);
$('#map_canvas').animate({width:'100%'},500,function(){google.maps.event.trigger(map,'resize')});
if (document.getElementById('map_canvas').style.width == '100%')
{
$('#sideBar').animate({width:'25%'},500);
$('#map_canvas').animate({width:'75%'},500,function(){google.maps.event.trigger(map,'resize')});
}
}
</code></pre>
| javascript jquery | [3, 5] |
2,642,898 | 2,642,899 | Trouble applying my function to more than one text box | <p>so I am completely new to jquery and am trying to figure out how to apply my function to more than one textbox, I ultimately need to hook it up to another function similar to the one I have, but I just cannot figure out how to hook them both up so they do not allow certain inputs. Any advice on this is much appreciated.</p>
<pre><code><html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#textBox").keypress(function (e) //the function will check the textbox
{
if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
{
return false;
}
});
});
</script>
</script>
</head>
<body>
<font face='courier'>
Numbers Only : <input type="text" id="textBox" /><br/>
Letters Only : <input type="text" id="textBox2" />
</body>
</html>
</code></pre>
<p>Thanks in advance,</p>
| javascript jquery | [3, 5] |
680,955 | 680,956 | How to dynamically set align property for td in javascript? | <p>Here is my code, my question is in the comment:</p>
<pre><code>function (align) {
var column = $(`'<td>'`);
// now i need syntax to set align property to this td element
// column.align = align (not working)
}
</code></pre>
<p>As shown, <code>column.align = align</code> is not working.</p>
<p>Where am I going wrong?</p>
| javascript jquery | [3, 5] |
5,462,531 | 5,462,532 | custom httphandler throwing exception while doing rewrite path | <p>I want redirect to a file which is at the root level of the application , but i am getting the following error.</p>
<p>I did the following things to achieve the same</p>
<ol>
<li>I have a virtual directory under root which is sample</li>
<li>Added handler with some custom name like .zpy which resolves to .net
root/sample(sample is a virtual directory)</li>
<li><p>Added the mapping in the web.config </p>
<pre><code><add verb="*" path="*.zpy" type="MyUrlHttpHandler, WebProj"/>
</code></pre></li>
<li><p>And this is the code</p>
<pre><code>string finalUrl= "http://www.test.com/test.asp";
context.RewritePath(finalUrl);
IHttpHandler hnd = PageParser.GetCompiledPageInstance(finalUrl, null, context);
hnd.ProcessRequest(context);
</code></pre></li>
</ol>
<p>I get the following error </p>
<p><strong>http://www.test.com/test.asp is not a valid virtual path.</strong></p>
<p>The code is getting executed but i am unable to send the request to test.asp which is at
root level.</p>
<p>i tried moving the handler to root and having handler at the root level , but its still throwing the same error</p>
<p>exception stack trace</p>
<pre><code>HttpException (0x80004005): 'http://locwww.test.com/test.asp' is not a valid virtual path.]
System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) +8855691
System.Web.HttpContext.RewritePath(String path, Boolean rebaseClientPath) +116
System.Web.HttpContext.RewritePath(String path) +6
ADC.Web.Code.ApcUrlHttpHandler.ProcessRequest(HttpContext context) in C:\Projects\webproj\urlHttpHandler.cs:30
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
</code></pre>
| c# asp.net | [0, 9] |
239,903 | 239,904 | How to limit the visible items of dropdownlist, which is populated by DataSet | <p>I have a <code>DropdownList ASP control</code>, which is populating by <code>DataSet</code>.</p>
<p>I am using <code>.net 3.5, c#.</code></p>
<p>To control the height of DropDownList, i am using the following code and it is working.</p>
<pre><code><asp:DropDownList size="1"
onMouseOver="this.size=10;"
onMouseOut="this.size=1;"
style="display:none; position:absolute; width:150px;"
runat="server"></asp:DropDownList>
</code></pre>
<p><strong>But it is flickering</strong> when clicking on it, means first it shows all values and again resized for 10, provided length of the control.</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
2,489,170 | 2,489,171 | Foreground service: how to handle user enable/disable | <p>My Android application is a foreground service and I would like the option of the user being able to disable the service whenever they like, without having to uninstall the entire application.</p>
<p>I use the enabled = true label in the manifest and boot completed to start the service in the foreground. My concern is that should I have a very basic global boolean value (inside onCreate of the service) of userEnabled = false to prevent the service from starting (stopSelf), Android will continue to attempt to start my service which will result in a loop and therefore use unnecessary resource?</p>
<p>Please can someone share their knowledge with me to let me know that I either don't have to be concerned about this, or the correct procedure/method by which to do this? I can't find any documentation or posts that give direction. </p>
<p>I thank you in advance.</p>
<p>Answer: Please see CommonsWare's answer below and here is a link to some <a href="http://stackoverflow.com/a/5625179/1256219">useful code</a>, also by CommonsWare</p>
<p>After further reading, there is no loop that can be caused by having the service set enabled true in the Manifest.</p>
| java android | [1, 4] |
689,943 | 689,944 | Android Development in VS 2010 using C# | <p>I would like to use C# for developing mobile apps for the Android Framework. I have looked at MonoDroid, just downloaded, yet to install. I would like to be able to deploy to a device rather than just the emulator. Are there any other options out there of we are stuck with MonoDroid and the $399 that comes with the Licence?</p>
| c# android | [0, 4] |
3,825,720 | 3,825,721 | Removing mark-up from unordered list with jquery | <p>In the follow content I need to remove the mark-up tags <code><div class="sub"></code> and <code></div</code>> but not it's content with jquery. This is to adapt the menu to a responsive layout.</p>
<pre><code><nav id="top">
<ul>
<li class="ti" id="snw"> <a class="mm" href="/snowdepth/">Weather</a>
<div class="sub">
<ul>
<li><h2>Snowline</h2></li>
<li><a href="/alpen/nordliche%20ostalpen/">Nordliche Ostalpen</a></li>
</ul>
</div>
</li>
<li class="ti" id="blg"> <a class="mm" href="/live/">Weblog</a></li>
</ul>
</nav>
</code></pre>
| javascript jquery | [3, 5] |
1,329,368 | 1,329,369 | How can I databind to a string array? | <p>How can I databind a string array (<code>string[]</code>) to a <code>dropdownlist</code>?</p>
<p>Does it implement <code>iEnumerable</code>?</p>
| c# asp.net | [0, 9] |
3,900,804 | 3,900,805 | How do I make this web service work? | <p>I am a new developer and trying to develop a web service in C# by following <a href="http://dotnetguts.blogspot.com/2007/09/all-about-web-service-in-net.html" rel="nofollow">this tutorial</a>. I did everything as explained in that tutorial, however, I did not get any data from the Northwind database and I got the following page when I pressed the Invoke button:
<img src="http://i.stack.imgur.com/VLvfT.png" alt="enter image description here"> </p>
<p>As you will see in the tutorial, I did not add the ConnectionString to the web.config file. Should I do that? </p>
<p>My code:</p>
<pre><code>public class WSGetCustomerCountryWise : System.Web.Services.WebService
{
public WSGetCustomerCountryWise()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod(Description = "It will generate Customer List, CountryWise")]
public System.Xml.XmlElement
GetCustomerCountryWise(string sCountry)
{
string sConn = ConfigurationManager.ConnectionStrings["connStr"].ToString();
string sSQL = "select CustomerId, CompanyName, ContactTitle, City from Customers where country = '"+sCountry+"'";
SqlConnection connCustomer = new SqlConnection(sConn);
DataSet dsCustomer = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter(sSQL, sConn);
sda.Fill(dsCustomer);
System.Xml.XmlDataDocument xdd = new System.Xml.XmlDataDocument(dsCustomer);
System.Xml.XmlElement docElem = xdd.DocumentElement;
return docElem;
}
}
</code></pre>
| c# asp.net | [0, 9] |
2,991,822 | 2,991,823 | OutofMemory Exception (when cropping an Image) | <p>I am trying to crop an Image that coming from a byte array. Unlucky, I get the OutofMemory Exception in my cropImage function. this part show how I write it on a file.</p>
<pre><code>System.IO.MemoryStream ms = new System.IO.MemoryStream(strArr);
System.Drawing.Rectangle oRectangle = new System.Drawing.Rectangle();
oRectangle.X = 50;
oRectangle.Y = 100;
oRectangle.Height = 180;
oRectangle.Width = 240;
System.Drawing.Image oImage = System.Drawing.Image.FromStream(ms);
cropImage(oImage, oRectangle);
name = DateTime.Now.Ticks.ToString() + ".jpg";
System.IO.File.WriteAllBytes(context.Server.MapPath(name), strArr);
context.Response.Write("http://local.x.com/test/" + name);
</code></pre>
<p>and this part is my crop Image function which is obvious what it is doing..</p>
<pre><code>private static System.Drawing.Image cropImage(System.Drawing.Image img, System.Drawing.Rectangle cropArea)
{
System.Drawing.Bitmap bmpImage = new System.Drawing.Bitmap(img);
System.Drawing.Bitmap bmpCrop = bmpImage.Clone(cropArea,
bmpImage.PixelFormat);
return (System.Drawing.Image)(bmpCrop);
}
</code></pre>
<p>and this is how I construct my strArr</p>
<pre><code>System.IO.Stream str = context.Request.InputStream;
int strLen = Convert.ToInt32(str.Length);
byte[] strArr = new byte[strLen];
str.Read(strArr, 0, strLen);
string st = String.Concat(Array.ConvertAll(strArr, x => x.ToString("X2"))); // try 4
</code></pre>
| c# asp.net | [0, 9] |
4,587,834 | 4,587,835 | How to pass an object reference to a function with jQuery? | <p>I have several links which all use a similar function, so I want to call the function and pass it attributes from the object that made the call. How do I do this? </p>
<p>This is my code:</p>
<pre><code>$('.flash').click(function(){
getDimensions($(this));
swfobject.embedSWF(fileRef, "myContent", fileWidth, fileHeight, "9.0.0");
});
function getDimensions(linkRef){
fileHeight = $(linkRef).attr('data-height');
fileWidth = $(linkRef).attr('data-width');
}
</code></pre>
<p>Am I just referencing <code>$(this)</code> improperly?</p>
| javascript jquery | [3, 5] |
210,639 | 210,640 | Loading JWplayer dynamically | <p>Hi and thanks for looking into this.</p>
<p>I have a code I've been working on to add videos to my site. All videos are from youtube. Once a user has clicked on submit, a link becomes visible. When clicking on it the user can preview the video.</p>
<p>One week ago I used the following to achieve this:</p>
<pre><code>$("#result").html('<a href="javascript:initPlayer(\'http://www.youtube.com/watch?v=kXhy7ZsiR50\')>Preview video</a><br>');
</code></pre>
<p>Everything worked fine. But today I was trying the script and the link doesn't appear anymore. The link works however fine if I do something like:</p>
<pre><code><a href="javascript:initPlayer('http://www.youtube.com/watch?v=kXhy7ZsiR50')">Preview video</a>
</code></pre>
<p>Somewhere on the page.</p>
<p>I don't know why the call with jQuery doesn't work anymore. It worked fine when I was developing the website. I tried it on different browsers, but with the same result in the end.</p>
<p>Anyone any idea how to solve this? I'm starting to pull out my hair. :)</p>
<p>Thanks in advance.</p>
| javascript jquery | [3, 5] |
767,697 | 767,698 | Remebering the last value passed to a JavaScript function called on click | <p>I have a simple JavaScript question.</p>
<p>Below is my code fragment:</p>
<pre><code><div onclick = "myClick('value 1')">
button 1
</div>
<div onclick = "myClick('value 2')">
button 2
</div>
</code></pre>
<p>Basically when I for each click on a different div, a different value will be passed to the JavaScript function. </p>
<p>My Question is how can I keep track of the value passed in the previous click? </p>
<p>For example, I click "button 1", and "value 1" will be passed to the function. Later, I click on "button 2", I want to be able to know whether I have clicked "button 1" before and get "value 1".</p>
<p>Please help, thank you in advanced.</p>
| javascript jquery | [3, 5] |
2,315,544 | 2,315,545 | Insert a new record (asp .net & c#) | <p>I'm a newbie to asp .net and c# world. I'm trying to insert a very new record into a simple task manager database table, tasks (name, description, priority, start_date, end_date)</p>
<p>Here is my Task.cs and add.aspx code:
<a href="http://pastie.org/691005" rel="nofollow">http://pastie.org/691005</a></p>
<p>When I submit the form, it just redirect me back to the Default.aspx page. Is there anyway to debug the inside the Insert method of Task.cs? How can I output the sql query from within the Task.cs file? I'm using Microsoft SQL express.</p>
<p>Thank you</p>
| c# asp.net | [0, 9] |
3,698,182 | 3,698,183 | 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] |
5,148,215 | 5,148,216 | Sliding Tab jumping about jQuery | <p>Ive built a little jquery sliding div on my website that when you hover over the tab, the div slides in from the right, and on the mouse leave event, the div slides back out of view. The problem im having however is if you very quickly move your mouse over the tab then off, then over and keep repeating this the div slides in and out repeatedly; Is there anyway I can stop this?</p>
<p>Thanks</p>
<pre><code>$('.pillars-wrapper').mouseenter(function() {
$('.handle').fadeOut();
$('.tab-wrapper').animate({
right: '+=175'
})
});
$('.pillars-wrapper').mouseleave(function() {
$('.tab-wrapper').animate({
right: '-=175'
});
$('.handle').fadeIn()
});
</code></pre>
<p>Heres a fiddle...</p>
<p><a href="http://jsfiddle.net/FXAcP/" rel="nofollow">http://jsfiddle.net/FXAcP/</a></p>
| javascript jquery | [3, 5] |
5,793,700 | 5,793,701 | error when Calling a function inside jquerry plugin | <p>I am developing a jquerry plugin in which, when i click a pause link I need to call a function inside plugin. My code is like this </p>
<pre><code>$("#pauseAnimation").click(function () { $.fn.cjImageVideoPreviewer().pauseAnimation(); })
</code></pre>
<p>and function to be called is this</p>
<pre><code>(function ($) {
$.fn.cjImageVideoPreviewer = function (options) {
var settings = {
// user editable settings
images: [],
delay: 1000,
autoPlay: false,
showProgress: false
};
var sys = {
// function parameters
version: '1.0.2',
elem: null,
idx: 1,
timer: null,
loaded: 0,
mouseX: null,
mouseY: null,
state: false
};
/*
handle transitions
***************************************/
function clearTimer() {
if (sys.timer !== null) {
window.clearTimeout(sys.timer);
sys.timer = null;
}
}
// reset everything
function stopAnimation() {
if (sys.state) {
clearTimer();
sys.idx = 0;
sys.state = false;
// show the first image
$(sys.elem).find("div.cjImageVideoPreviewer img:first").css({
"display": "block"
});
// hide all the other images
$(sys.elem).find("div.cjImageVideoPreviewer img:not(:first)").css({
"display": "none"
});
}
}
// pause
function pauseAnimation() {
if (sys.state) {
clearTimer();
sys.idx = 0;
sys.state = false;
}
}
</code></pre>
<p>when i click the link an error comes as </p>
<blockquote>
<p>Microsoft JScript runtime error: Object doesn't support this property or method
any help would be appreciable..</p>
</blockquote>
| javascript jquery | [3, 5] |
5,399,344 | 5,399,345 | message box in asp.net web application | <p>how to display the 'successfully saved' message box in asp.net web application by using javascript. </p>
<p>any idea ???</p>
| asp.net javascript | [9, 3] |
2,520,719 | 2,520,720 | How to change document.title when clicking a link? | <p>Seems impossible... maybe theres a genius around here!</p>
<h1>jquery only</h1>
| javascript jquery | [3, 5] |
4,503,086 | 4,503,087 | jQuery - Call function when dropping div | <p>I want to run function <code>insertHouse()</code> when dropping div#Draggable. I can't manage to make it work. You can see me trying to call it in the second line from the bottom. What am I doing wrong?</p>
<pre><code><img src="images/door1.jpg" id="draggable">
<div id="items"></div>
// Place house;
function insertHouse()
{
blablabla
}
$( init );
function init() {
$('#makeMeDraggable').draggable();
$('body').droppable( {
drop: handleDropEvent
} );
}
function handleDropEvent( event, ui ) {
function insertHouse();
}
</code></pre>
| javascript jquery | [3, 5] |
1,540,892 | 1,540,893 | jQuery Number to Number scrolling | <p>OK, I know you can change a <code>id</code> or <code>class</code> text using this <code>$("#test").text("NUMBER_HERE");</code> but... using jQuery, instead of statically going from one number to the next... is there a way so it counts down or up depending on the number you picked?</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
2,891,819 | 2,891,820 | View Changes In Force Portrait Mode | <p>i am new in android platform. I have set my android application to force portrait mode. Now , i have an activity group in my application. When i am in a child view of the activity group , then if i rotate my device the screen remains in portrait mode but the view changes from child view to parent view of the activity group. I don't know why this is happening. So please help me on the issue. Thanks in advance .... !!!</p>
| java android | [1, 4] |
5,380,023 | 5,380,024 | Returning PHP value to the page | <p>I have a remote php program that generates 2 random numbers, I call to it on my form page to populate a text box used in validation. I can't get it to return the numbers.</p>
<pre><code><?php
$randomNum = rand(0,9);
$randomNum2 = rand(0,9);
echo ($randomNum + $randomNum2);
$randomNumTotal = $randomNum + $randomNum2;
?>
</code></pre>
<p>It is returning the total, not # + #
Please help!</p>
<p>OK, thanks to the help below I got the output to be correct on the page. What I'm doing is the parent page brings in forms via AJAX. The forms are validated by a remote PHP script "random.php" in the forms there is a math problem for a somewhat human verification, the math problem is populated by the "random.php" file via .get command. Got that working. The issue now is that I can't solve the problem correctly... the answer input has this validation:</p>
<pre><code>SomeName: {
equal: "<? php echo $randomNumTotal ?>
}
</code></pre>
<p>but it's not working...any ideas?</p>
| php jquery | [2, 5] |
5,735,961 | 5,735,962 | Change theme dynamically without page refresh in ASP.NET | <p>You must have noticed one link in yahoo.com, msn.com or other popular websites named "Page Options". When you click this link you get a popup displaying different small several color icons. After clicking one of these icons your page theme changes without entire page refresh. Now you are able to see the same page with different look and feel. </p>
<p>How does it happen and what it takes to do it? Is this possible in ASP.NET? If yes, how to do it?
<strong>Show me some syntax.</strong></p>
| asp.net jquery | [9, 5] |
170,635 | 170,636 | How can I get the corresponding table column (td) from a table header (th)? | <p>I want to get the entire column of a table header.</p>
<p>For example, I want to select the table header "Address" to hide the address column, and select the "Phone" header to show the correspondient column.</p>
<pre><code><table>
<thead>
<tr>
<th id="name">Name</th>
<th id="address">Address</th>
<th id="address" class='hidden'>Address</th>
</tr>
</thead>
<tbody>
<tr>
<td>Freddy</td>
<td>Nightmare Street</td>
<td class='hidden'>123</td>
</tr>
<tr>
<td>Luis</td>
<td>Lost Street</td>
<td class='hidden'>3456</td>
</tr>
</tbody>
</code></pre>
<p></p>
<p>I want to do something like <a href="http://www.google.com/finance?q=apl" rel="nofollow">http://www.google.com/finance?q=apl</a> (see the related comanies table) <em>(click the "add or remove columns" link)</em></p>
<p>:) thanks in advance.</p>
| javascript jquery | [3, 5] |
3,750,578 | 3,750,579 | convert 1,00 to 100 in .Net | <p>How do I convert the number "1,00" to "100" in .Net?</p>
<p><strong>Clarification:</strong> I have this code:</p>
<pre><code>VALOR = order.Total.ToString("#0.00");
</code></pre>
<p>It returns the text "1,00" but I need "100" (without comma).</p>
| c# asp.net | [0, 9] |
2,075,323 | 2,075,324 | Null PointerException in spinner in android | <p>I am working in Android. I want to design a spinner of song categories. </p>
<p>This is my code:</p>
<pre><code>public Spinner spinner_category_forSong;
String[] arr_Category={"Select","sad","dj","rock"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(
this,android.R.layout.simple_spinner_item,arr_Category);
spinner_category_forSong = (Spinner)findViewById(R.id.Spinner_category_forUpload);
spinner_category_forSong.setPrompt("Music Category :");
spinner_category_forSong.setAdapter(adapter);
</code></pre>
<p>But whenever I run my project, a null pointer exception is created in <code>spinner_category_forSong.setPrompt("Music Category :");</code> and <code>spinner_category_forSong.setAdapter(adapter);</code>.</p>
<p>Please tell me what mistake I have made in this code.</p>
| java android | [1, 4] |
2,572,704 | 2,572,705 | Partially expanding a div to preview contents | <p>When I hover over a div, I want another div (which starts as <code>display:none</code>) to partially expand downward, revealing only the top of its contents. How can I partially expand a hidden div with jQuery? Preferably so that the div fades out towards the bottom. There don't seem to be parameters for the <code>toggle()</code> command or <code>fadeIn()</code> that allow partial expansion.</p>
<h1>Edit</h1>
<p>Unfortunately, the requirements don't allow a separate 'teaser' div to be used. The hidden div containing all the text has to be partially expanded.</p>
| javascript jquery | [3, 5] |
595,385 | 595,386 | What is the difference between URI and Uri class | <p>I am confused , how to use <code>Uri</code> because i am using it in android development at <code>Intent's</code> <code>Action dial</code> </p>
<pre><code>Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(“tel:555-2368”));
</code></pre>
<p>what i want to do :</p>
<p>i want to create a file inside which i want to put 2 phone numbers then i want to use toUri() method with this file , and want to put that uri in the intent , then i want to see what happens with the intent . </p>
| java android | [1, 4] |
4,075,564 | 4,075,565 | Graph not showing on the Page | <p>I have a graph and an Image button on one of my pages which I am displaying on runtime.
The graph is bound to a datatable and Image button URL is given as the image folder.I am using 3 images based on the value in datatable and setting the ImageURL of the ImageButton Dynamically.</p>
<p>The problem is my graph does not show on page load,but it appears when I click any button on that page.(I have called the graph function on pageload)</p>
<p>Also,the image button never shows up even after multiple page refresh.</p>
<p>Please help.
Thanks in advance</p>
| c# asp.net | [0, 9] |
5,020,675 | 5,020,676 | How do we dynamically change the assembly path in DLLImport attribute? | <p>How do we change the assembly path in DLLImport attribute inside an if conditional statement?
e.g. I want to do something like this:</p>
<pre><code>string serverName = GetServerName();
if (serverName == "LIVE")
{
DLLImportString = "ABC.dll";
}
else
{
DLLImportString = "EFG.dll";
}
DllImport[DLLImportString]
</code></pre>
| c# c++ | [0, 6] |
3,977,922 | 3,977,923 | Hide button when i submit using jquery | <p>I use 4 buttons in my script when i click any one of the button other three buttons should be hidden. Can anyone suggest me to work out this in jquery or javascript?</p>
<p>Thanks in advance.</p>
| javascript jquery | [3, 5] |
2,656,643 | 2,656,644 | Can I wrap a javascript event in a jQuery event? | <p>I have this code:</p>
<pre><code><html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('a.one').click(function(event){
event.preventDefault();
});
});
function test(event){
event.preventDefault();
}
</script>
<style type="text/css">
a.test { font-weight: bold; }
body { font-family:sans-serif; background-color:#AAAAAA;}
</style>
</head>
<body>
<a class="one" href="http://jquery.com/">jQuery</a>
<br/>
<a class="two" href="http://stackoverflow.com/" onclick='test(event)'>stack overflow</a>
</body>
</html>
</code></pre>
<p>The test-function does not work as it stands now, since a regular javascript event doesn't support the jQuery event preventDefault-function. Is there some way to wrap a regular javascript event in a jQuery event so that I can use e.g. preventDefault?</p>
| javascript jquery | [3, 5] |
2,075,322 | 2,075,323 | Expertise in C#,java | <p>I am a novice in c#,java and i want to become Professional in both in 2 to 4 weeks.Can anyone please specify me the correct and exact way of achieving my goal.By exact way i mean,what practices to follow,what books to follow,what all available online resources best for me and what all projects to work on from novice to professional </p>
| c# java | [0, 1] |
779,162 | 779,163 | Retain url hash value using Request.UrlReferrer | <p>I have an list of paged results that is using AJAX requests to populate next/previous page clicks. I am using the jQuery history plugin to keep track of the page # the user is on. This basically appends <a href="http://site.com?query#pg=5" rel="nofollow">http://site.com?query#pg=5</a> to the url. </p>
<p>If I click through to another page, I am trying to implement a Go Back button in the breadcrumb control. In trying to use:</p>
<pre><code>Request.UrlReferrer
</code></pre>
<p>it seems that this does not preserve the # value at all. Is this possible?</p>
| c# asp.net jquery | [0, 9, 5] |
4,108,465 | 4,108,466 | Stop executing JavaScript | <p>I have:</p>
<pre><code>$('body').data('data1', '<script type="text/javascript">console.debug('execute');</script><div>example</div>');
</code></pre>
<p>and:</p>
<pre><code><div id="content"></div>
</code></pre>
<p>when I do:</p>
<pre><code>$(document).ready(function () {
$('#content').html($('body').data('data1'));
});
</code></pre>
<p>then JavaScript is executed. How to prevent executing? Is it possible?</p>
| javascript jquery | [3, 5] |
4,463,669 | 4,463,670 | Problem in exporting Chart to excel | <p>I have dynamically created table in which some data rows and one MS Chart is there.
How can I send that table to excel including chart .</p>
<p>I am using the fallowing code to export but it unable to render chart.</p>
<pre><code> protected void btnGetExcelReport_Click(object sender, EventArgs e)
{
Table tblDealsRep = new Table();
tblDealsRep = (Table)Session["tblReport"];
if (tblDealsRep.Rows.Count > 0)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=LeadsReport.xls");
Response.ContentType = "application/ms-excel";
string k = GetGridViewHtml(tblDealsRep);
Response.Write(k);
Response.End();
}
}
public string GetGridViewHtml(Control c)
{
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
c.RenderControl(hw);
return sw.ToString();
}
</code></pre>
| c# asp.net | [0, 9] |
3,931,297 | 3,931,298 | C# .net and ASP -- Need to know how to call the url string from C# code and place it in asp code? | <p>Here is what I have but it's not working.</p>
<p>So instead of having Web Site I would like it to show the actual address coming from the database that's stored in lblWebSite.NavigateUrl</p>
<p>I tried changing it to lblWebSite.Text but that showed the web address, but did not act as a link. Any help would be appreciated. Thanks.</p>
<p>ASP CODE:</p>
<pre><code><asp:HyperLink ID="lblWebSite" runat="server" Target="_blank">Web Site</asp:HyperLink></span>
</code></pre>
<p>C# CODE:</p>
<pre><code>this.lblWebSite.NavigateUrl = dvInfo.Table.Rows[0]["Uri"].ToString();
</code></pre>
| c# asp.net | [0, 9] |
5,019,609 | 5,019,610 | A very basic JavaScript question about the document.write function | <p>I'm new to JavaScript as well as jQuery. This is the only code I have on an otherwise blank page:</p>
<pre><code><script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
document.write('Hello World');
});
</script>
</code></pre>
<p>When I load the page in a browser (using FireFox) the status icon as well as the favicon area of the opened tab shows loading symbols, as if to indicate that the document.write function is being executed continuously in a loop.</p>
<p>Why is this? I'm merely trying to say "once the page is ready output to the screen the string Hello World ONCE". What's wrong here?</p>
<p>p.s. I noticed if I take out the document.ready portion of the code there is no loop. Not sure why the event ready handler is causing this issue.</p>
| javascript jquery | [3, 5] |
4,331,237 | 4,331,238 | How to open a page in new tab when user clicks ctrl key + link button? | <p>I have this code which opens new page in different tab.</p>
<pre><code> protected void facebook_Click(object sender, ImageClickEventArgs e)
{
myurl = "http://www.facebook.com";
string newWin = "window.open('" + myurl + "');";
ClientScript.RegisterStartupScript(this.GetType(), "pop", newWin, true);
}
</code></pre>
<p>But when i press ctrl key from key board and click link button then new tab is opened but in URL </p>
<blockquote>
<p>javascript:__doPostBack('LinkButton2','') displays. and page is empty.</p>
</blockquote>
<p>but i want to display facebook.com in new tab.</p>
| c# asp.net | [0, 9] |
5,828,490 | 5,828,491 | How to sort the date column in gridview? | <p>I am using ASP.NET and C#.This is my code.</p>
<pre><code> private const string ASCENDING = "ASC";
private const string DESCENDING = "DESC";
public SortDirection GridViewSortDirection
{
get
{
if (ViewState["sortDirection"] == null)
ViewState["sortDirection"] = SortDirection.Ascending;
return (SortDirection) ViewState["sortDirection"];
}
set { ViewState["sortDirection"] = value; }
}
public string SortExpression
{
get
{
if (ViewState["sortExpression"] == null)
ViewState["sortExpression"] = "JobNumber";
return ViewState["sortExpression"] as string;
}
set { ViewState["sortExpression"] = value; }
}
protected void OnSorting(object sender, GridViewSortEventArgs e)
{
SortExpression = e.SortExpression;
if (GridViewSortDirection == SortDirection.Ascending)
{
GridViewSortDirection = SortDirection.Descending;
}
else
{
GridViewSortDirection = SortDirection.Ascending;
}
BindGrid();
}
</code></pre>
<p>I am applying sorting for all the columns and working fine. But with date column it is like in this order(dd/mm/yyyy).</p>
<ul>
<li>30/11/2012</li>
<li>10/12/2012</li>
<li><p>9/10/2012</p>
<pre><code><asp:BoundField DataField="ReportedDate" HeaderText="Reported Date" SortExpression="ReportedDate" DataFormatString="{0:DD/MM/YYYY}" HtmlEncode="false" />
</code></pre></li>
</ul>
<p>the datatype of this column is date.</p>
<p>How to do this?Am i doing wrong?</p>
| c# asp.net | [0, 9] |
2,812,666 | 2,812,667 | How to check an object for null values | <p>I am using an object type variable to store a query result for binding to a drop down list. I do not want further processing on an object if it is <code>null</code>.</p>
<p>My code is :</p>
<pre><code>object course;
if (GetWebsiteCurrentMode().ToLower() == "demo")
{
course = from t in context.CourseTestDetails
join c in context.Courses
on t.CourseID equals c.ID
where t.UserID == UserID && c.IsDeleted == true
select new
{
c.ID,
c.CourseName
};
}
else
{
course = from t in context.CourseTestDetails
join c in context.Courses
on t.CourseID equals c.ID
where t.UserID == UserID c.IsDeleted == false
select new
{
c.ID,
c.CourseName
}
}
if(course !=null )
{
ddlCourseName.DataSource = course;
ddlCourseName.DataBind();
ddlCourseName.Items.Insert(0, new ListItem("Select Course Name", "0"));
ddlCourseName.SelectedValue = "0";
}
else
{
//do something different
}
</code></pre>
<p>How can I check object type variable for null/empty?</p>
| c# asp.net | [0, 9] |
843,822 | 843,823 | what are the advanteges and disadvanteges of PHP,ASP.NET and JAVA for developing a datacentric application? | <p>this question is related to my previous question </p>
<p><a href="http://stackoverflow.com/questions/3334580/siutable-tool-and-technology-for-electronic-health-system">http://stackoverflow.com/questions/3334580/siutable-tool-and-technology-for-electronic-health-system</a></p>
<p>i need the comparison and expert opinion in this aspect.</p>
<p>thanx in advance. </p>
| java php asp.net | [1, 2, 9] |
3,285,842 | 3,285,843 | how to remove ".mp3" from "xxx.mp3" string | <p>i want to make a music player, i have a problem to toast file name because it always includes the extension(".mp3")</p>
<p>does anyone know how to remove those extension?</p>
<p>this is my code</p>
<pre><code>try {
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.reset();
}
mMediaPlayer.setDataSource(filename);
mMediaPlayer.prepare();
mMediaPlayer.start();
Toast.makeText(getApplicationContext(), nama , Toast.LENGTH_LONG).show();
} catch (Exception e) {
}
</code></pre>
<p>and </p>
<pre><code>music_column_index=
musiccursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DISPLAY_NAME);
musiccursor.moveToPosition(position);
nama = musiccursor.getString(music_column_index);
</code></pre>
<p>i want to make it toast "xx" not "xx.mp3"</p>
| java android | [1, 4] |
1,882,925 | 1,882,926 | Is using ObjectDataSource a good practice? | <p>In my company few of the employees are using ObjectDataSource. Example snippet is :</p>
<pre><code><asp:ObjectDataSource ID="odsRequirement" runat="server" EnablePaging="True"
MaximumRowsParameterName="intMaxRows"
SelectMethod="GetAll"
StartRowIndexParameterName="intRowIndex"
TypeName="MyNamespace.MyType"
SortParameterName="SortString"
OnSelecting="odsRequirement_Selecting"
SelectCountMethod="GetAllCount">
<SelectParameters>
<asp:Parameter Name="A" DefaultValue="null" />
<asp:Parameter Name="B" DefaultValue="null" />
<asp:Parameter Name="C" />
<asp:Parameter Name="D" />
<asp:Parameter Name="E" />
</SelectParameters>
</asp:ObjectDataSource>
</code></pre>
<p>Will the SelectCountMethod <strong>GetAllCount</strong> be always fired after the SelectMethod <strong>GetAll</strong>? And is there a better way we should be doing this?</p>
<p>Thanks in advance:)</p>
| c# asp.net | [0, 9] |
3,260,568 | 3,260,569 | How to detect 404 error in a url then set the url image to display:none using Jquery | <p>I have a table which repeats an image link to a file download for every row of data. I want to use Jquery or Javascript to detect if a image link returns a 404 error, meaning the file its trying to find doesn’t exist, then set the image link to <strong>display:none</strong> so its hidden.</p>
<p>Any help is much appreciated!</p>
<p>Jamie.</p>
<p>---Edit---</p>
<p>This is my url which needs to be set to hidden if it cant find the .igs file</p>
<p><code><a href="/path/to/file.igs"><img src="pic.jpg" alt="My Image Link"></a></code> </p>
<p>Unfortunately I cannot utilize server-side processing.</p>
| javascript jquery | [3, 5] |
2,133,867 | 2,133,868 | jQuery - Post and reply | <p>Im attempting to add voteup/votedown to one of my sites, however Im having a few problems:</p>
<p>Firstly here is my jQuery:</p>
<pre><code>j(".voteup").click(function(){ // when people click an up button
j("div#response").show().html('<h2>voting, please wait...</h2>'); // show wait message
itemID = j(this).parent('div').attr('id');; // get post id
alert(itemID);
j.post(voteup.php,{id:itemID},function(response){ // post to up script
j("div#response").html(response).hide(3000); // show response
});
j(this).attr({"disabled":"disabled"}); // disable button
});
</code></pre>
<p>My voteup.php file is:</p>
<pre><code><?php
$id=$_POST['itemID'];
echo '<h2>PHP Response: You voted post '.$id.' up</h2>';
?>
</code></pre>
<p>However It doesnt appear to be working, the alert comes through with the post ID but nothing from then on. The $id doesnt get echo'd.</p>
<p>Any ideas?</p>
| php jquery | [2, 5] |
2,700,158 | 2,700,159 | Android Java code is not doing math correctly | <p>I am having a very odd result in my Android program when adding two numbers. It is the test code I am using to find out what is going out:</p>
<pre><code>private static final float yChannel[] = {12.0f, 8.0f, 4.0f, 0};
protected void onCreate(Bundle savedInstanceState) {
Log.i("Rectangles","y1: " + yChannel[0]+2.0f);
Log.i("Rectangles","y2: " + yChannel[0]);
}
</code></pre>
<p>The LogCat result is:</p>
<pre><code>y1: 12.02.0
y2: 12
</code></pre>
<p>I simply don't understand all the variables are float. My code is not working because it is not giving the correct result. I also tried cleaning Eclipse project.</p>
| java android | [1, 4] |
4,679,407 | 4,679,408 | send array using jquery | <p>i have a variable $visitRecord->getReferallist() which get the list of doctors in an array . i need to send the array to a php file and do foreach action in php file.. how do i send this array variable in the jquery . This code did not work.</p>
<pre><code> function seekOpinion()
{
var queryUrl = "<?php echo $this->url(array('controller' => 'consultant', 'action' =>'opiniondoclist'));?>";
$.post(queryUrl,{referal:'<?php echo $gotreferal; ?>',visitId:'<?php echo $gotvisitId; ?>',referalList:'<?php echo $visitRecord->getReferallist(); ?>'},function(data)
{
$('.opiniondoclistData').html(data);
});
document.getElementById('opiniondoclistDiv').style.display = "";
}
</code></pre>
| php jquery | [2, 5] |
5,317,213 | 5,317,214 | auto time increment like on facebook (jquery) | <p>Okay , im want to make something like facebook's auto time increment for posts and notificaitons etc.
when the post arrived for example , 5 seconds ago.</p>
<p>How do i use jQuery to make it auto increase without having to parse server for timeago.</p>
<p>It can increase till hours and days.</p>
<p>I have found a script , and tried modifying it , but its not working:
<a href="http://stackoverflow.com/questions/7280795/any-jquery-plugin-which-automatic-update-time-for-all-the-posts-of-a-page">Any jquery plugin which automatic update time for all the posts of a page</a></p>
<pre><code>$.fn.UpdateSince = function(interval) {
var times = this.map(function(){ return { e: $(this), t: parseInt($(this).html()) }; });
var format = function(t) {
if (t > 60) {
return Math.floor(t / 60) + ' minutes ago'
} else if(t > 3600){
return Math.floor(t / 3600) + ' hours ago'
} else if(t > 86400){
return Math.floor(t / 86400) + ' days ago'
} else {
return t + ' seconds ago';
}
}
var update = function(){
$.each(times, function(i, o){
o.e.html(format(Math.round((o.t + 1000))));
});
};
window.setInterval(update, interval);
update();
return this;
}
$('.TimeSince').UpdateSince(1000);
</code></pre>
| javascript jquery | [3, 5] |
3,494,533 | 3,494,534 | Padding Menu By JQuery | <p>I want to design a menu that when I hover a link , the link pushed forward and when I move the mouse out of that , the link moves backward.</p>
<p>I know I can done that with .hover function.I don't want to use jQuery Events. I want to use just javascript events that they are embed in html tags.</p>
<p>here is my attempt:</p>
<pre><code> <script type="text/javascript">
function MIn()
{
jQuery(this).animate({paddingLeft:"20px"},500);
}
function MOut()
{
jQuery(this).animate({paddingLeft:"0px"},500);
}
</script>
</head>
<body>
<ul>
<li onmouseover = "MIn()" onmouseout="MOut()" ><a href="#">Home</a></li>
<li onmouseover = "MIn()" onmouseout="MOut()"><a href="#">Download</a></li>
<li onmouseover = "MIn()" onmouseout="MOut()"><a href="#">Products</a></li>
<li onmouseover = "MIn()" onmouseout="MOut()"> <a href="#">Register</a></li>
<li onmouseover = "MIn()" onmouseout="MOut()"><a href="#">About</a></li>
<li onmouseover = "MIn()" onmouseout="MOut()"><a href="#">Contact</a></li>
</ul>
</body>
</code></pre>
| javascript jquery | [3, 5] |
2,726,138 | 2,726,139 | How to disable the scrollbars is width and height of body bigger than 1000px and 600px? | <p>Preferably with just javascript. But if that's too hard, jquery will be ok (I don't want to load jquery because the page has to load really fast).</p>
| javascript jquery | [3, 5] |
2,173,027 | 2,173,028 | FreeTextBox Editor stop working after jquery post method | <p>Thanks in advance.</p>
<p>I am using FreeTextBox editor in asp.net web application.This editor works fine.</p>
<p>And i use jquery Post method to populate editor and other form fields' with values fetched from database. After successful post i replace the Html with updated content. All the fields gets populated but editor is not populated with value set in Post hit and it even stops working after Post hit.</p>
<p>Please provide any solution.</p>
| jquery asp.net | [5, 9] |
5,922,171 | 5,922,172 | I want to truncate a text or line with DOTS using JavaScript but that start and end of string is visible (like dropbox.com does) | <p>I would like to truncate a text or line with DOTS using JavaScript <strong>but</strong> I need to display the end (filename after slash) and start. Something like dropbox.com does on their website. </p>
<p>I'm looking for jQuery extension or something similar. </p>
| javascript jquery | [3, 5] |
5,244,297 | 5,244,298 | jQuery.children selects parent too | <p>I have the following HTML;</p>
<pre><code><div id="pic_options_container">
<div id="pic_options_header">header text</div>
<div id="pic_options_org"></div>
<div id="pic_options_preview"><img id="imgPreview" src="" /></div></div>
<div style="clear:both;"></div>
</div>
</code></pre>
<p>What I am trying to achieve is; When clicked on pic_options_container the children of that div should hide. However, pic_options_container itself also gets hidden.</p>
<pre><code>$('#pic_options_container').click(function () {
$(this).children().hide();
});
</code></pre>
<p>Anyone know of a solution or tell me what I'm doing wrong?</p>
| javascript jquery | [3, 5] |
2,536,118 | 2,536,119 | Farbtastic jQuery Color Picker Callback Issues | <p>I'm trying to play around with the Farbtastic: <a href="http://acko.net/dev/farbtastic" rel="nofollow">http://acko.net/dev/farbtastic</a> color picker plugin but I'm having some issues.</p>
<p>I want to setup a callback function so that I can change the bg color like so:</p>
<pre><code> $('#picker').farbtastic(function(){
$("body").css("background-color",$.farbtastic('#picker').color);
});
</code></pre>
<p>This works fine, but by doing this, the input field no longer updates the hex value in real time.</p>
<p>How can I make it so the hex value within the input field AND the body background color update both at the same time?</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
5,430,308 | 5,430,309 | jQuery script references | <p>when I write this code:</p>
<pre><code><script type="text/javascript">
function showhide(master, detail) {
var src = $(master).children()[0].src;
if (src.endsWith("plus.png"))
src = src.replace('plus.png', 'minus.png');
else
src = src.replace('minus.png', 'plus.png');
$(master).children()[0].src = src;
$(detail).slideToggle("normal");
}
</script>
</code></pre>
<p>and reference jQuery library in ScriptManager:</p>
<pre><code><asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/scripts/jquery-1.4.1.min.js" ScriptMode="Release" />
</Scripts>
</asp:ScriptManager>
</code></pre>
<p>every thing is ok.but when I commnet above code and reference jQuery In head part:</p>
<pre><code><script src="scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
</code></pre>
<p>debugger alert me that for <code>endsWith</code> : <code>Object doesn't support this property or method</code></p>
<p>why asp.net has this behaivior?</p>
<p>thanks</p>
| jquery asp.net | [5, 9] |
1,292,962 | 1,292,963 | Jquery How to activate div show/hide | <p>I'm pretty new to Jquery and Javascript and was am working on a project that I am sure has a much simpler way of coming to the same functionality. The following is a simplified version of what I am doing:</p>
<p><strong>HTML</strong></p>
<pre><code><a class="link1" href="#">Link 1</a>
<a class="link2" href="#">Link 2</a>
<a class="link3" href="#">Link 3</a>
<div id="div1" style="display: hidden;">Content</div>
<div id="div2" style="display: hidden;">Content</div>
<div id="div3" style="display: hidden;">Content</div>
</code></pre>
<p><strong>Jquery</strong></p>
<pre><code>$(".link1").click(function(){
$("#div2, #div3").hide();
$("#div1").show();
$(".link2, .link3").removeClass("active");
$(".link1").addClass("active");
});
$(".link2").click(function(){
$("#div1, #div3").hide();
$("#div2").show();
$(".link1, .link3").removeClass("active");
$(".link2").addClass("active");
});
$(".link3").click(function(){
$("#div1, #div2").hide();
$("#div3").show();
$(".link1, .link2").removeClass("active");
$(".link3").addClass("active");
});
</code></pre>
<p>So basically each link is immediately hiding both non-corresponding divs, even if they are not necessarily visible and also removes the active class on the other links even if they are not applied (to ensure that they are removed) then shows the corresponding div and adds an active class to the link. I am wondering if there is an easier way to create this functionality without having to hide all other divs and remove all active classes to ensure that nothing but the one I want visible is showing.</p>
<p>Thanks so much for any help you can provide!! </p>
| javascript jquery | [3, 5] |
765,347 | 765,348 | Passing password in session | <p>I am trying to set the password <code>textbox</code> back to the text entered before a <code>checkbox</code> is and has <code>AutuoPostback</code>.</p>
<pre><code>Session["passwordText"] = txt_Password.Text;
</code></pre>
<p>This is on my pageLoad and then I have tried to add(below) in my <code>CheckedChanged</code> but it says Method <code>Add</code> has 2 parameters and is invoked with 1 argument? What should i include with <code>passWord</code>.</p>
<pre><code>var passWord = Session["passwordText"].ToString();
txt_Password.Attributes.Add(passWord);
</code></pre>
| c# asp.net | [0, 9] |
790,814 | 790,815 | Jquery user control | <p>I have a problem with jquery not loaded in an asp user control.</p>
<p>I want simply to add the click event when a checkbox is clicked.</p>
<p>Here is my javascript file </p>
<pre><code>$(document).ready(function() {
var arr = jQuery(":checkbox[id*='drpAccountType']");
for (i = 0; i < arr.length; i += 1) {
$("#" + arr[i].id).click(function() { alert(this.id) });
}
});
if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
</code></pre>
<p>The user control pre render events:</p>
<pre><code>Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
ScriptManager.RegisterClientScriptInclude(Me, Me.GetType, "CheckboxdropdownScript", ResolveUrl("~/Scripts/CheckBoxDropDown.js"))
End Sub
</code></pre>
<p>the script is loaded fine but any usage of jQuery return undefined. Then only when the page is loaded I can excute the same code for the commande line in firebug. The jquery library is loaded in the master page.</p>
<p>Whenever I'm using jquery within an asp user control I always find problems, and I always have to hack around to get it to work. I try all the entries in stackoverflow but I never found a one as general solution.</p>
<p>did any one found a simple solution to use jquery with master pages, user control in asp.net
I would appreciate if someone can share such valuable information.</p>
<p>My manager is about to drop jquery from the application as we always waist lot of time just to find a workaround to have it to work with user controls.</p>
<p>Please help, I like jquery and I really want to use it for client script.</p>
<p>best regards</p>
| asp.net jquery | [9, 5] |
1,872,611 | 1,872,612 | make a pop-up window in php | <p>Hi I am having trouble with this piece of php code, right now it just showing a list of fields.
how do I make this a pop-up window in php?
I tried inserting javascript, but php+javascript together really confused me. thanks so much for the help!!!</p>
<pre><code>$output .= '
<div class="item-list">
<ul><li class="first">
<a target="_blank" href="/drupall/user/register" title="Create a new user account.">Create new account</a></li>
<li class="last">
<a href="/drupall/user/password" title="Request new password via e-mail.">Request new password</a></li>';
</code></pre>
| php javascript | [2, 3] |
3,565,242 | 3,565,243 | Is it possible to have the menu link color change on the table hover for an asp.net menu control? | <p>I'm using an ASP.net menu and when i hover inside my menu item's table, i change the background color on the table column, but unless i hover over the link text itself, the link text color will not change.</p>
<p>Is it possible to have the link text color changed on the table hover?</p>
<p>Example below shows what happens.</p>
<p><img src="http://i.stack.imgur.com/r5AoI.jpg" alt="example of issue"></p>
<p>Excuse the ugly CSS:</p>
<pre><code>.TopStaticSelectedStyle
{
cursor: pointer;
font-size: 11px;
font-family: Verdana;
}
.TopStaticMenuStyle a,
.TopStaticMenuStyle a:visited,
.TopStaticMenuStyle a:active
{
color: #ffffff;
text-decoration: none;
font-weight: bold;
font-family: Verdana;
}
.TopStaticMenuStyle a:hover
{
color: #000000;
text-decoration: none;
font-size: 11px;
font-weight: bold;
font-family: Verdana;
}
.TopStaticMenuItemStyle td
{
padding: 0px 12px 0px 12px;
text-align: center;
background-color: #6c85b0;
height: 18px;
border-top: solid 1px #012754;
border-bottom: solid 1px #012754;
border-left: solid 1px #012754;
border-collapse:collapse;
}
.TopStaticHoverStyle
{
font-weight: normal;
font-family: Verdana;
}
.TopStaticHoverStyle td
{
padding: 0px 12px 0px 12px;
text-align: center;
background-color: #ffffff;
height: 18px;
border-top: solid 1px #012754;
border-bottom: solid 1px #012754;
border-left: solid 1px #012754;
border-collapse:collapse;
color: #000000;
}
</code></pre>
| c# asp.net | [0, 9] |
3,985,160 | 3,985,161 | pageload in c# | <p>Here is a piece of code that I've written. The problem that I'm having is:
When i click a button in the gridview "rowcommand" adds the item to an arraylist which works fine.
After the user clicks the button the page loads again and it goes to "rowcommand" AGAIN! As a result the same value is added to the arraylist.</p>
<p>Is this something regarding postback? if it's I dont think I've understood it clearly enough! what seems to be wrong here?</p>
<p>//edit 2: entire code block</p>
<pre><code>public partial class Action_k : System.Web.UI.Page
{
ArrayList array;
ArrayList tmpArrayList = new ArrayList();
string itemIDs = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
if (Session["username"] == null)
{
Session["anonuser"] = "anon";
Label1.Text = "";
userLabel.Text = "";
ImageButton1.ImageUrl = "~/images/logink.gif";
ImageButton1.PostBackUrl = "~/Login_k.aspx";
}
else
{
userLabel.Text = Session["username"].ToString();
Label1.Text = "Your logged in as: ";
ImageButton1.ImageUrl = "~/images/logoutk.gif";
}
if (Session["array"] == null)
{
array = new ArrayList();
Session.Add("array", array);
}
}
array = Session["array"] as ArrayList;
}
public void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "AddToCart")
{
int index = Convert.ToInt32(e.CommandArgument);
string items = GridView2.DataKeys[index].Value.ToString();
array.Add(items);
Response.Redirect("ShoppingCart_k.aspx?itemID=" + items);
}
}
}
</code></pre>
<p>Thanks,</p>
| c# asp.net | [0, 9] |
206,913 | 206,914 | Fire up ajax request when some inputs has changed | <p>I have the following inputs:</p>
<pre><code> <input class="input-text" type="text" name="nombres" id="nombres" />
<input class="input-text" type="text" name="apellidoP" id="apellidoP" />
<input class="input-text" type="text" name="apellidoM" id="apellidoM" />
<input class="input-text" type="text" name="nacimiento" id="nacimiento" />
</code></pre>
<p>I want to make an ajax request when the "nombres" and "nacimiento" inputs has changed and are not empty, and when "apellidoP" or "apellidoM" also has changed and are not empty. </p>
<p>How can I do that with jQuery? The only solution I have in mind is to trigger "change" event of every input and check if conditions are met, do you have another solution?</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
5,360,614 | 5,360,615 | How to Execute Command/function in Asp.net Automatically To send Email / Sms Without user logged In | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7645302/doing-scheduled-background-work-in-asp-net">doing scheduled background work in asp.net</a> </p>
</blockquote>
<p>I want To Send Email/SMS To my user Automatically in Asp.net C#, even they are not logged In.</p>
<p>I want To do : On Birthday Of User Automatically send Email/Sms To Users To say Happy Birthday. </p>
<p>Example of running site: Way2SmS.com send User Sms automatically on Their Birthday Also Way2Sms send SMS automatically When user set it to send(user provide date & time).</p>
<p>Can You please help me regarding this.?</p>
<p>Is any possibilities of doing this.?</p>
<p>If yes please provide me some code or link or details. :)</p>
| c# asp.net | [0, 9] |
252,229 | 252,230 | Inline script conditional statement inside a ListView | <p>I'm trying to display an image inside a ListView control based on the value of a databound property. I've tried two methods of doing this (one at a time) and both returned errors of "The server tag is not well formed". Consider the code below.</p>
<pre><code><ItemTemplate>
<div class="left">
<!-- Method 1 -->
<img src="media-play-button.png" alt="Play" class="mediaplay noborder" runat="server" visible="<%# Eval("MediaType").ToString() == "video" %>" />
<!-- Method 2 -->
<%# if (((MediaLink)Container.DataItem).MediaType == "video") { %>
<img src="media-play-button.png" alt="Play" class="mediaplay noborder" />
<%# } %>
</div>
</ItemTemplate>
</code></pre>
| c# asp.net | [0, 9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.