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 |
---|---|---|---|---|---|
4,083,879 | 4,083,880 | jQuery: Why is by box collapsing on first click | <p>The homepage of our website (legendboats.com) is 4 small cells, that if you click on, the large image changes. Pretty standard stuff, but there is a problem.</p>
<p>When you click on one of them the first time, the large area collapses before the new image reappears. This doesn't happen again, you can continue to click on different images, and they will fade in and out properly. Here is the code I'm using:</p>
<pre><code>$('.home_boxes a.content_box').on('click', function(e) {
e.preventDefault();
var new_slide = this.hash;
$('#home_box div.active').fadeOut(function() {
$('#home_box ' + new_slide).fadeIn().addClass('active');
}).removeClass('active');
});
</code></pre>
<p>Any ideas on what I'm doing wrong, or any improvements? </p>
| javascript jquery | [3, 5] |
3,128,662 | 3,128,663 | The variable name '@VarName' has already been declared Issue | <p>I am inserting multiple items into table based on a selection from drop down list. When I select one item from the drop down then everything works fine but when I select multiple items then I get this error</p>
<pre><code>The variable name '@CompName' has already been declared. Variable names must be unique within a query batch or stored procedure.
</code></pre>
<p>what am i doing wrong? thanks
here is my code</p>
<pre><code>protected void DV_Test_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
foreach (ListItem listItem in cblCustomerList.Items)
{
if (listItem.Selected)
{
string Name= listItem.Value;
sqlcon.Open();
string CompName= ((TextBox)DV_Test.FindControl("txtCompName")).Text.ToString();
string Num = ((TextBox)DV_Test.FindControl("txtNum")).Text.ToString();
SqlCommand cmd = new SqlCommand("select CompNamefrom MyTable where CompName= '" + CompName+ "' and Num = '" + Num + "' and Name= '" + Name+ "' ", sqlcon);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
lblmsg.Text = "Not Valid";
}
else
{
dr.Close();
sqlcmd.CommandText = "INSERT INTO MyTable(CompName, Num, Name) VALUES(@CompName, @Num, @Name)";
sqlcmd.Parameters.Add("@CompName", SqlDbType.VarChar).Value = CompName;
sqlcmd.Parameters.Add("@Num", SqlDbType.VarChar).Value = Num;
sqlcmd.Connection = sqlcon;
sqlcmd.ExecuteNonQuery();
DV_Test.ChangeMode(DetailsViewMode.Insert);
sqlcon.Close();
}
sqlcon.Close();
}
}
}
</code></pre>
| c# asp.net | [0, 9] |
5,066,375 | 5,066,376 | Why doesnt 'ListBox1_SelectedIndexChanged' even occur when i select item from the list? | <p>I wrote code in C# for ASP.Net website , but when i select one item from the list above even doesn't occur and the execution goes back to Site.Master. I have to put a button to fetch the item from the list, how can i make that even occur when i select the item from list?</p>
| c# asp.net | [0, 9] |
1,015,732 | 1,015,733 | Xml Serializer in java | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6107627/what-is-java-alternative-for-nets-xmlserializer">What is Java alternative for .NET’s XmlSerializer</a> </p>
</blockquote>
<p>What does the <code>XmlSerializer</code> class exactly do in c# and how can I use the same functionality in java? </p>
<p>The following is just a part of code in c# (is it possible to have this method in java?)</p>
<pre><code>public static List<PinglishString> LoadPinglishStrings(string filePath)
{
var serializer = new XmlSerializer(typeof(List<ListOfString>));
TextReader stream = null;
try
{
stream = new StreamReader(File.Open(filePath, FileMode.Open, FileAccess.Read), Encoding.UTF8);
List<ListOfString> list = serializer.Deserialize(stream) as List<ListOfString> ?? new List<ListOfString>();
return list;
}
finally
{
if (stream != null)
stream.Close();
}
}
</code></pre>
| c# java | [0, 1] |
1,799,661 | 1,799,662 | Store a bunch of inputs on page into a javascript array? | <p>I have a bunch of inputs on a page, ie:</p>
<pre><code><input name="user[name]" />
<input name="user[phone]" />
<input name="user[email]" />
</code></pre>
<p>And what I'd like to do, is on submitting the form is grab all those variables of the user array and store them in a javascript array.</p>
<p>Ie, I would think something like this would work:</p>
<pre><code>$('submit').click(function(e){
e.preventDefault;
$.each($('input[name=user*') as var) {
var user[] = this.input value etc;
}
});
</code></pre>
<p>But thats because I don't know much about javascript arrays.</p>
<p>How is this sort of thing achieved?</p>
| javascript jquery | [3, 5] |
4,040,617 | 4,040,618 | How to close a tab from code behind? | <p>I want to close current tab from code behind as i want to perform some operation so after performing some operation it should be closed so please help me.. thanks in advance.</p>
<p>I tried it with</p>
<pre><code>function close_window() {
if (confirm("Close Window?")) {
close();
}
}
</code></pre>
<p>but not able to call this method from code behind.</p>
| c# javascript asp.net | [0, 3, 9] |
4,996,453 | 4,996,454 | Javascript alert test not working | <p>I should be sleeping but this is really bugging me. I can't get a simple javascript alert box to display in my asp.net project. Hopefully someone can see what I'm doing wrong. My test page is this:</p>
<pre><code><%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="JSTest.aspx.cs" Inherits="Proj.JSTest" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Header" runat="server">
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript" language="javascript" >
$(document).ready(function() {
alert("Working");
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Main" runat="server">
</asp:Content>
</code></pre>
<p>The masterpage is pretty standard as well. Here's the header part of it (which I figure is the key bit)</p>
<pre><code><head runat="server">
<title></title>
<%--<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script> --%>
<link href="App_Themes/Default/Default.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="Header" runat="server">
</asp:ContentPlaceHolder>
</head>
</code></pre>
<p>I know I must be missing something obvious - probably just need sleep :D. But if anyone can see why this isn't working, that would be great!</p>
<p>Thanks!</p>
| asp.net javascript jquery | [9, 3, 5] |
1,385,305 | 1,385,306 | How to compare the rows in a datatable and manipulate itto show in a particular format in C#/asp.net | <p>I have a data in data table with say 4 columns.Out of those 10 columns first column contains the date.The data in the table is in the form :
I/p</p>
<pre><code>"15/12/2010",username,24,No
"16/12/2010",username,24,No
"17/12/2010",username,24,No
"18/12/2010",username,24,No
"19/12/2010",username,24,No
"20/12/2010",username,25,No
"21/12/2010",username,24,yes
"22/12/2010",username,24,No
"23/12/2010",username,24,No
"24/12/2010",username,24,No
"25/12/2010",username,24,No
"26/12/2010",Prakhar,24,No
"27/12/2010",username,24,No
"28/12/2010",username,24,No
</code></pre>
<p>We have to bind the o/p with the repeater.
For aforemenioned i/p the output should be :</p>
<pre><code>O/P
"15/12/2010 - 20/12/2010",username,24,No
"21/12/2010 - 21/12/2010",username,24,Yes
"22/12/2010 - 25/12/2010",username,24,no
"26/12/2010 - 26/12/2010",username,24,no
"27/12/2010 - 28/12/2010",username,24,no
</code></pre>
<p>I.e. we are clubbing all the dates whose corresponsing column values are matching.
We have to write a c# code for it.</p>
| c# asp.net | [0, 9] |
3,906,597 | 3,906,598 | Getting an element as jQuery object from a set of elements | <p>Is there a way to get an element from a jQuery object, but <em>as</em> jQuery object?</p>
<p>If I wanted to get the text of elements, presently I'd write it like this:</p>
<pre><code>var elements = $(".set");
for (var idx=0; idx<elements.size(); idx++) {
var text = $(elements.get(idx)).text();
// do something with text
}
</code></pre>
<p>Note that I have to wrap <code>elements.get(idx)</code> in another jQuery call <code>$()</code>.</p>
<p>I realize this isn't that big a deal, I just want to make sure I'm not doing extra work if there is an easier way.</p>
| javascript jquery | [3, 5] |
640,113 | 640,114 | Is it possible to select a custom list view item with its list item id instead of list item position in android? | <p>Is it possible to get the list item's id instead of getting the list item through its position? because the problem i face is: I use custom listview. I sort the list items on button click. After the list items are sorted in new order, if i click first item, the list item selected of the original item before sorting. also i use database to fetch the list item click. I match the database id with the list item position selected. How to solve it? any help is highly appreciated and thanks in advance...</p>
| java android | [1, 4] |
2,851,513 | 2,851,514 | select specific tr and specific td within selected tr | <p>I have been able to select the specific rows that I wanted but I can't select specific td from those tr.</p>
<p>I used this to select rows:</p>
<pre><code>$('#time-slot tr:not(:first, :last)')
</code></pre>
<p>then within those selected rows I was trying to ignore the first and the last td but it is not working. I used similar approach as above</p>
<pre><code>$('#time-slot tr:not(:first, :last) td:not(:first, :last)')
</code></pre>
<p>Any ideas how should I approach this problem. Btw I am trying to click and drag the mouse to paint the cells with user defined color.</p>
| javascript jquery | [3, 5] |
3,650,921 | 3,650,922 | Single Instance Login Implementation | <p>I am facing a serious problem in my project (a web application built in ASP.NET 2.0) explained below.</p>
<p>Let say I have given userid “singh_nirajan” and A user say “User1” logged into the system using this userid. Now my requirement is whenever other user let say User “User2” try to log in to the system using same (singh_nirajan) userid, it will show a message that “singh_nirajan already logged in”.</p>
<p>In order to implement the same, I just update a flag in database. Similarly, we update the flag in database whenever user logout properly. And we have also handled few scenarios when user will not properly log out as follows.</p>
<ol>
<li>Browser close by clicking (X) close</li>
<li>Session Timeout</li>
<li>On Error</li>
</ol>
<p>But somehow user gets logged out abruptly because of network failure, power failure or any such reason. I am not able to update the flag in database that is why user is not able to log in using same userid until and unless we update that flag manually.</p>
<p><strong>Reason for above implementation:</strong></p>
<p>Sometime a user open multiple browser and started heavy processing task in different browser, many of times they share their user id and password which sometime invite concurrency problem. In order to restrict this, we need to implement the single instance login.</p>
<p>Can any one suggest me any other approach to implement the above.</p>
<p>Thanks in advance. </p>
| c# asp.net | [0, 9] |
4,456,158 | 4,456,159 | js number +1 problem | <p>I need click <code>div.toggle1</code>,control slideup, slidedown the <code>div#text1</code>,</p>
<p>click <code>div.toggle7</code>,control slideup, slidedown the <code>div#text7</code>.</p>
<p>here is my code, also in <a href="http://jsfiddle.net/qHY8K/" rel="nofollow">http://jsfiddle.net/qHY8K/</a> my <code>number +1</code> not work, need a help. thanks.</p>
<p>html</p>
<pre><code><div class="toggle1">click</div>
<div id="text1">text1</div>
<div class="toggle7">click</div>
<div id="text7">text2</div>
</code></pre>
<p>js code</p>
<pre><code>jQuery(document).ready(function() {
counter = 0;
for(i=1;i<11;i++){
(function(i){
counter = counter +1;
$('.toggle'+counter).toggle(function(){
$('#text'+counter).css('display','none');
},
function() {
$('#text'+counter).css('display','block');
});
})(i);
};
});
</code></pre>
| javascript jquery | [3, 5] |
5,870,759 | 5,870,760 | How can i block script injection in textbox or textarea using jquery or javascript? | <p>I am having a form that contains textbox and textarea. I want to validate it to stop injection of script using textbox or textarea. I need to do it using jquery or javascript.</p>
<p>Is there any RegEx available for that or any other way to detect and stop script.</p>
| javascript jquery | [3, 5] |
3,796,861 | 3,796,862 | Passing variables in a multi-project solution | <p>I am working with a progaram called aspdotnetstorefront.
This is a shopping cart program
The solution has 7 projects in it</p>
<p>There is a file in the web project that is called checkout1.cs that has the checkout1.aspx file</p>
<p>The checkout1.aspx file has a field for state. In the solution, there is project called aspdnsfcommons which has a file called Shoppingcart.cs.</p>
<p>I have tried everything to take the value of the state textbox from web/check1.aspx and pass it to aspdnsfcommons/shoppingcart.cs</p>
<p>Please advice me of the direction I should take.</p>
| c# asp.net | [0, 9] |
4,231,907 | 4,231,908 | Formatting Eval into a currency, forcing en-US | <p>I have this line of code:</p>
<pre><code><%# Eval( "Balance", "{0:C}" )%>
</code></pre>
<p>How do I always force that to display currency in en-US regardless of what locale they have setup?</p>
| c# asp.net | [0, 9] |
518,301 | 518,302 | Create button within textbox textbox text as button name or button Id | <p>I want create button in textbox,The button should have button name as textbox value.
The button should be displayed within textbox.</p>
<p>Markup</p>
<pre><code><asp:TextBox ID="textbox1" runat="server" AutoPostBack="true" TextMode="MultiLine"
ontextchanged="textbox1_TextChanged">
</asp:TextBox>
</code></pre>
<p>Code</p>
<pre><code> protected void textbox1_TextChanged(object sender, EventArgs e)
{
Button btn = new Button();
btn.ID = textbox1.Text;
btn.Text = textbox1.Text;
textbox1.Controls.Add(btn);
}
</code></pre>
| c# javascript asp.net | [0, 3, 9] |
2,142,576 | 2,142,577 | best way to store php data on a page for use with javascript/jquery? | <p>Ok, so im trying to work out the fastest way of storing data on my page without slowing the page load:</p>
<ul>
<li>I need to store information in the
page to be later used by jquery.</li>
<li>My page is an events page and i want to
attach data to each event anchor.</li>
<li>there are 100+ events to attach data to.</li>
</ul>
<p>The events anchors are created with a php loop,
so i could create the data elements within this loop using either</p>
<ol>
<li>use un-semantic tags ie *rel="some_data"*</li>
<li>create a <em>jquery.data()</em> for each iteration of the loop</li>
</ol>
<p>or i could run the loop again, separately, this time inside script tags with jquery.data(); </p>
<p>would really appreciate any thoughts on this!</p>
| php javascript jquery | [2, 3, 5] |
2,308,281 | 2,308,282 | Create a Jquery Widget for an ASP.NET Texbox | <p>I'm trying to create a JQuery Widget that will be used on an ASP.NET Texbox to add extra html to the rendered input.</p>
<p>If I have:</p>
<pre><code><asp:TextBox ID="TestUpdate" ClientIDMode="Static" runat="server"></asp:TextBox>
</code></pre>
<p>and in a script block at the top of the page:</p>
<pre><code>$(function () {
$('#TestUpdate').Update(1234);
});
</code></pre>
<p>I'd like this to generate something like:</p>
<pre><code><input id="TestUpdate" name="ctl00$Main$Items$TestUpdate" type="text"><a href="controller/action?id=1234">Update</a>
</code></pre>
<p>Inside the widget I'll make an Ajax call but I got that covered pretty much.</p>
<p>Here's what I have so far:</p>
<pre><code>(function ($) {
$.fn.Update = function (prodID)
{
var id = this.attr('id');
var newLink = $('<a href="/Products/Test?prodID=' + prodID + '">Update</a>');
newLink.on('click', function () {
alert('TextBox ' + id + ' for ProdID ' + prodID); //replace with Ajax
return false;
});
return this.append(newLink);
};
})(jQuery);
</code></pre>
<p>Currently I get this rendered:</p>
<pre><code><input name="ctl00$Main$TradingItems$TestUpdate" id="TestUpdate" type="text"><a href="/Products/Test?prodID=1234">Update</a></input>
</code></pre>
| jquery asp.net | [5, 9] |
1,431,511 | 1,431,512 | File Content viewer on browser using asp.net | <p>How to view <strong>content</strong> of uploaded files on browser in asp.net ? And is it possible to view contents of all type of files using common code ? Or there is any free project there ?</p>
<p>Thanks..</p>
| c# asp.net | [0, 9] |
4,820,235 | 4,820,236 | File compression in ASP.Net | <p>In my ASP.Net application I want to compress a file and send it to the user, but the classes which are available compress files which are less than 4 to 5 GB. But through my application i want to compress a file which is more then 5 GB.
Is there any way to do that ?</p>
<p>Thank You.</p>
| c# asp.net | [0, 9] |
3,020,311 | 3,020,312 | Comparison method violates its general contract | <p>I am getting the Comparison method violates its general contract exception with this compareTo method, but I can't track down what is exactly causing the issue. I am trying to sort files by their extension in a particular way. Mind you this doesn't happen for all phones, just ones that I don't have access to which makes it harder to test out.</p>
<pre><code>public int compareTo(NzbFile another)
{
if (this.getFileName() != null && another.getFileName() != null)
{
if (this.getFileName().toLowerCase().endsWith(".nfo"))
return -1000;
else if (another.getFileName().toLowerCase().endsWith(".nfo"))
return 1000;
else if (this.getFileName().toLowerCase().endsWith(".sfv"))
return -999;
else if (another.getFileName().toLowerCase().endsWith(".sfv"))
return 1001;
else if (this.getFileName().toLowerCase().endsWith(".srr"))
return -998;
else if (another.getFileName().toLowerCase().endsWith(".srr"))
return 1002;
else if (this.getFileName().toLowerCase().endsWith(".nzb"))
return -997;
else if (another.getFileName().toLowerCase().endsWith(".nzb"))
return 1003;
else if (this.getFileName().toLowerCase().endsWith(".srt"))
return -996;
else if (another.getFileName().toLowerCase().endsWith(".srt"))
return 1004;
else
return this.getFileName().compareTo(another.getFileName());
}
else if (this.getFileName() != null && another.getFileName() == null)
{
return -995;
}
else if (this.getFileName() == null && another.getFileName() != null)
{
return 1005;
}
else
{
return this.getSubject().compareTo(another.getSubject());
}
}
</code></pre>
| java android | [1, 4] |
1,068,250 | 1,068,251 | Wrap certain word with <span> using jquery | <p>I have the following <code>div</code>:</p>
<pre><code><div id="query" style="width:500px; height:200px;border:1px solid black"
spellcheck="false" contenteditable="true"></div>
</code></pre>
<p>where Clients can write their <code>SQL</code> queries. What I was trying to do is wrap words the client enters right after hitting <kbd>Space</kbd> with a <code>span</code> and give this span a certain <code>class</code> according to the word typed:</p>
<p><em>example</em></p>
<p>If the client types <code>select</code> i need to wrap this select word like this in the div:</p>
<pre><code><span class='select'> SELECT </span> <span> emp_name </span>
</code></pre>
<p>CSS</p>
<pre><code>.select{color:blue ;text-transform:uppercase;}
</code></pre>
<p>It is something very similar to what <code>jsFiddle</code> does. How can i achieve this?</p>
<p>Here is what i have tried so far : <a href="http://jsfiddle.net/esu7A/1/" rel="nofollow">jsFiddle</a></p>
<pre><code>$(function(){
$('div').focus() ;
$('div').keyup(function(e){
//console.log(e.keyCode) ;
if(e.keyCode == 32){
var txt = $('div').text() ;
var x = 'SELECT' ;
$('div:contains("'+x+'")').wrap("<span style='color:blue ;
text-transform:uppercase;'>") ;
if(txt == 'SELECT'){
console.log('found') ; // why This Doesn't do any thing ?
}
}
});
});
</code></pre>
| javascript jquery | [3, 5] |
3,348,609 | 3,348,610 | How can I set the title on an element from an attribute of the element? | <p>I am using the following code:</p>
<pre><code> $(targetSelector)
.attr({
'data-disabled': 'yes',
'data-title': function() { return this.title },
'title': ''
})
.addClass('disabled')
.prop('disabled', true);
</code></pre>
<p>This sets the element's title to '' after first having stored it in data-title. </p>
<p>How can I restore the elements title by getting it back from the data-title attribute if the title is currently equal to the empty string? I assume I need to do this in a function like the above but how can I code in a check into the function?</p>
| javascript jquery | [3, 5] |
1,305,453 | 1,305,454 | How to get alerts at client side | <p>I want to set an alert service for my website users for there tasks.</p>
<p>These alerts are like Messenger alerts. My web site is in asp.net C#.</p>
<p>Here is the scenario I want to set for alerts:</p>
<p>I retrieve the alert messages for users through a webservice
and I want utility which displays alerts for users at client site.</p>
<p>Can anyone help me to sort out the problem?</p>
| c# asp.net | [0, 9] |
5,753,536 | 5,753,537 | How long does my AJAX call take? | <p>I want to do something like</p>
<pre><code>var date = new Date();
var pretime = date.getTime();
$.post(
"ajaxfile.php",
object,
function(data) {
var totalTime = date.getTime()-pretime;
$("#feed").append("Time: " + totalTime + "<br/>" + pretime + "<br/>" + date.getTime() + "<br/>");
});
});
</code></pre>
<p>That is, measure how long the AJAXcall lasts before I get a response. But the print from this callback function is:</p>
<pre><code>Time: 0
1326184886814
1326184886814
</code></pre>
<p>What is the solution to this?</p>
| javascript jquery | [3, 5] |
3,832,384 | 3,832,385 | JQuery: How do I use the JQuery delay with my own function? | <p>How do I use the JQuery <code>delay</code> in conjunction with my own defined function, pseudo-code like so?:</p>
<pre><code>$('#foo').slideUp(300).delay(800).myOwnFunction(1,2,3);
function myOwnFunction (a,b,c) {...}
</code></pre>
<p>The code above doesn't work, however - per the <a href="http://api.jquery.com/delay/" rel="nofollow">JQuery documentation</a> it appears like it should.</p>
| javascript jquery | [3, 5] |
776,265 | 776,266 | Jquery autocomplete | <p>How do I customize the ac_results class generated by the autocomplete plugin?</p>
| javascript jquery | [3, 5] |
1,442,075 | 1,442,076 | Creating unique id for textbox | <p>i like to have unique ids for textboxes and hidden filds .is there any property which will give unique id in asp.net ? </p>
<p>something like </p>
<p><code><asp:textbox id="ctr001_1" runat="server" uniqueid="textbox" /></code></p>
| c# asp.net | [0, 9] |
2,151,080 | 2,151,081 | Use a Javascript variable in C# | <p>I want to use a Javascript variable in C#, is it possible, how do I go about it?
Thanks</p>
| c# javascript | [0, 3] |
1,948,376 | 1,948,377 | error when returning a value of type Double? | <p>In this method I return a value of the type Double, but there is an error saying "Method </p>
<p>Must return value of type Double"???</p>
<p><strong>Code</strong>:</p>
<pre><code>public class Gyro extends Activity {
Double gyro_X;
Double gyro_Y;
Double gyro_Z;
public Double getGyro_X() {
if (this.gyro_X == null) {
Toast.makeText(this, ""+gyro_XIsNullText, ToastdurationShort).show();
} else {
return this.gyro_X;
}
}
</code></pre>
| java android | [1, 4] |
157,853 | 157,854 | Dynamically adding attributes to <head> tag ASP.NET | <p>How would I go about finding on my ASPX page (from codebehind) and then adding the attribute "runat=server" to it?
I have tried using <code>Page.header.attributes.add(...)</code> and<code>(HtmlHead) Page.FindControl("head");</code> The second one obviously won't work as the Head tag doesnt have an ID.</p>
<p>I can't work out how to change this property and I can't change or add any additional code to the ASPX page - like ID's etc.</p>
| c# asp.net | [0, 9] |
1,217,907 | 1,217,908 | how to get columns in one row using jquery | <p>I am trying to get columns inside row. But I only want to get those columns who does not have class element. How can I do this?</p>
<p><strong>Code:</strong></p>
<pre><code>update_data: function() {
$('#add').click(function() {
var uid = $('input[name="id"]').val();
var fname = $('input[name="firstname"]').val();
var lname = $('input[name="lastname"]').val();
var email = $('input[name="email"]').val();
var phone = $('input[name="phone"]').val();
var table_rows = $('table tbody tr');
table_rows.each(function(i) {
if (i == uid - 1) {
var tr = $(this); //.children("td");
$(tr).each(function(i) {
if (!tr.children("td").hasClass("element")) {
console.log(tr.children("td"));
}
});
}
});
});
}
</code></pre>
| javascript jquery | [3, 5] |
3,994,735 | 3,994,736 | c# page_unload firing together with after page_load | <p>So i want to delete some files when a user closes the browser.</p>
<p>I'm using the <code>page_unload</code> method shown below: </p>
<pre><code> protected override void OnUnload(EventArgs e)
{
base.OnUnload(e);
string[] uploadedFiles = Directory.GetFiles(Server.MapPath("~/testPdfIn"));
foreach (string uploaded in uploadedFiles)
{
File.Delete(uploaded);
}
}
</code></pre>
<p>but the <code>page_unload</code> method will just fire right after the page load, deleting the files in folder without the user even closing the browser.</p>
<p>Is there a way to stop the <code>page_unload</code> from firing right after loading and only firing when user closes the browser?</p>
| c# asp.net | [0, 9] |
3,611,453 | 3,611,454 | How to read the value of a variable which is set inside the jquery slide toggle calback function? | <p>I hope everyone is doing fine. My qyes actually I am setting a variable inside slide toggle call back function. I need to perform some action based on this variable's value So, I need to wait for this variable's value to be set in parent method. I think following code snippet will explain better what I am trying to do.</p>
<pre><code> function() {
$(this).next().slideToggle('normal',function(){
if ($(this).is(':hidden'))
{
state = "open";
}
else
{
state = "close";
}
isAnimationCompleted=true;
return true;
});
while(isAnimationCompleted==false)
{
//do nothing
}
isAnimationCompleted=false;
var selectedElement =$.trim(this.textContent);
if(state=="open" )
{
showHelp(selectedElement,state);
}
}
</code></pre>
<p>I will sincerely appreciate any help. thanks</p>
| javascript jquery | [3, 5] |
4,936,038 | 4,936,039 | Add Attributes to root HTML Element of a Custom Control | <pre><code>public class CustCtl : WebControl
{
protected override System.Web.UI.HtmlTextWriterTag TagKey
{
get
{
return HtmlTextWriterTag.Div;
}
}
}
</code></pre>
<p>With this bare bones control, it would render the root element as a Div tag. But how can I add attributes to that root HTML element that this control will render ... such as a style or id. </p>
<p>Thanks! =D</p>
| c# asp.net | [0, 9] |
3,491,207 | 3,491,208 | Scope of static Variable in multi-user ASP.NET web application | <p>Does static variables retain their values across user sessions? </p>
<p>I have a ASP.NET web application where I have two buttons. One for setting the static variable value, another for Showing the static variable value.</p>
<pre><code>namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
public static int customerID;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ButtonSetCustomerID_Click(object sender, EventArgs e)
{
customerID = Convert.ToInt32(TextBox1.Text);
}
protected void ButtonGetCustomerID_Click(object sender, EventArgs e)
{
Label1.Text = Convert.ToString(customerID);
}
}
}
</code></pre>
<p>While this works in single-user environment, What happens if there are 2 users simultaneously logged in from two computers, User 1 sets the value as 100, then User 2 sets the value as 200. after that user 1 invokes the Get Value button. What will he see as the value?</p>
| c# asp.net | [0, 9] |
2,876,864 | 2,876,865 | Want to show dependent popup thru javascript, that also work in IE7 and above | <p>I want to show a popup window by javascript function, with folloing conditions-
-Popup should be in Center of page.
-User can not be able to access parent page when popup opened.
-also work in IE7 or above.</p>
<p>However I am trying with followng code but did not got success.</p>
<pre><code> window.open('PopUp.aspx', 'popjack',
'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=no,width=955,height=500');
</code></pre>
<p>can it would easy by jQuery?
Thanks in advanced.!</p>
| c# javascript jquery asp.net | [0, 3, 5, 9] |
2,521,008 | 2,521,009 | How to access custom fields from the global class in a webhandler? | <p>I added some custom fields (public booleans) to the global class in global.asax.cs which are initialized during the Application_Start event. How do I access them in a webhandler (ashx)? Or is it better to save them in the Application state object?</p>
| c# asp.net | [0, 9] |
832,167 | 832,168 | How to dynamic select element with JQuery by id | <p>I need to dynamic select element with JQuery, I get in code id of element. How to do that ?
I've tried:</p>
<pre><code>var sel='\'#'+id+'\'';
var elem+$(sel);
</code></pre>
<p>but it doesn't work ( id is string id of element).</p>
| javascript jquery | [3, 5] |
1,377,631 | 1,377,632 | Android: overriding onPause and onResume - proper way | <p>When overriding the <code>onPause()</code> and the <code>onResume()</code> methods of the activity, where is the proper location to call the <code>super.onPause()</code> and <code>super.onResume()</code>? At the beginning of the method or at the end?</p>
| java android | [1, 4] |
599,125 | 599,126 | How to remove all tags after certain tag? | <p>I need to remove tags going after <code>#first</code> and only in <code>#container</code>.
How can I do it with jQuery?</p>
<pre><code><div id="container">
<div id="first"></div>
<div id="remove_me_1"></div>
<div id="remove_me_2"></div>
<div id="remove_me_3"></div>
<a href="" id="remove_me_too">Remove me too</a>
</div>
</code></pre>
<p>Thank you</p>
| javascript jquery | [3, 5] |
1,788,286 | 1,788,287 | How to get the id of next tr in table using jquery? | <pre><code><table>
<tr id ="tr_id_1">
<td >
Blah
</td
<td>
Blah
</td>
</tr>
<tr id ="tr_id_2">
<td>
Blah
</td>
<td>
Blah
</td>
</tr>
</table>
</code></pre>
<p>i have got the id of first tr using jquery </p>
<pre><code>var first_tr_id = tr_id_1 // id of first tr
</code></pre>
<p>now by using this id how to get the id of next tr
i have tried like this </p>
<pre><code>var nextId = ('#'+first_tr_id ).next("tr").attr("id");
</code></pre>
<p>but its giving <strong>("#" + row_id).next is not a function</strong> error ..</p>
| javascript jquery | [3, 5] |
3,962,931 | 3,962,932 | How to apply jquery code to different targets without rewriting existing code? | <p>Is it possible to execute existing jquery code but apply it to alternate targets?</p>
<p><strong>EXAMPLE</strong></p>
<pre><code>$('#btn1').click(function() {
$('#div1').fadeOut()
});
</code></pre>
<p>Can this code be reused to execute from #btn2 and target #div2 without rewriting the code.</p>
<p><strong>SOLUTION</strong></p>
<pre><code><a href="#"class="btn" data-id="35">Click</a>
$('.btn').click(function() {
$('#div'+$(this).data('id')).fadeOut()
});
</code></pre>
| javascript jquery | [3, 5] |
2,413,084 | 2,413,085 | Javascript YouTube API - Loading Player | <p>I have a list of YouTube videos on my website and this is what each list item looks like:</p>
<pre><code><div class="video_item" id="<YouTubeVideoID>">
// video thumbnail and information
</div>
</code></pre>
<p>If a user clicks on one of these video items, a panel drops down and SHOULD load the API and show the video player, once the panel has completed its slide action:</p>
<pre><code>$(document).ready(function(e) {
$('.video_item').live('click', function() {
var vid_id = $(this).attr('id');
if (vid_id) {
$("html").animate({ scrollTop: $('#main').offset().top-20 }, 1000, function() {
setTimeout(function() {
$('.video_drop_panel_wrap').slideDown('slow', function() {
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('youtube_player', {
height: '371',
width: '570',
videoId: vid_id,
events: {
'onReady': onPlayerReady
}
});
}
function onPlayerReady(event) {
event.target.playVideo();
}
});
},1000);
});
}
});
});
</code></pre>
<p>The problem is, it won't show the player and I don't receive any errors in my JS developer console. I have tested the API and the player without all the slide down panels and does work — just not where I want it to. I'm not sure if it's a DOM problem or something other than that. If anybody can spot what I have done wrong, I would appreciate a slap... oh and tell me what was wrong too.</p>
| javascript jquery | [3, 5] |
1,429,741 | 1,429,742 | How to pass Jquery variable to php variable? | <pre><code><script>
// i want to extract time '10:30' from stime jquery string variable
// and transfer value "10:30" in a php variable in this format "10, 30"
var stime = 'Sat Dec 17 2011 10:30:00 GMT+0530 (India Standard Time)';
<?php
$s = "<script>document.write(stime);</script>";
$e = "<script>document.write(etime);</script>";
$stime = substr($s,15,6);
//substr_replace(string,replacement,start,length)
$convert_stime = substr_replace($stime,", ",3,1);
?>
</script>
/**
Output Will Be
--------------
Time: 10:30
Converted Time: 10, 30
***/
</code></pre>
| php jquery | [2, 5] |
2,078,934 | 2,078,935 | Pattern checking .Check for incorrect operators in an expression | <p>In an expression , How to
1.Check if operators and operands are correct or not.
2.check if brackets match or not.
Example 1: (a+b)- has a one extra operator How do i confirm that the number of operators are incorrect.
Example 2 :((a+b)/(c-d) has one extra opening bracket. how to check such irregularities.
Any regular expression pattern to check these or some way to do this ?
Please help .</p>
| c# javascript asp.net | [0, 3, 9] |
551,504 | 551,505 | js check to see if user has connection | <p>Is there an easy way to check whether or not the user has connection to your website?</p>
<p>See if they don't get a connection error.</p>
| javascript jquery | [3, 5] |
986,163 | 986,164 | Android Location Promixity Query | <p>I'm working on an app, where I need to determine which sqlite rows are closest to me given my current lat/long. I have a table with lat and long columns, I'm just having a bit of trouble working out how to get ones that are closest based on my devices current location. Any help would be appreciated. </p>
| java android | [1, 4] |
4,472,393 | 4,472,394 | Object Notation in Javascript | <p>I'm trying to call a blur function on a variable assigned to a jquery object (an input field). How do I call the function on the variable?</p>
<pre><code>var someObject = {
day: $('#dayInputField'), // input text field
init:function(){
console.log("this.day" + this.day); // outputs object
this.validateField();
},
validateField : function(){
//this gets triggered - but I need to reference the variable
$('#dayInputField').blur(function(){
console.log("This gets triggered");
};
// this doesn't get triggered - how do I target the variable?
this.day.blur(function(){
console.log("doesn't work");
});
}
}
</code></pre>
<p>I have also tried - </p>
<pre><code>$(this.day).blur
$(this).day.blur
someObject.day.blur
$(day, this).blur
</code></pre>
<p>Any help would be appreciated!
thanks </p>
| javascript jquery | [3, 5] |
1,745,085 | 1,745,086 | how to count total number of divs with in a div using javascript | <p>how to count total number of divs with in a div using javascript</p>
| php javascript | [2, 3] |
681,655 | 681,656 | Store comma separate values into array | <p>I want to store comma separate values into array.
Later i want check it with different check.</p>
<pre><code>var_str= name,address,state,city // I want make array from this variable
</code></pre>
<p>How could i do this...</p>
<p>Thanks..</p>
| javascript jquery | [3, 5] |
179,617 | 179,618 | getting pictures into an array in javascript | <p>im kinda new to javascript i mean i know the syntax but not so much the libraries.</p>
<p>i need some help to get some files (pictures) from a folder into an arry lets say:</p>
<pre><code>var[] pictures = ?;
</code></pre>
<p>(the folder is in my project and contain some pictures)</p>
<p>so i can loop over them and diplay them on the page i did some search but i didnt find any guide on how to do this.</p>
<p>i realy want to understand on how to do this for future projects even a link to known guid you guys know we will be a big help.</p>
<p>if it help im using asp.net.</p>
| javascript jquery asp.net | [3, 5, 9] |
740,309 | 740,310 | how do i toggle between divs | <p>I have 2 divs. I want div id 1 to be visible when the page is loaded and when i click on anywhere in main div id 2 should be visible.when user click again on main 2 should be hidden and 1 visible.`</p>
<pre><code><div id="main" style="border:1 px dashed red;" >
<div id="1" style="width:300px;height:50px; ">div One visible</div>
<div id="2" style="width:300px;height:50px; ">div two visible</div>
</div>
</code></pre>
<p>How do i get it done using Jquery? i am not sure how to get the toggling effect</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
4,246,669 | 4,246,670 | Android running browser ASP page that sends commands to windows PC | <p>I am wondering how i can send a command (like 1, 2, 3..etc) from my web app (classic asp/asp.net) web page on my android web browser to a windows computer thats on the same LAN network. Kind of like an instant messenger type of thing so that i can design a web page with buttons and each button would send a command back to the computer.</p>
<p>Is that possible? Or do you know any other alternatives to accomplish this same task?</p>
<p>David</p>
| javascript jquery android asp.net | [3, 5, 4, 9] |
1,836,611 | 1,836,612 | How to set replace command if dynamic target in anchor tag | <p>This is my Html</p>
<pre><code>desc=<a target="_blank" href="http://www.taxmann.com/corporatelaws/fileopencontainer.aspx?Page=CIRNO&amp;id=27000000000000002519&amp;search=">A. P. (DIR Series) Circular No. 46 dated June 14, 2005</a>
String k = replace ( desc, "<a target=\"_blank\" href=\"http://www.taxmann.com/corporatelaws/fileopencontainer.aspx?Page=RULES&amp;id=35000000000000001648&amp;search=\">", "");
</code></pre>
<p>In desc I'm getting HTML I have replace command
I have to remove link so I'm pick data from anchor tag target is dynamic where id varies I'm able to replace linking to text whose target is </p>
<p><a href="http://www.taxmann.com/corporatelaws/fileopencontainer.aspx?Page=RULES&id=35000000000000001648&search=" rel="nofollow">http://www.taxmann.com/corporatelaws/fileopencontainer.aspx?Page=RULES&id=35000000000000001648&search=</a>\ </p>
<p>but when ever target changes, I mean to say if id changes, it doesn't replace link as text. </p>
<p>Please tell me how to get and set the id values so that if target will be dynamic we can replace link as text. I'm new to android programming.</p>
| java android | [1, 4] |
1,470,668 | 1,470,669 | Proper Variable Declaration in C# | <p>I noticed some people declare a private variable and then a public variable with the get and set statements:</p>
<pre><code>private string myvariable = string.Empty;
public string MyVariable
{
get { return myvariable; }
set { myvariable = value ?? string.Empty; }
}
</code></pre>
<p>and then some people just do the following:</p>
<pre><code>public string MyVariable
{
get { return value; }
set { MyVariable = value; }
}
</code></pre>
<p>Being a bear of little intelligence (yes, I have kids... why do you ask?) I can't figure out why you would choose one over the other. Isn't it just as effective in using a public variable that you can set any time using the set method of the variable?</p>
<p>Can anyone shed some light on this for me?</p>
<p>UPDATE: I corrected the second example after several people pointed out it wouldn't compile. Sorry about that, but the question still remains...</p>
| c# asp.net | [0, 9] |
1,194,919 | 1,194,920 | How to improve RandomAccessFile usage? | <p>I'm using a <code>RandomAccessFile</code> to <strong>rw</strong> data to it constantly. The size of the file can range from 5MB up to 200MB. This file is used as a <strong>circular buffer</strong>. </p>
<p>My main concern is the constant seek before a read and write.</p>
<p>What happens after seek? Does part of the file data get buffered right away into memory? Does it even do anything after a seek?</p>
<p>I want to understand how it works and how I could improve the performance of using the <code>RandomAccessFile</code> to read write at different positions. I just feel the constant seek is possibly using too many resources? </p>
<p><strong>Possible solution to avoid constant seek?</strong> </p>
<ol>
<li>Instantiate two <code>RandomAccessFile</code> instances one to read and the other to write. Of course these would be tightly synchronized.</li>
<li>Use two <code>FileChannels</code>. Not even sure how I could prevent the pointer from moving when I need to read the tail of my buffer or the head of the buffer.</li>
</ol>
| java android | [1, 4] |
2,124,999 | 2,125,000 | Workaround for passing parameter to jQuery ready() | <p>I have some code called on jQuery document.ready() which is used in multiple HTML files. Now the difference is each of these HTMLs uses a different div id.
I know one option is to just check for hardcode div ids inside $(document).ready() . But I wanted to write a generic code which would take the div Ids based on the currrent/calling HTML page?</p>
<p>So is there any way or workaround for passing parameter to jQuery ready() ?</p>
| javascript jquery | [3, 5] |
2,832,070 | 2,832,071 | jQuery authoring and closure | <p>I'm reading about writting <a href="http://docs.jquery.com/Plugins/Authoring" rel="nofollow">jQuery plugins</a> an there is a section that talks about preserving dollar sign notation so that it doesn't collide with other libraries that use it. </p>
<p>It says: </p>
<blockquote>
<p>it's a best practice to pass jQuery to a self executing function
(closure) that maps it to the dollar sign so it can't be overwritten
by another library in the scope of its execution</p>
</blockquote>
<p>And here is how they do it: </p>
<pre><code>(function( $ ) {
$.fn.myPlugin = function() {
// Do your awesome plugin stuff here
};
})( jQuery );
</code></pre>
<p>I'm trying to understand what they are saying and what this code is saying. How is the following code gets evaluated? </p>
<p>Does <code>function($){}</code> get executed and get <code>jQuery</code> object passed to it? </p>
<p>Does jQuery object become the $? </p>
| javascript jquery | [3, 5] |
2,295,193 | 2,295,194 | Use Comma in variable? | <p>Is there a way to convert this:</p>
<pre><code>$('#id').testfunction({
'source' : [
{'source':'pathimage.jpg','title':'Title 1','description':'This is a description 1.'},
{'source':'pathimage.jpg','title':'Title 2','description':'This is a description 2.'},
{'source':'pathimage.jpg','title':'Title 3','description':'This is a description 3.'},
{'source':'pathimage.jpg','title':'Title 4','description':'This is a description 4.'},
{'source':'pathimage.jpg','title':'Title 5','description':'This is a description 5.'}
]
});
</code></pre>
<p>To simple for dynamically output:</p>
<pre><code>$('#id').testfunction({
'source':[
$SOURCE
]
});
</code></pre>
<p>I am pushing the source into a array and trying to construct it again into <code>$SOURCE</code>. The <code>$SOURCE</code> should be look like this eventually:</p>
<pre><code>$SOURCE = myArray[0], myArray[1], myArray[2], myArray[3], myArray[4];
</code></pre>
<p>But its the comma thingy that keeps prevent the variable from working. I can't get the comma into the variable. Using <code>+ "," +</code> doesnt work since it recognizes it as a string... </p>
<pre><code>$SOURCE += myArray[s],;
</code></pre>
<p>Is there a way to convert this to a working variable to dynamically use?</p>
| javascript jquery | [3, 5] |
823,670 | 823,671 | javascript output with double quote in asp.net c# | <p>when i generate text from database using datatables in asp.net c#, i can generate this <code>"<a href='javascript:txtreplace('text to replace')'>" + lbltext.Text + "</a>"</code> </p>
<p>output is</p>
<p><code><a onclick='txtreplace('text to replace')'>text</a></code> </p>
<p>but is in not working on webpage, it is noly working when <strong>onclick</strong> is in Ddouble quote like <code><a onclick="txtreplace('text to replace')">text</a></code></p>
<p>how to generate text with double quote in <strong>"onclick"</strong> from database or any other solution to access javascript function</p>
| c# javascript asp.net | [0, 3, 9] |
3,603,084 | 3,603,085 | can anybody help me find what is the js error i get in explorer 7 and 8? | <p>If i run the link in ieTester, in ie7 pops up a js error and the site doens't work, if i try ie8 i don't get a pop msg but it doesn't work neither. It says: Line 219 Char 1 Error expected identifier, string or number Code 0</p>
<p>in here: link off - issues was the answer below</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
2,033,048 | 2,033,049 | Start function with both mousewheel and click jQuery | <pre><code>$('.div').bind('mousewheel', function(e, delta) {
</code></pre>
<p>How do I write if I also want a single click to start the function? I want the user to be able to choose himself.</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
4,359,761 | 4,359,762 | Jquery / Javascript form help? | <p>I have implemented this solution..</p>
<p><a href="http://tutorialzine.com/2010/10/ajaxed-coming-soon-page/" rel="nofollow">http://tutorialzine.com/2010/10/ajaxed-coming-soon-page/</a></p>
<p>However, on submit, I would like the form to disappear and the "thank you" text displayed. Currently, the form remains and the "thank you" text is displayed in the textbox.</p>
<p>What would I have to change?</p>
<p>Thank you!</p>
| javascript jquery | [3, 5] |
2,857,588 | 2,857,589 | Converting Javascript object to jquery object? | <p>when iam trying to convert javascript object to jquery object like obj = $(obj). The object obj is loosing one of the property values and setting the value as true.if iam using obj[0].Validated its returning the exact values.Please suggest on this.</p>
<pre><code>obj = $(obj);
objValue = obj.attr("Validate");
</code></pre>
| javascript jquery | [3, 5] |
2,324,605 | 2,324,606 | Question on popup window | <p>In my code I am using a popup window to display extra information. I also have the ability to export the information in the main window to Excel.</p>
<p>The problem is, after the window pops up -> I see the info -> I close the popup window -> but if I try the export to Excel button, it throws the exception <em>"null object referrence"</em> (if I use a try/catch, the exception doesn't occur - but I don't get any information). </p>
<p>In the export function I am doing something like this:</p>
<pre><code>{
//some code .... here
con.close();
session["dss"] = mydataset;
}
</code></pre>
<p>In the export button click event:</p>
<pre><code> system.data.dataset dss = (system.data.dataset)session["dss"];
//then some work on this
</code></pre>
<p>I think, probably when the popup window opens it ends the execution and that's why when I come back to the main window and try the export button the values for the tables and all goes out of scope.</p>
<p>Also, if I refresh the main page after closing the popup window I don't have any issue and can export the data.</p>
<p>Can you please help me with this?</p>
<p>Thanks,
Rahul</p>
| c# asp.net | [0, 9] |
4,941,995 | 4,941,996 | How to change the target of any local link when clicked, using javascript / jquery? | <p>I need to change the href of any local link when it is clicked on.
I've worked out how to select the correct links and create the new url, but not sure how to change the location. I need to be certain that any other click events have also run, so I can't just change the location immediately.</p>
<pre><code>var my_host = 'example.com';
$(document).click(function(e) {
if(e.target.hostname == my_host)
{
alert(e.target.protocol + "//" + e.target.hostname + "/#" + e.target.pathname + e.target.search);
//...
}
});
</code></pre>
<p>This is related to my <a href="http://stackoverflow.com/questions/3970649/how-to-select-all-local-links-in-jquery">earlier question</a>.</p>
| javascript jquery | [3, 5] |
1,536,715 | 1,536,716 | Tabbing between jquery EditInPlace fields? | <p>I have a page with a bunch of jquery EditInPlace tags and the client would like to allow the user to tab between fields (i.e. tabbing would launch the next .eip field. Is this even possible? I'm using the 'jquery-in-place-editor' located here: <a href="http://code.google.com/p/jquery-in-place-editor/" rel="nofollow">http://code.google.com/p/jquery-in-place-editor/</a></p>
<p>The code is currently behind a login screen, so it's hard for me to show it. At this point I'm mostly interested in how one would go about doing this - I'm pretty new to jQuery, so I don't think I have the current skills to do this one, but it seems like one should be able to catch the tab (through the blur() function?) and then call the click() function on the next .eip element. But that's about as far as my understanding goes... Any ideas?</p>
| javascript jquery | [3, 5] |
5,238,157 | 5,238,158 | what is the use of super() method - Android | <p>I'm new to Android and never studied JAVA before.
I was working on an Android app.
There I didn't get to know the meaning of super method.
for e.g. at a place I saw <code>super(R.string.changing_fragments);</code> but I didn't get it's meaning.</p>
| java android | [1, 4] |
4,309,349 | 4,309,350 | Allowing the user to comment/reply in a webpage? | <p>i am creating an ASP.NET C# web application and I am looking for the easiest way to do a comments system.</p>
<p>I'll explain. </p>
<p>I have a page containing Items (list items containing texts) </p>
<p>I want the users to be able to click on one, and then he is allowed to reply or comment to it. and he can see what others have replied too.</p>
<p>Is there a library or API that can do that? and if not can you give me tips on how to do it?</p>
| c# asp.net | [0, 9] |
4,100,404 | 4,100,405 | DRYing out some code | <p>I'm drying to DRY up this code from the jQuery source:</p>
<pre><code>cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
}
</code></pre>
<p>I suggest the following. Can it be done better?</p>
<pre><code>cssNumber: {}
"fillOpacity fontWeight lineHeight opacity orphans windows zIndex zoom"
.split(" ")
.forEach(function() {
cssNumber.name = true;
});
</code></pre>
| javascript jquery | [3, 5] |
2,715,724 | 2,715,725 | how to touch on two buttons at the same time in Android | <p>I want to implement OnTouchEvent for two buttons and get
MotionEvent.ACTION_MOVE function at same time.</p>
<p>I implemented onTouchEvent but doesn't work</p>
<pre><code> left = (Button)findViewById(R.id.button1);
right = (Button)findViewById(R.id.button2);
left.setOnTouchListener(this);
right.setOnTouchListener(this);
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if(v.getId()==R.id.button1){
Log.i("left", "moved!");
}
if(v.getId()==R.id.button2){
Log.i("right", "move!");
}
}
return false;
}
</code></pre>
<p>in AndroidManifest.xml</p>
<pre><code><uses-feature android:name="android.hardware.touchscreen.multitouch"
android:required="true" />
</code></pre>
<p>please help me to figure this out.</p>
| java android | [1, 4] |
2,461,399 | 2,461,400 | Dynamic Elements not working ASP c# | <p>I am trying to add dynamic HTML elements from the code behind file on page load`</p>
<p><code>
protected void Page_Load(object sender, EventArgs e)
{</p>
<pre><code> for (int i = 98; i < 123; i++)
{
LinkButton btn = new LinkButton();
Char temp = Convert.ToChar(i);
btn.Attributes.Add("onclick", "clicked");
btn.Attributes.Add("ID", "'" + temp + "'");
btn.Attributes.Add("runat", "server");
btn.Text = temp.ToString().ToUpper();
letter.Controls.Add(btn); //Letter is an id of div element
}
}
</code></pre>
<p></code>
The onclick event doesnt fire</p>
| c# asp.net | [0, 9] |
2,232,462 | 2,232,463 | Jquery to Zoomin and Zoomout and for Shapes of images on click of button | <p>I am working on Image upload and I need to add functionality to zoomin and zoomout and shapes (like landscape, portrait) of image on click of buttons. But nothing happens when I am clicking on the buttons. My code is: </p>
<pre><code>$(document).ready(function() {
var imagesize = $('img').width();
alert(imagesize);
$('#zoomout').on('click', function() {
imagesize = imagesize - 5;
$('img').width(imagesize);
});
$('#zoomin').on('click', function() {
imagesize = imagesize + 5;
$('img').width(imagesize);
});
});
</code></pre>
| php jquery | [2, 5] |
1,114,575 | 1,114,576 | How to register js files at the end of a asp.net document instead of within the ScriptManager | <p>In certain circles best practices suggest registering JavaScript files (js) at the end of a document to allow the DOM to completely load before invoking the js. This makes total sense but the question I have is if you are working with an asp.net webform and due to the postbacks I need to register the js files with the scriptmanager</p>
<pre><code><asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/js/jquery-1.7.js" />
<asp:ScriptReference Path="~/js/jquery.simplemodal-1.4.2.js" />
</Scripts>
</asp:ScriptManager>
</code></pre>
<p>Since the script manager has to be at the top of the document before any ajax features can be invoked it seems as if I am stuck registering the .js files at the beginning of the document.
Is this correct and are there other alternatives to registering the files at the bottom of the page to help boost page performance (aside from minifying the scripts. The above example is just a sample and not production code). Moving the js files outside of the script manager results in the pages loosing reference to the js file after the initial postback.</p>
<p>Cheers</p>
| javascript asp.net | [3, 9] |
5,801,576 | 5,801,577 | link to pdf file(asp.net) | <p>i have saved the pdf file to the database using file upload . now i want to retrive the pdf file from the database and it has to be linked to the linkbuttons that are dynamically created . so for each link button i have a pdf file linked to it. - how to do this in asp.net using C#</p>
| c# asp.net | [0, 9] |
4,110,968 | 4,110,969 | how do we check whether any item in the listbox is selected in asp.net .Net 2.0? | <p>In asp.net, I have to do a for loop and check whether any of the items are checked if I want to know if any of the items are checked.</p>
<p>In C#, there is sth like..</p>
<pre><code>listbox.SelectedItems.Count();
</code></pre>
<p>Any similar method for asp.net???</p>
| c# asp.net | [0, 9] |
6,017,406 | 6,017,407 | Jquery ui-sortable with tabs,multi select | <p>im using jquery ui sortable lists connected with tabs.How can be added multiply selection?</p>
<pre><code> $(function() {
$( "#sortable1, #sortable2" ).sortable().disableSelection();
var $tabs = $( "#tabs" ).tabs();
var $tab_items = $( "ul:first li", $tabs ).droppable({
accept: ".connectedSortable li",
hoverClass: "ui-state-hover",
drop: function( event, ui ) {
var $item = $( this );
var $list = $( $item.find( "a" ).attr( "href" ) )
.find( ".connectedSortable" );
ui.draggable.hide( "slow", function() {
$tabs.tabs( "option", "active", $tab_items.index( $item ) );
$( this ).appendTo( $list ).show( "slow" );
});
}
});
</code></pre>
<p>});</p>
<p>tried searching for answer around for whole day..nothing came up,where should i look?</p>
| javascript jquery | [3, 5] |
3,141,260 | 3,141,261 | jQuery position().top returns 0 rather than real value | <p>According to the jQuery official documentation, this function should:</p>
<p><strong>"Get the current coordinates of the first element in the set of matched elements, relative to the offset parent."</strong></p>
<p>The following code is expected to return value 51, but it returns value 0. Could anyone provide insight as too why? Thanks in advance.</p>
<p>I know that adding css(top:xx) works, if so, does that mean position() only work for the case the element has the css property of top?</p>
<pre><code><html>
<head>
<style type="text/css">
.outer
{
width:200px;
height:200px;
overflow-y:auto;
border:1px dotted grey;
position:absolute;
}
.inner
{
width:50px;
height:50px;
margin-top: 50px;
border:1px solid red;
}
</style>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript"">
$(document).ready(function () {
$('.inner').mousedown(function (e) {
alert($(this).position().top);
})
})
</script>
</head>
<body>
<div class="outer">
<div class="inner"></div>
</div>
</body>
</html>
</code></pre>
| javascript jquery | [3, 5] |
277,663 | 277,664 | How do I force a scrollbar in a <select> to go to the top of the list? | <p>I have this HTML:</p>
<pre><code><select multiple='multiple' size='3'>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</code></pre>
<p>Using jQuery how do I force the scrollbar in the select to go to the top?</p>
| javascript jquery | [3, 5] |
5,203,952 | 5,203,953 | Box style search form with step by step narrow | <p>Anyone could help me to find a tutorial or a free script which work something like this:</p>
<p><a href="http://www.unixauto.hu/Unix_TipusVal_Form.aspx" rel="nofollow">http://www.unixauto.hu/Unix_TipusVal_Form.aspx</a></p>
<p>The visitor pick a main catergory, than a sub-category..etc...and get the result what he want.</p>
<p>This type of search have any name?</p>
<p>Thank you very much.</p>
| php javascript asp.net | [2, 3, 9] |
4,410,919 | 4,410,920 | Fade in from a background to another one | <p>Let's say my element has background-image:background1.png.</p>
<p>How can I make the element's background fadein into background2.png without fading the first one out.</p>
| javascript jquery | [3, 5] |
5,761,127 | 5,761,128 | Breaking out of jQuery loop vs native JS for loop. Which is better? | <p>First of all, apologies if the heading question doesn't exactly match with what I am going to ask. </p>
<p>My problem is that I want to have a loop, and the control is suppose to break out of this loop, once a condition is met. </p>
<p>Now, is it better to use the native JS 'for loop' and use 'return' or is it better to use the jQuery.each() and use return false, to break out of the loop? </p>
| javascript jquery | [3, 5] |
772,549 | 772,550 | GMT Time format to integer format | <p>I am trying to show ticker clock for different timezone. When I looked around the web, it looks like it takes number for the offset(for example +5.5 hours) in javascript. But the way we are getting the gmtformat is +05:30 in php which I am trying to feed in to the javascript function. Is there any function that I can use to convert?</p>
<pre><code>/*CLOCK CODE IN JAVASCRIPT*/
function startclock(field, timediff, newOrRepeat)
{
var clockAction=newOrRepeat;
if (timediff=="") {$(field).html("-------");return false;}
/****THERE ARE MORE STUFF IN BETWEEN AND AFTER WHICH IS NOT RELEVANT TO OFFSET****/
var secondsDiff=0;
var secondsTimeZone = 0;
//calculate the difference in time set by both the timezone as well as the DST
secondsTimeZone = parseInt(timediff);
if ($("input[name='daylight']:checked").val()=="on" && $(field).siblings("#isDaylight").val()=="no")
secondsDiff=secondsTimeZone + 3600;
else if ($("input[name='daylight']:checked").val()=="off" && $(field).siblings("#isDaylight").val()=="yes")
secondsDiff=secondsTimeZone - 3600;
else
secondsDiff = secondsTimeZone;
var thetime=new Date();
thetime.setUTCSeconds(parseInt(thetime.getUTCSeconds())+parseInt(secondsDiff));
var nhours=thetime.getUTCHours();
var nmins=thetime.getUTCMinutes();
var nsecn=thetime.getUTCSeconds();
}
</code></pre>
<p>I am getting getting gmt format straight from php which i am passing to this function.</p>
| php javascript | [2, 3] |
5,695,950 | 5,695,951 | How to make a callback from a Service to an Activity | <p>Sorry for bugging you again, but I still can't find a way to make a callback from my activity to a service... </p>
<p>Found a similar question - <a href="http://stackoverflow.com/questions/3398363/how-to-define-callbacks-in-android">How to Define Callbacks in Android?</a></p>
<pre><code>// The callback interface
interface MyCallback {
void callbackCall();
}
// The class that takes the callback
class Worker {
MyCallback callback;
void onEvent() {
callback.callbackCall();
}
}
// Option 1:
class Callback implements MyCallback {
void callback() {
// callback code goes here
}
}
worker.callback = new Callback();
</code></pre>
<p>yet not sure how to integrate that sample into my project.</p>
<p>Any suggestions or links to clear tutorials would be great!</p>
| java android | [1, 4] |
1,068,712 | 1,068,713 | Gtranslate plugin add backslash before apostrophe | <p>I'm using <strong>Gtranslate</strong> plugin for a client website and translating some words using the apostrophe I found that the plugin add a backslash before it:</p>
<p><strong>Hello I/'m going to dinner...</strong></p>
<p>How can I remove the backslash before apostrophe?</p>
<p>There is a php fix that I can add to the plugin or should I use a javascript solution?</p>
<p>And can you can help me to find a good way to do it in both case?</p>
<p>Thanks.</p>
| php javascript | [2, 3] |
1,551,743 | 1,551,744 | Custom fonts in android | <p>I am trying to use custom fonts in a textview:</p>
<pre><code>tv=(TextView)findViewById(res);
Typeface font = Typeface.createFromAsset(this.getAssets(), "fonts/font.ttf");
tv.setTypeface(font);
</code></pre>
<p>But when I run I get the following error:</p>
<pre><code>W/System.err( 542): java.lang.RuntimeException: native typeface cannot be made
</code></pre>
<p>Whats the issue?</p>
| java android | [1, 4] |
343,527 | 343,528 | Post from PHP page to Java program and output result | <p>I have a PHP page on one server, which asks for some login details from a user. </p>
<p>I then have a Java application on another server.</p>
<p>I am trying to POST the results from the login form to the Java application, then respond with a yes/no as to whether the details were correct. </p>
<p>Whats the simplest way of going about this? I have read plenty on using sockets to post from Java, not I can't seem to find a good tutorial that explains how to post from a form, process it and return the results pack to the user.</p>
| java php | [1, 2] |
1,326,928 | 1,326,929 | Asynchronous Callback functions: Iphone Versus Android | <p>On Callback</p>
<p>On Iphone </p>
<h2>File A:</h2>
<p>@protocol servicedelegate
-(void)taskCompleted:(NSDcitionary*) dict;
@end</p>
<p>-(void) performtask
callback=@"taskCompleted:";</p>
<p>[(id)delegate performSelector:NSSelectorFromString(callback) withObject:data];</p>
<h2>File B:</h2>
<p>-(void) taskcompleted:(NSDictionary*)dict
{</p>
<p>//don something when File A fisnihed the taskcompleted and have the data
// this callback on File B will be awaken from File A's delegate function
}</p>
<p><em><strong>The question How does Android implement the above, File A waiting to getting the data, and nobody knows how long, but once finished, File B would awaken by the delegate callback fucntion of taskcompleted.</em></strong></p>
| android iphone | [4, 8] |
5,220,779 | 5,220,780 | Jquery delay being overlooked after .html() call | <p>i am trying to introduce an delay after an image is loaded but it keeps skipping the .delay()</p>
<pre><code>$(\"#output\").html(\"<center><img src='http://i.imgur.com/GM6KJdh.gif' /></center>\").delay(5000);
</code></pre>
<p>I have tried many versions of the above code but it still dosent work </p>
<p>Appreciate the help guys.</p>
| php javascript jquery | [2, 3, 5] |
1,700,026 | 1,700,027 | How do you return an embedded resource .aspx page via a httphandler? | <p>Pop quiz hot shots...</p>
<p>I have a Visual Studio 2010 .NET 4 solution with 2 projects, The first project is a c# class library that contains a httphandler and a .aspx page. The .aspx page's build action has been set to "Embedded Resource".</p>
<p>The second project is an asp.net web application which references the first. The httphandler is wired up in the web.config.</p>
<p>I want the httphandler to serve the embedded .aspx page. How do I do this?</p>
<p>Thanks,
James</p>
| c# asp.net | [0, 9] |
5,482,308 | 5,482,309 | Preventing New line in a multiline text box | <p>How to prevent the new line character at the beginning of the text entering in a multiline text box? Now, I already trimmed the white space at the beginning of the text. but i can't prevent the new line character that has to be occurred by entering the enter key on the most beginning of the text box. Please help me. thanks in advance.</p>
| asp.net javascript | [9, 3] |
961,605 | 961,606 | Programmatically Setting Number Input Value Not Working | <p>I have a piece of javascript that sets the number input value. However, it won't work. The input's value field is still empty after the call (although console.log() outputing the element's val() does show the correct value). I have tried setting the value three ways jQuery's .val(total), .attr('value', total), and with plain old .value =, and still nothing. I even replaced the entire element with html and the value concatenated into the value attribute, and it won't work.</p>
<p>Any ideas why this won't take?</p>
<p>Here's the markup:</p>
<pre><code><div id="proposal_price_box">
<div class="proposal_price_header sys_bkgcolor">
<span class="title"><h3>Price to Appear on Proposal</h3></span>
</div>
<div class="inner">
<span class="label">$</span>
<input type="number" class="amount-input" id="proposal_price" value=""/>
</div>
</div>
</code></pre>
<p>And the pertinent javascript:</p>
<pre><code>$('#proposal_price').val('1234');
</code></pre>
<p>Jsfiddle demonstrating the problem below.</p>
<p><a href="http://jsfiddle.net/n8z9K/12/" rel="nofollow">http://jsfiddle.net/n8z9K/12/</a></p>
<p>Somehow, if the element's container is displayed, it will set the value. But as soon as its hidden again, it breaks.</p>
<p><strong>EDIT</strong> Sorry, I didn't properly demonstrate the problem in JSfiddle. I am trying to clone the contents of the container and place it elsewhere. I've updated the jsfiddle to better show the issue.</p>
| javascript jquery | [3, 5] |
2,987,930 | 2,987,931 | Confused about adding multiple td's to tr using JQuery | <p>So I have the following code:</p>
<pre><code><script type="text/javascript">
$(document).ready(
function () {
$("#txt").click(function () {
var $TableRow = $('<tr></tr>');
var $TableData = $('<td></td>');
var $TableData2 = $('<td></td>');
// Works
$("#tblControls").append(
$TableRow.html(
$TableData.text("Test, Hello World3")
)
);
</script>
<div style="display: inline">
<input type="button" id="txt" value="Add TextBox" style="" />
</div>
<br />
<table id="tblControls" width="100%">
</table>
</code></pre>
<p>But why does this not add two td's to the tr?</p>
<pre><code>$("#tblControls").append(
$TableRow.html(
$TableData.text("Test, Hello World3")
+
$TableData2.text("Test, Hello World4")
)
);
</code></pre>
<p>What I get is this:</p>
<p><code>[object Object][object Object]</code>.</p>
| javascript jquery | [3, 5] |
1,407,897 | 1,407,898 | JQuery sorting a table without the plugin | <p>Is there a jquery function to sort a table. I am aware of the JQuery Tablesorter plugin but I want to avoid using it if possible.</p>
<p>As a FYI - The table that I have a header with custom images to indicate ascending and descending. The data type could be pretty much any type.</p>
<p>EDIT:Can I do sorting of a table in Javascript?</p>
| javascript jquery | [3, 5] |
4,818,961 | 4,818,962 | adding a text line and a link button to a GridViewRow | <p>ok so i have this code so far:</p>
<pre><code> for (int i = 0; i < fajlovi.Length ; i++)
{
string filename = fajlovi[i];
string link = Server.MapPath("~/upload" + "//" + Page.User.Identity.Name) + fajlovi[i];
LinkButton button = new LinkButton();
button.Text = "Download";
button.PostBackUrl = link;
GridViewRow row = new GridViewRow(i, i, DataControlRowType.DataRow, DataControlRowState.Normal);
}
</code></pre>
<p>now what i need is to add the string filename and the linkbutton button to a row in a GridView. i know that i need to create a GridViewRow and then add that row to the GridView, but i have no idea how to add the elements into the row.</p>
<p>Anyone know how to work with this?</p>
| c# asp.net | [0, 9] |
1,193,979 | 1,193,980 | Populate dropdown select with array-with multiple options- using jQuery | <p>So I'm trying to populate a dropdown with the states, the value for the option should be the two characters value, and the text for the option should be the full state's name, using the code below is returning a value of 0,1,2,3... and returning all the options in the var as the text.</p>
<pre><code>var states = ["Select State","","Alabama","AL","Alaska","AK","Arizona","AZ","Arkansas","AR",...];
$.each(states, function(val, text) {
$('#selector').append( $('<option> </option>').val(val).html(text) )
});
</code></pre>
| javascript jquery | [3, 5] |
573,982 | 573,983 | how to append anchor tag into parent of div? | <p>My html code is:</p>
<pre><code><div title="test" class="xyz">Tesing</div>
</code></pre>
<p>I want it to look like:</p>
<pre><code> <a href='#'> <div title="test" class="xyz">Tesing</div></a>
</code></pre>
<p>How to do it using JavaScript?</p>
| javascript jquery | [3, 5] |
3,264,017 | 3,264,018 | Jquery not updating .val first time round? | <p>I have been doing the booking form on this website here. <a href="http://offline.raileisure.com/" rel="nofollow">http://offline.raileisure.com/</a></p>
<p>if you fill in the booking form on the right hand side.. click extras and add some extras</p>
<p>click get price to get the popup window...</p>
<p>You see where is says "Base Accomodation Price comes to £"</p>
<p>Well the first time it doesn't bring the price up (although it is setting the $('#bpriceinput').val(data);</p>
<p>if you click away to disappear the popup and click get price again. "Base Accomodation Price comes to £" now has the price...</p>
<p>IT just doesn't want to appear first time... is it because i am updating too close the the window popping up ??</p>
<p>I am baffled and spent 2 hours on this silly bug</p>
<p>Any help will be hugely appreciated </p>
<p>Thanks</p>
<p>Lee</p>
| javascript jquery | [3, 5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.