Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
3,948,679
3,948,680
PHP Conditions in Javascript code
<p>I need to add a PHP condition inside some javascript code like this:</p> <pre><code>&lt;script&gt; $(document).ready(function() { &lt;?php if (some condition) { $('#myID').show(); } }); &lt;/script&gt; </code></pre> <p>Is this possible?</p>
php javascript jquery
[2, 3, 5]
2,060,446
2,060,447
Check if an element exists in the DOM
<p>The following snippet is not working for me. Basically I want to check if there is an input element with the name "documents[]" and the value item.id and return void.</p> <p>I thought this line would do it: <code>$("input [name='documents[]'][value='"+item.id+"'") != false</code>. </p> <p>However the statement returns true every time. I have looked at the documentation for the jQuery constructor and it doesn't mention anything about returning false if no element is found for the selector. </p> <p>How can I tell if the selector doesn't match any elements?</p> <pre><code> $.ajax({ url:'/myid/documents/json_get_documents/'+request.term, dataType:"json", success: function(data) { response($.map(data, function(item){ if($("input [name='documents[]'][value='"+item.id+"'") != false) { return; //This item has already been added, don't show in autocompete } return { label: '&lt;span class="file"&gt;'+item.title+'&lt;/span&gt;', id: item.id, value: 'Search by title' } })) } }); </code></pre>
javascript jquery
[3, 5]
18,312
18,313
Any solution to use non-guessable links in a program?
<p>I've been looking for a file hosting site to host my files and my friend offered me a premium account on Box.net.</p> <p>The problem in this host site (and on many others) is that the links arent guessable, they cant be predicted. That means: If you upload 2 images called "1.jpg" and "2.jpg", the links aren't like </p> <blockquote> <p>"www.host.com/omar/1.jpg , www.host.com/omar/2.jpg" ,</p> </blockquote> <p>instead, they are like </p> <blockquote> <p>"www.host.com/qweqwasd , www.host.com/123lqqwje" .. </p> </blockquote> <p>So I cant use them on my application since I upload a lot of small site and I cant copy each link manually, it will take days.</p> <p>Is there a way to override this problem in a program? maybe run a script to get all the links on the site? </p>
c# java javascript
[0, 1, 3]
2,290,610
2,290,611
Get me off the JavaScript postback Failboat
<p>I've got to call two js functions, setfocus on textbox and stop a postback from occuring on single buttonclick. I think I got it if I could only intercept the postback. My js skills are on par with weaksauce. </p> <p><strong>test case</strong></p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JsTextFocus.aspx.cs" Inherits="WebApplication1.JsTextFocus" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript" language="Javascript"&gt; function aMethod() { var dowork = 'bleh'; } function setFocusOnTextBox() { TextBox1.Focus(); return false;//Stop the postback..FAIL } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:ImageButton ID="imageBtn" runat="server" ImageUrl="images/document_Small.gif" CausesValidation="false" OnClientClick="aMethod();return setFocusOnTextBox();return false;" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Page load shouldn't fire after OnClientClick</strong></p> <pre><code> protected void Page_Load(object sender, EventArgs e) { Response.Write("PS happened at " + DateTime.Now); } </code></pre>
javascript asp.net
[3, 9]
2,610,420
2,610,421
how to load many words on screen and scroll
<p>I'm doing an app on android (upon a book on app) I want to ask how I can load many words (same as a page of book). Thanks</p>
java android
[1, 4]
2,620,374
2,620,375
Is there a way to execute external Javascript from PHP when Javascript is disabled client side?
<p>I am using PHP to generate a dynamic web form that uses an external (to my site) javascript file to set a hidden form input value. My form submits to my own PHP page before reposting to an external site. The external site requires this hidden value for any submission.</p> <p>Many of the browser that are using my form do not have javascript enabled, so the tracking fails and I can not submit to the external site. Is there any method of executing the javascript file to get the tracking information from my php code without sending it to the clients browser? </p> <p>This is a pseudo code mock up of the code that I want to handle the form's post:</p> <pre><code>if ($doPOST) { //Check POSTed parameters for tracking id ($tid) if ($tid == ''){ //Execute external javascript to get tid } //Post form data to external site } </code></pre> <p>I have looked around and could not find any relevant information, but if you know of a site where this is explained let me know. For clarification, I am not looking for information about to incude a javascript file client side.</p> <p><strong>Edit:</strong> This is the Javascript executed by the form. I have no power to change this script. The number 48891 is not hardcoded in the script it changes with execution:</p> <pre><code>onReady=(function(ie){var d=document;return ie?function(c){var n=d.firstChild,f=function(){try{c(n.doScroll('left'))}catch(e){setTimeout(f,10)}};f()}:/webkit|safari|khtml/i.test(navigator.userAgent)?function(c){var f=function(){/loaded|complete/.test(d.readyState)?c():setTimeout(f,10)};f()}:function(c){d.addEventListener("DOMContentLoaded",c,false)}})(/*@cc_on 1@*/); var test_track=function(data){onReady(function(){document.getElementById('test_track').value = data.TID})} test_track({"TID" : "488891"}); </code></pre>
php javascript
[2, 3]
3,979,624
3,979,625
Using Scroll by for mobile devices
<p>I have a site that I'm building a mobile version for. I would like to be able to scroll the page down a bit when the page loads so I can hide the address section at the top of the page. I'm used to using window.scrollBy to move the page around, but it doesn't seem to work correctly on the mobile version.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { window.scrollBy(0,25); }); &lt;/script&gt; </code></pre> <p>I had put an alert after the window.scrollBy and when it goes off it does move correctly, but when it is finished loading the page moves back to the default starting point.</p> <p>m.engadget.com shows an example of what I want to have happen. Any ideas on how to replicate something like that? I'm using javascript, jquery and php.</p>
javascript jquery
[3, 5]
55,619
55,620
How to set height and width of the Icon of a Key on Keyboard
<p>I created my <code>Keyboard</code>. I need to show <code>icon</code> on one <code>Key</code>. </p> <pre><code> Keyboard.Key key; key = this.getKeys().get( 0); Drawable icon = context.getResources().getDrawable( iKeyIcon); // iKeyIcon - id of my file resource with icon key.icon = icon; </code></pre> <p>How can I set programmatically its height and width?</p>
java android
[1, 4]
2,503,678
2,503,679
Start Slideshow On Image Load
<p>I've got a simple slideshow I'm creating using jQuery for a Peruvian client at <a href="http://www.hostalandenes.com/" rel="nofollow">www.hostalandenes.com</a>. We have a relatively unique problem here in Peru that the internet tends to be extremely slow, and I think the slideshow looks cheesy when it starts and the images are only 10% loaded. </p> <p>Is there a way to trigger the start of the slideshow only when the images have loaded? I tried to trigger the start of the slideshow with a load binding to the first image, but that only triggered when the image is actually loaded from the server, and not from the cache.</p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
2,720,701
2,720,702
The process cannot access the file because it is being used by another process
<p>I am getting binary data from a SQL Server database field and am creating a document locally in a directory my application has permissions. However I am still getting the error specified in the title. I have tried numerous suggestions posted on the web including those suggested in previous posts on Stackoverflow. I have also used ProcessExplorer > Find Handle to locate the lock and it returns nothing as if the file is not locked.</p> <p>I am using the code below to save the file to the file system and I then try to copy this file to a new location later in the application process within another method. It is this copy method that takes the path of the newly created file that throws the exception.</p> <p>The file itself is created with its content and i can open it through Windows Explorer without any problems.</p> <p>Am I missing something completely obvious? Am I creating the file correctly from the database? Any help on solving or better diagnosing the problem would be much appreciated.</p> <pre><code>// Get file from DB FileStream fs = new FileStream( "C:\myTempDirectory\myFile.doc", FileMode.OpenOrCreate, FileAccess.Write); BinaryWriter br = new BinaryWriter(fs); br.Write("BinaryDataFromDB"); fs.Flush(); fs.Close(); fs.Dispose(); // Copy file File.Copy(sourceFileName, destinationFilename, true); </code></pre>
c# asp.net
[0, 9]
4,679,425
4,679,426
Capture the Window Screen for few minutes using ASP.net
<p>"Through out the question I just talk only on the client side using asp.net"</p> <p>My requirement is to "Capture the window screen for few minutes and store it as video of any format."</p> <p>For example if I want to capture the screen of the window and store in some jpeg or gif format, I can use the system.windows.forms library and can achieve as below code</p> <pre><code>public void StartCapturing(object sender, EventArgs e) { System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap as System.Drawing.Image); graphics.CopyFromScreen(25, 25, 25, 25, bitmap.Size); bitmap.Save(@"D:\Raghu\MyScreenshots\myscreenshot3.bmp", System.Drawing.Imaging.ImageFormat.Bmp); } </code></pre> <p>So my question is that is there any library that I can include so that it can satisfy my need by adding some code as simple as possible. I have seen some tools like snagit etc., but I could n't get clarity regarding that. Any clarifications are appreciated...</p>
c# asp.net
[0, 9]
4,812,659
4,812,660
how to display date value into the textbox from opened window
<p>when i click on link, a window opened with datetime picker, i want to select the date and display into one textbox using java script.</p>
c# asp.net javascript
[0, 9, 3]
2,312,431
2,312,432
Escape char problem while generating JavaScript page through Java code?
<p>I am generating <a href="http://en.wikipedia.org/wiki/JavaScript" rel="nofollow">JavaScript</a> pages through <a href="http://en.wikipedia.org/wiki/Java%5F%28programming%5Flanguage%29" rel="nofollow">Java</a> code like:</p> <pre><code>FileOutputStream fs=new FileOutputStream("C:\\Documents and Settings\\prajakta\\Desktop\\searcheng.html"); OutputStreamWriter out=new OutputStreamWriter(fs); out.write("&lt;script language='JavaScript' type='text/javascript'&gt;"); out.write("var str=new String('C:\\Documents and Settings\\prajakta\\Desktop\\substr.html');"); out.write("var beg=str.lastIndexOf('\\');");//double' \' **Problem Stmt** </code></pre> <p>And so on.</p> <p>The problem is when searcheng.html is created it contains</p> <pre><code>var beg=str.lastIndexOf('\');//single '/' </code></pre> <p>which creates a problem in finding index of '\'. How should I write this problem so that it will contain double "\"?</p> <p>Similarly how should I write a statement </p> <pre><code>out.write("document.write('&lt; a href='str'&gt; '+str.slice(beg+1,end)+' &lt;/a&gt;');"); </code></pre> <p>so that it will create statement in JavaScript as </p> <pre><code>document.write('&lt; a href=" 'str' "&gt; '+str.slice(beg+1,end)+' &lt;/a&gt;'); </code></pre> <p>and the link will go to page whose address is stored in <code>str</code>?</p>
java javascript
[1, 3]
4,739,248
4,739,249
Async postback doesn't cause document.ready to be executed
<p>I've had to implement some changes to a user control that's used in a couple of pages. The user control contains some JQuery to handle a paging task (displays 3 months of data and hides 9 at a time). When the control is loaded, it will automatically display the current quarter and executes this code in $(document).ready(). </p> <p>The problem I have is that in one of the pages the user control is used, the control isn't visible on page load. An async postback is used to change the visibility but this doesn't execute ready(). </p> <p>I found a snippet which allows the hosting page to intercept the EndResponse of the partial postback but I still can't execute the function within the usercontrol.</p> <p>Does anyone have any suggestions?</p> <p>Cheers</p> <p>Dave</p>
asp.net jquery
[9, 5]
3,232,406
3,232,407
Jquery slidedown if statement not comparing $(this)
<p>I have a list of buttons to be clicked on. I want a div to slide down if the link that is clicked is new, but if it is the same one that was last clicked, I just want the div to slide up.</p> <p>So my code is:</p> <pre><code>var $lastflyout = ''; $('.links-text a').each(function(){ $(this).click(function(){ if($(this) == $lastflyout) { alert('last equals'); $('#flyout').slideUp(500); } else { $('#flyout').slideUp(500); $('#flyout').slideDown(500); } $lastflyout = $(this); }); }); </code></pre> <p>And for some reason it is never alerting 'last equals', thus never getting into the first if statement. I tried alerting $lastflyout and it says that it is an object after the first click but I don't know why that first if statement isn't working.</p> <p>Thanks for the help.</p>
javascript jquery
[3, 5]
5,972,078
5,972,079
How to autoscroll to the end of iframe using JavaScript (or jQuery)?
<p>I have the following code:</p> <pre><code>&lt;iframe id="preview" onLoad="scrollToBottom()"&gt;&lt;/iframe&gt; </code></pre> <p>My objective - When the frame reloads, the "scrollToBottom()" function is triggered, which will take the user to the end of the iFrame (instead of the beginning of the frame, which is by default). The code I have now is:</p> <pre><code>function scrollToBottom() { window.scrollTo(0, document.body.scrollHeight); } </code></pre> <p>I know, somehow I have to figure/pass the scrollHeight of the iframe, but I am not sure how to do that. A solution in JavaScript or jQuery is what I want. There are a few solutions I saw here, but none of them are working for me. BTW...I don't need any animation or effects...just need a simple/plain solution.</p> <p>Any help will be appreciated. Thanks in advance.</p>
javascript jquery
[3, 5]
2,732,674
2,732,675
How to convert C++ code into java
<p>I am trying to convert C++ code to Java but am stuck at the following line</p> <pre><code>memcpy(cmd-&gt;CommandData+2, &amp;m_UnitData[i].Value, 2); </code></pre> <p>I also use cpp to java converter but it does not change anything here. <code>CommandData</code> and <code>UnitData</code> are byte arrays in my Java class.</p> <p>This is original cpp code:</p> <pre><code>unsigned char CommandData[255]; private SUnitData[] m_UnitData; cmd-&gt;CommandData[0] = SSP_CMD_SET_COIN_MECH_INHIBITS; cmd-&gt;CommandData[1] = 0x01; memcpy(cmd-&gt;CommandData+2, &amp;m_UnitData[i].Value, 2); </code></pre> <p>Are there any alternatives to <code>memcpy()</code> in java?</p>
java c++
[1, 6]
4,656,661
4,656,662
OnGenericMotionListener doesn't seem to be working
<p>This is really weird all other listeners work like onClick etc.. but this listener doesnt seem to be working, heres my code:</p> <pre><code>public class HeloActivity extends Activity implements OnGenericMotionListener{ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); View root = findViewById(R.id.root ); root.setOnGenericMotionListener(this); } @Override public boolean onGenericMotion(View v, MotionEvent event) { // TODO Auto-generated method stub Log.d( "special",v.toString() ); return false; } } </code></pre> <p>why is this not working?</p>
java android
[1, 4]
3,026,378
3,026,379
Click action on Focused DIV
<p>I have a div with tabindex attribute set to '-1' so it can gain focus on mouse click.</p> <pre><code>&lt;div tabindex='-1'&gt;&lt;/div&gt; .div:focus{//some style} </code></pre> <p>I want to do something with Jquery when the user clicks the div but only if it is selected (after second click).</p> <pre><code>$('div').click(function(){ if($(this).is(':focus')){ //do something } }); </code></pre> <p>But it doesn't work, the action is immediately triggered.</p> <p>EDIT: Code included. </p>
javascript jquery
[3, 5]
4,064,272
4,064,273
Registering Javascript with ScriptManager is working inconsistently
<p>I'm developing an ASP.NET page. Currently there is no AJAX on the page. in the code behind for different button click events, I am registering the script below. The purpose of the script is to scroll the window to a particular anchor tag. The method is as follows:</p> <pre><code>public void RegisterAnchor(string anchorTag) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "navigate", "window.onload = function() {window.location.hash='#" + anchorTag + "';}", true); } </code></pre> <p>I have two different anchor tags are that valid and defined in the same way. However, one is working and one is not. What can I check to identify the cause of this behavior? </p> <p>Anchor tag in ascx:</p> <pre><code>&lt;a name="EditDlg"&gt;&lt;/a&gt; </code></pre>
javascript asp.net
[3, 9]
1,423,988
1,423,989
jQuery load function can't won't load
<p>I've been working on this <a href="http://orchidaberdeen.com/" rel="nofollow">website</a> for quite some time now and i've encountered a bug that is trumping me at every point.</p> <p>The problem is in the gallery section of the site. When a user clicks on the circle the website splits open to reveal more thumbnails. When the user clicks on the smaller thumbnails a lightbox is supposed to appear. </p> <p>Sadly this is not the case, i think it's due to the fact that there is to much jQuery being loaded at once. As the thumbnail pages are external html files being loaded by jQuery so when i try to load the lightbox plugin the browser doesn't seem to want to load it.</p> <p>The lightbox effect works when the page is viewed on it's own individual pages for example here, <a href="http://orchidaberdeen.com/6_toggle/1.html" rel="nofollow">http://orchidaberdeen.com/6_toggle/1.html</a></p> <p>These are the things i've tried,</p> <pre><code>(function loading() { $.get('js/view.min.js?auto', function() { $('body').load('6_toggle/1.html#externalContent'); }); })(); </code></pre> <p>I've also tried this,</p> <pre><code>$(".plus_1").click(function() { $.getScript("js/view.min.js?auto", function(data, textStatus, jqxhr) { console.log(data); //data returned console.log(textStatus); //success console.log(jqxhr.status); //200 console.log('Load was performed.'); }); }); </code></pre> <p>This line of code is loading the external html files, </p> <pre><code>t_slide.load("6_toggle/"+page+".html", function() { </code></pre> <p>If anyone has any suggestions or knows of a fix that can re-trigger jquery after a page load or knows if this isn't even possible then it would be greatly appreciated.</p> <p>Many thanks,</p> <p>Cameron</p>
javascript jquery
[3, 5]
1,220,882
1,220,883
Deleting a directory
<p>I'm having some major trouble deleting directories. I'm working building a ADMIN tool to delete directories that my clients create but then ask to delete them. You would think this is simple:</p> <pre> <code> using (var context = Impersonator.LogOn(user, password, domain)) { try { dir = new DirectoryInfo(path); dir.Delete(true); } catch (Exception ex) { return string.Format("Error:{0}", ex.Message); } finally { context.Undo(); } } </code> </pre> <p>Now no matter what I do I can't delete the folder. response is alway "Access to the path is denied". I've doubled check the path, the login everything.</p> <p>Please tell me what I'm doing wrong.</p> <p>Server: win2008 web edition ASP.NET: 4</p>
c# asp.net
[0, 9]
4,498,102
4,498,103
why I used layoutinflater in android?
<p>I am a beginner developer in Android:</p> <p>Could you explain what <code>layoutinflater</code> does and can you explain what it is used for in general and especially in this code?</p> <p>I have this code :</p> <pre><code> private class MyPagerAdapter extends PagerAdapter { public int getCount() { return 5; } public Object instantiateItem(View collection, int position) { *** LayoutInflater inflater = (LayoutInflater) collection.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); int resId = 0; switch (position) { case 0: resId = R.layout.farleft; break; case 1: resId = R.layout.left; break; case 2: resId = R.layout.middle; break; case 3: resId = R.layout.right; break; case 4: resId = R.layout.farright; break; } View view = inflater.inflate(resId, null); ((ViewPager) collection).addView(view, 0); return view; } </code></pre>
java android
[1, 4]
5,068,789
5,068,790
C# Application and sql database on server
<p>I want to make an application in c# windows form but I want my database will be hosted on the server. Anyone please help me out how can I access my database using c# windows form application and insert data on the database which is hosted on the web server. Thanks </p>
c# asp.net
[0, 9]
1,264,991
1,264,992
scrolling issue jcover flip
<p>I am using jcover flip on my facebook application. On dragging the scroll bar towards the right first it scrolls back few images and then goes scrolls to right on scroll, due to which few images on extreme right do not get displayed.</p> <pre><code>&lt;script&gt; jQuery( document ).ready( function(){ jQuery( '#flip' ).jcoverflip({ current: 6, beforeCss: function( el, container, offset ){ return [ $.jcoverflip.animationElement( el, { left: ( container.width( )/2 - 210 - 110*offset + 20*offset )+'px', bottom: '20px' }, { } ), $.jcoverflip.animationElement( el.find( 'img' ), { width: Math.max(10,100-20*offset*offset) + 'px' }, {} ) ]; }, afterCss: function( el, container, offset ){ return [ $.jcoverflip.animationElement( el, { left: ( container.width( )/2 + 110 + 110*offset )+'px', bottom: '20px' }, { } ), $.jcoverflip.animationElement( el.find( 'img' ), { width: Math.max(10,100-20*offset*offset) + 'px' }, {} ) ]; }, currentCss: function( el, container ){ return [ $.jcoverflip.animationElement( el, { left: ( container.width( )/2 - 100 )+'px', bottom: 0 }, { } ), $.jcoverflip.animationElement( el.find( 'img' ), { width: '200px' }, { } ) ]; }, change: function(event, ui){ jQuery('#scrollbar').slider('value', ui.to*25); } }); jQuery('#scrollbar').slider({ value: 50, stop: function(event, ui) { if(event.originalEvent) { var newVal = Math.round(ui.value/25); jQuery( '#flip' ).jcoverflip( 'current', newVal ); jQuery('#scrollbar').slider('value', newVal*25); } } }); }); &lt;/script&gt; </code></pre>
php javascript jquery
[2, 3, 5]
2,044,600
2,044,601
How to clear browser history oan clear cache?
<p>I have a login page and a home page. User can log in from the login page to the home page using a username and password. What i want to achieve is :</p> <p>1) When user log out from home page he/she should not be able to come again to the home page by clicking the back or forward button in the browser.</p> <p>2) It is sure that the browser will store a history of the home page. But when the user click on the history link of the home page available in the browser it should be redirected to the login page instead of the home page.</p> <p>i have tried clearing the cache by using the following code like this in the home page page_load event</p> <pre><code> HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1)); </code></pre> <p>But it is not working.Any kind of help is highly appreciated.</p> <p>With regards</p> <p>Rain</p>
c# javascript asp.net
[0, 3, 9]
4,603,586
4,603,587
Handling board game fields with a loop?
<p>This is my first question here. I am writing a simple game on Android (my first one). It is a board game with 64 fields. Now every time one field is clicked something needs to be done. I figured a way to do it in this way:</p> <pre><code>switch(v.getId()) { case R.id.field1: ... ... ... } </code></pre> <p>It is working but it is kind of annoying for 64 fields. Can I somehow retrieve fields IDs and do it in a loop?</p> <pre><code>findViewById(R.id.field+i).doSomething(); </code></pre> <p>I know it cannot be done this way, I just want to ilustrate my thinking. The following would go in Javascipt but how to do it in Java? Is it possible?</p>
java android
[1, 4]
299,447
299,448
Bind List<Dictionary<string,string>> to DropDownList
<pre><code>var dict = new Dictionary&lt;string,string&gt;(); dict.Add("A","123"); dict.Add("B","456"); dict.Add("C","789"); dict.Add("D","000"); var list = new List&lt;Dictionary&lt;string,string&gt;&gt;(); //pretty much like a DataTable list.Add(dict); //more than one dict in the list //ddl is a dropdownlist ddl.DataSource = list ddl.DataTextField ="[A]"; ddl.DataValueField ="[C]"; ddl.DataBind(); </code></pre> <p>For WPF, I can do similar binding above, but not in asp.net.</p>
c# asp.net
[0, 9]
4,230,710
4,230,711
Android super.setContentView() in a method causes error?
<p>Why would calling super.setContentView() </p> <p>in a method cause the android process to terminate unexpectedly? but when I remove it it works fine?</p> <pre><code>package com.example.debuggingTest; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.*; public class TestDebugingActivity extends Activity implements OnTouchListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.start); ImageView start = (ImageView)findViewById(R.id.imageView1); Button signin = (Button)findViewById(R.id.button1); signin.setOnTouchListener(this); start.setOnTouchListener(this); } public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub Button signin = (Button)findViewById(R.id.button1); Button register = (Button)findViewById(R.id.button2); register.setText(event.toString()); signin.setText(String.valueOf(event.getPointerCount())); if(event.getPointerCount() &gt;= 3) { signin.setText("Working"); // //THIS CAUSES THE ERROR // super.setContentView(R.layout.linear); } return true; } } </code></pre>
java android
[1, 4]
4,393,330
4,393,331
How to show User name after login when not present in DB?
<p>On my website master page there are 2 divs- div_login and div_welcome. By default login div is visible and welcome div is hidden. When user fills his/her login details then div_login gets hide and welcome div appears. I am fetching data from web-service. On welcome div I want to give first name and last name of the user, but in case if user do not have his first name and last name in Database then welcome div appears but gives error. please help. Website link is [this][1]</p> <p>Code:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["myLogin"] != null &amp;&amp; Session["Pwd"] != null) { Login_Div.Visible = false; WelCome_Div.Visible = true; lblFName.Text = Sessio["lblFName"].ToStrin(); lblLName.Text = Session["lblLName"].ToString(); } else { WelCome_Div.Visible = false; Login_Div.Visible = true; } } } [1]: https://www.starbazaarindia.com/test/index.aspx </code></pre>
c# asp.net
[0, 9]
1,667,931
1,667,932
jQuery change events on docready
<p>I want to run part of a function when the page initially loads, but the majority of the <code>change</code> event should only run when the target is then subsequently interacted with.</p> <p>The problem is that the two events are not unrelated - on page load I want to show certain divs, and then I want a click action that shows/hides the divs. I can get these two parts to run separately, but haven't been able to combine them.</p> <p>My question is, what is the best way to achieve this separation? Is there a method in jQuery that says 'only run this part once' or 'run this part on page load, this part onclick'?</p> <p>As an example, I have this code that loads on Docready (which uses <code>.change();</code> so that it runs immediately):</p> <pre><code>$(function() { $('.trigger :checkbox').change(function() { $(this).parent().nextAll('ul.hidden').toggle(this.checked); }).change(); }); </code></pre> <p>But I alse want to run this code when someone clicks on one of my <code>.trigger</code> classes:</p> <pre><code>$('.trigger :checkbox').change(function() { var $target = $(this).parent().nextAll('.hidden'); // go up a level and then look for the next list with the hidden class $(this).parent().toggleClass('open'); // the class of the label needs to change, so find the parent of the checkbox $target.fadeToggle(); if( $(this).is(':checked') ) { $target.find('.hidden').css('display', 'none'); // hide all submenus } else { $target.find(':checkbox').removeAttr('checked'); // untick all checkboxes in sub-menu if unchecking } }); </code></pre> <p>Currently, the click event gets very confused.</p>
javascript jquery
[3, 5]
5,849,471
5,849,472
Android: Compare two Maps keys, if keys are equal create new object
<p>I have two <code>LinkedHashMap&lt;String, MyType&gt;</code> where keys can be common (say key from first map can be "key" and key from second map can be also "key". I need to compare this two maps and when keys are equal I want create new object where <code>firsMapEntry.getValue()</code> <code>secondMapEntry.getValue()</code> are attributes of new object [ <code>new MyObject(firsMapEntry.getValue(), secondMapEntry.getValue())</code> ]. Maps are in <code>Collection</code> so I iterate through collections. </p> <p>Here's my source:</p> <pre><code>firstIterator = firsCollection.iterator(); secondIterator = secondCollection.iterator(); while (firstIterator.hasNext() &amp;&amp; secondIterator.hasNext()) { Map&lt;String, MyType1&gt; firsMap = firstIterator.next(); Map&lt;String, List&lt;MyType2&gt;&gt; secondMap = secondIterator .next(); firstMapIterator = firstMap.entrySet().iterator(); secondMapIterator = secondMap.entrySet().iterator(); while (firstMapIterator.hasNext() &amp;&amp; secondMapIterator.hasNext()) { Map.Entry&lt;String, MyType1&gt; firstEntry = ((Map.Entry&lt;String, MyType1&gt;) firstMapIterator.next()); Map.Entry&lt;String, List&lt;MyType2&gt;&gt; secondEntry = ((Map.Entry&lt;String, List&lt;MyType2&gt;&gt;) secondMapIterator.next()); // Here I was trying to compare keys but unsuccessfuly // if keys are equal create new object My Object object = new MyObject(firsEntry.getValue(), secondEntry.getValue()); Map&lt;String, MyObject&gt; map = new LinkedHashMap&lt;String,MyObject(); map.put("key", object); } } </code></pre> <p>Return type of method is <code>List&lt;Map&lt;String, MyObject&gt;&gt;</code>. I don't know if my method is effecient, but how to compare two keys and create new object from values. Every help will be appreciated. Thank you.</p>
java android
[1, 4]
5,003,307
5,003,308
empty() then run the rest of the funtion
<p>I have some json that's loaded into <strong>li.ui-state-default</strong> pending user entry. </p> <p>The user can then enter a new entry. I want it to empty <strong>li.ui-state-default</strong> everytime a new entry is loaded but it seems to just stay empty.</p> <pre><code>//data for DOM var timeout = ''; $('.call-json').keyup(function () { clearTimeout(timeout); var val = this.value; timeout = setTimeout(function () { $('.ui-state-default').empty(); $.getJSON('json/' + val + '.json', function (data) { // load data var items = []; for (key in data[0].attributes) { if (key.match('.stat.prop.type')) { items.push(data[0].attributes[key]) } }; displaySortLabel(items, "type-details"); function displaySortLabel(items, parentClass) { $('&lt;span/&gt;', { 'class': 'el-data', html: items.join('') }).hide().fadeIn().appendTo('.' + parentClass + ' .sort-label'); } </code></pre>
javascript jquery
[3, 5]
4,205,623
4,205,624
accessing class that creates list from database
<p>I have the following Class which basically creates a list of categories (called commands, I know it's weird)</p> <p>Here is CommandDB.cs</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.Common; using System.Data.Sql; using System.Data.SqlClient; namespace TM_non_deploy { public partial class CommandDB { private static string connectionString = "blah"; public static List&lt;Command&gt; GetCommands() { List&lt;Command&gt; commandList = new List&lt;Command&gt;(); DbConnection connection = new SqlConnection(); SqlCommand cmd = (SqlCommand)connection.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_tm_commands"; connection.ConnectionString = GetConnectionString(); connection.Open(); SqlDataReader reader = null; reader = cmd.ExecuteReader(); Command command; while (reader.Read()) { command = new Command(); command.ID = reader.GetOrdinal("id"); command.Name = reader["name"].ToString(); commandList.Add(command); } reader.Close(); connection.Close(); return commandList; } private static string GetConnectionString() { return connectionString; } } } </code></pre> <p>my question is hopefully pretty simple, how do I, in my main page, access this list so that it calls the function and returns all the commands so I can iterate thru them? I thought it might be something like <code>List&lt;CommandDB&gt; commandList = new List&lt;CommandDB.&gt;GetCommands();</code> but I haven't really had any luck figuring it out thru the msdn. </p>
c# asp.net
[0, 9]
1,419,635
1,419,636
What is better to use several AsyncTask or HandlerThread(Pipeline Thread)?
<p>Is it good approach to have one <code>HandlerThread</code> in app for making different time spending actions,like,for example,sorting or maybe even for working with web/file streams? What is better to use for such purposes: several <code>AsyncTask</code>'s, several <code>Thread</code>s or one <code>HandlerThread</code> like <a href="http://hi-android.info/src/android/webkit/WebViewWorker.java.html" rel="nofollow">http://hi-android.info/src/android/webkit/WebViewWorker.java.html</a> ?</p>
java android
[1, 4]
5,296,629
5,296,630
How to maintain state of a Textbox in headertemplate of TemplateField in a GridView?
<p>I have a Gridview in which I have added a TemplateField, which contains TextBox and a Imagebutton in HeaderTemplate,</p> <p>When I click on the Imagebutton the textbox becomes blank.</p> <p>I wonder how do I save state of the textbox?</p> <pre><code> &lt;asp:TemplateField&gt; &lt;HeaderTemplate&gt; &lt;table width="100%"&gt; &lt;tr&gt; &lt;td align="center"&gt; Title&lt;br /&gt; &lt;br /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="center"&gt; &lt;table border="0" cellpadding="0" cellspacing="0"&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:TextBox ID="txtFilterTitle" runat="server" Width="105px" EnableViewState="true"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;td style="padding-left: 5px;"&gt; &lt;asp:ImageButton ID="imgbtnFilterTitle" ImageUrl="~/Images/Filter.png" Width="16" Height="16" runat="server" OnClick="RebindGrid" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;%# DataBinder.Eval(Container.DataItem, "PROD_TITL")%&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p><a href="http://i.stack.imgur.com/4xXZu.png" rel="nofollow">http://i.stack.imgur.com/4xXZu.png</a></p>
c# asp.net
[0, 9]
2,284,067
2,284,068
The type is deprecated
<p>I am using an AbsoluteLayout for a Activity and have it defined in a xml file.</p> <p>I added this line of code because I am trying to add a list of buttons dynamically and I get the following warning.</p> <pre><code>private AbsoluteLayout layout = (AbsoluteLayout) findViewById(R.id.viewsaved); The type AbsoluteLayout is deprecated </code></pre> <p>The code still appears to work properly, but I was just curious to see if anyone knows why this warning appears?</p> <p>Thanks for any help!</p>
java android
[1, 4]
1,434,844
1,434,845
Hide a div based on a select input box
<p>I was helped with some code <a href="http://jsfiddle.net/K9zGP/13/" rel="nofollow">here</a>. I tweaked it to try and hide a whole div instead of an element. It was only a small tweak but I seem to have done something to stop it working.</p> <p>HTML</p> <pre><code>&lt;input type="text" name="text-708" value="" class="wpcf7-validates-as-required" size="40"&gt; &lt;div id="added_fields"&gt; &lt;select name="menu-168" class="wpcf7-validates-as-required"&gt; &lt;option value="Residential"&gt;Residential&lt;/option&gt; &lt;option value="Commercial"&gt;Commercial&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre> <p>JS</p> <pre><code>if ($("select[name='menu-168']").val() == "Commercial") { $("#added_fields").addClass("hidden"); }​ </code></pre> <p>Would someone be kind enough to tell me where I have gone wrong?</p>
javascript jquery
[3, 5]
2,893,750
2,893,751
virtual table every instance get's on or every object?
<p>i have read about this metrial and i am still dont understand it's core e.g: </p> <pre><code>public static void Main() { person []p = new person[]{new student(),new worker()}; } public class person { public void f1() { } public virtual void f2() { } } public class student:person { public override void f2() { } } public class worker:person { public override void f2() { } } </code></pre> <p>does p[0] has it's own virtual table as an instance and so p[1] with one entry with f2 so every instance has it's own virtual table ?</p> <p>does every object has it's own virtual table ? </p>
c# c++
[0, 6]
3,002,947
3,002,948
Font picker Implementation
<p>I want to implement a font and color picker in my project. I implemented the color picker, I got it the code, but still I don't get the code to implement the font picker. Does any one know?</p> <p>Thanks in advance.</p>
php javascript
[2, 3]
1,662,154
1,662,155
Loading jQuery multiple times in the same page
<p>I'm implementing a plug-in that's embeddable in different sites (a la Meebo, Wibiya), and I want to use jQuery. Problem is, the site I'm embedding to, may already have a jQuery script loaded.</p> <p>The question is, what's the best approach for this kind of problem:</p> <ol> <li><p>Should I just check if jQuery is already loaded and if so, use the original site's jQuery, otherwise load it myself? If I use this approach, am I not risking comaptibility problems (i.e. the site uses an old version of jQuery)?</p></li> <li><p>Should I load jQuery myself (whether it's already loaded or not) and call "jQuery.noConflict(true)" when it's finished loading? If so, how can I make sure that <em>my</em> jQuery has finished loading (hooking to the onLoad event doesn't seem to work all the time, and polling for "jQuery" won't work for obvious reasons)?</p></li> <li><p>Should I do something else?</p></li> </ol> <p>Thanks.</p>
javascript jquery
[3, 5]
208,600
208,601
Application no longer works in lower android versions after setting android:targetSdkVersion
<p>After I set android:targetSdkVersion to 15, application doest work in 1.6 emulator. It throws java.lang.VerifyError.</p> <p>Edit: The app is crashing because I'm calling invalidateOptionsMenu, which came in API 11. Now even I check before calling it (if (VERSION.SDK_INT >= 11)). It still throws same error.</p>
java android
[1, 4]
899,832
899,833
Running JavaScript in PHP file
<p>I made a simple login using JavaScript, but record the username in a PHP session.It's a simple web chat, so I want when the chat page is loaded the user to be forced to pick an username, but after that I want to store that info ina a PHP session and if the page is reloaded for some reason to do a check if $_SESSION['UserName'] is empty and if it's not to stop the script from executing again.I put my login JS in <code>&lt;body onload..&gt;</code> and the code looks like this:</p> <pre> &lt;body onload = "showUser(), showChat(), &lt;?php if ($_SESSION['UserName']==""){ { Login(); }?>"> </pre> <p>I'm just learning now, so I gues I have some newb mistakes, like I'm almost sure that I'm not calling the <code>Login()</code> function right (it's JS function), but that's my strating point.Could anyone explain to me, how should I do the check properly and add the JS function in my PHP code?</p> <p>P.S And I don't know if this really matter but if I remove the PHP code and leave liek this:</p> <pre><code>&lt;body onload = "showUser(), showChat(),Login()"&gt; </code></pre> <p>My script is executed properly and I get everything that should be shown when the page is loaded, but when I add the PHP script and try to load the page I get blank page.I really wonder what's the reason for this too?</p>
php javascript
[2, 3]
2,349,076
2,349,077
XMLHttpRequest cannot load Origin null is not allowed by Access-Control-Allow-Origin
<p>I have a code.html file containing the following code.</p> <pre><code> $.ajax({ type: "POST", datatype: "JSONP", url: "path", success: function(msg){ var e = document.createElement("div"); e.id = "ads"; document.body.appendChild(e); $("#ads").html(msg); } }); </code></pre> <p>When I open the code.html file in the browser, it gives an error:</p> <pre><code>**"XMLHttpRequest cannot load file://..... Origin null is not allowed by Access-Control-Allow-Origin."** </code></pre> <p>Please help me!! how to avoid this problem</p>
php javascript
[2, 3]
4,387,133
4,387,134
download images dynamically with jquery in any container
<p>after searching google i got a code which works but this code download all the images at a time</p> <h2>code is</h2> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $("table[id*=dgImages] img").each(function () { $(this).attr("src", $(this).attr("original")); $(this).removeAttr("original"); }); }); &lt;/script&gt; &lt;asp:DataList ID="dgImages" runat="server" RepeatColumns="4" RepeatDirection="Horizontal" RepeatLayout="Table"&gt; &lt;ItemTemplate&gt; &lt;img src="images/ajax-loader.gif" original='&lt;%# Eval("photos")%&gt;' /&gt; &lt;/ItemTemplate&gt; &lt;/asp:DataList&gt; </code></pre> <p>whatever the images are there in datalist the code download all at a time. so i need to customize it that only visible images should download and when user scroll down then next visible images should download. so please guide me what to modify in my client script.</p> <p>thanks</p>
jquery asp.net
[5, 9]
211,606
211,607
Asp.net web app shows me as the logged in user on someone elses pc
<p>OK, I really don't know what to search for this, so hopefully someone can help me.</p> <p>I've just published an asp.net web application, and after much messing about finally got it to load in my browser.</p> <p>The issue however is that when I got my mate who is sitting next to me to open the site in his browser, the page showed me as the logged in user.</p> <p>In the default.aspx I run some code that grabs the users windows identity</p> <pre><code>LDAPDetails LDAPUser = new LDAPDetails(WindowsIdentity.GetCurrent().Token); </code></pre> <p>LDAPDetails then does this.</p> <pre><code>_UserName = windowsId.Name.Substring(windowsId.Name.IndexOf('\\') + 1); _DomainName = windowsId.Name.ToString().Remove(windowsId.Name.IndexOf('\\')); //Get users information from active directory DirectorySearcher search = new DirectorySearcher("LDAP://DCHS"); search.Filter = String.Format("(SAMAccountName={0})", _UserName); SearchResult result = search.FindOne(); if (result != null) { _FullName = result.Properties["givenName"][0].ToString() + ' ' + result.Properties["sn"][0].ToString(); _Email = result.Properties["mail"][0].ToString(); _FirstName = result.Properties["givenName"][0].ToString(); _SSID = windowsId.User.ToString(); _errMsg = ""; } </code></pre> <p>These values are then put into session variables. </p> <p>It seems that WindowsIdentity.GetCurrent().Token is still using my details even though its on a machine that i'm not logged into.</p> <p>Thoughts?</p>
c# asp.net
[0, 9]
5,672,680
5,672,681
jquery grabbing different id in document.ready
<p>I am writing a small script that will query a database for a title and whilst you enter your title it brings back suggestions.</p> <p>I have found an example and managed to create one as below:</p> <pre><code>&lt;head&gt; &lt;title&gt;Match Form/title&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type='text/javascript' src='jquery.autocomplete.js'&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" /&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $("#course").autocomplete("get_title_list.php", { width: 260, matchContains: true, mustMatch: true, selectFirst: false }); $("#course").result(function(event, data, formatted) { $("#course_val").val(data[1]); }); }); &lt;/script&gt; &lt;/head&gt; </code></pre> <p>That then works and allows to print out my result on the page, my next task is to have multiple text boxs along multiple titles and allow someone to search the database and then return the results to the allocated box.</p> <p>I know id need to assign each box an ID and then select that id in the jquery which is where i am struggling. Any help would be greatly appreciated!</p>
php jquery
[2, 5]
2,103,183
2,103,184
Using "~" in a path resolves as C:\
<p>I'm trying to implement a server control that frobs a couple of files inside the web directory of an ASP.NET site. I'm using VS Web Dev Express 2008 as my IDE. When I call <code>HttpContext.Current.Request.ApplicationPath</code> to get a path to the web root so I can find those files, it returns C:. What the heck?</p> <p>Absolute paths work just fine, but I'd like to be able to feed the server control a relative directory and just let it do it's thing. What have I done wrong?</p> <pre><code>public String Target { get { return _target; } set { if (value.StartsWith("~")) { // WTF? Gives me C:\? Why? _target = HttpContext.Current.Request.ApplicationPath + value.Substring(1); } else { _target = value; } } } private String _target; protected override void Render(HtmlTextWriter writer) { HtmlControl wrapper = new HtmlGenericControl("div"); int fileCount = 0; try { DirectoryInfo dir = new DirectoryInfo(_target); foreach (FileInfo f in dir.GetFiles()) { fileCount++; a = new HtmlAnchor(); a.Attributes.Add("href", f.FullName); a.InnerHtml = f.Name; wrapper.Controls.Add(a); } } catch (IOException e) { throw e; } Controls.Add(wrapper); base.Render(writer); } </code></pre>
c# asp.net
[0, 9]
338,821
338,822
How to set the width of a layout in Android?
<p>Is there Any way to set the width of the Layout.</p> <p>Because most of the time it doesn't work?</p>
java android
[1, 4]
4,197,354
4,197,355
How to iterate through each row and collect data
<p>Rows (id='row_property_'+number) in table contain four columns :</p> <ol> <li>select element (id='multiple_object_type_'+number)</li> <li>input type="text" (id='multiple_instance_id_'+number)</li> <li>nested table (id='table_properties_'+number)</li> <li>input type="button"</li> </ol> <p>How to iterate through each row and collect data in two arrays from select and input with jquery ?</p>
javascript jquery
[3, 5]
3,243,358
3,243,359
Is it possible to read the DOM and an HTML table with jQuery and Javascript?
<p>Have the user provide a URL.</p> <p>Open the URL (no need to display) and parse the DOM (read only, of course). Pull elements out of an HTML table and write to a text file?</p> <p>If so, can I get some pseudo code or a list of the jQuery selectors needed to make this happen?</p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
3,589,548
3,589,549
Hide everything between 2 h2 tags?
<p>I have the following html snippet;</p> <pre><code>&lt;h2&gt;Headline 1&lt;/h2&gt; &lt;p&gt;Lorem ipsum bla bla&lt;/p&gt; &lt;p&gt;Lorem ipsum bla bla&lt;/p&gt; &lt;p&gt;Lorem ipsum bla bla&lt;/p&gt; &lt;h2&gt;Headline 2&lt;/h2&gt; &lt;p&gt;Lorem ipsum bla bla&lt;/p&gt; &lt;h2&gt;Headline 3&lt;/h2&gt; &lt;p&gt;Lorem ipsum bla bla&lt;/p&gt; &lt;p&gt;Lorem ipsum bla bla&lt;/p&gt; </code></pre> <p>I wish to somehow, via jquery, target each "block" so i can append a div arround it. By "block" i mean all the code between h2 start-tag and down to the last p-tag, before the next h2 start-tag. The last h2-tag within the section, should just take the last p-tag.</p> <p>Any suggestions as to how i best do this?</p>
javascript jquery
[3, 5]
2,057,437
2,057,438
Disable a button (in a data list) after a single click by user
<p>I want to disable the button that is contained in a data list row. Is it possible to disable the button after it has been clicked once by the user? If so, can someone please suggest how I can achieve that.</p> <pre><code>&lt;asp:DataList ID="DataList1" runat="server" DataKeyField="Qno" OnItemCommand="DataList1_OnItemCommand" DataSourceID="SqlDataSource1"&gt; &lt;ItemTemplate&gt; &lt;asp:RadioButton ID="RadioButton1" runat="server" Text='&lt;%# Eval("Ans1") %&gt;' GroupName="qu" /&gt; &lt;br /&gt; &lt;asp:RadioButton ID="RadioButton2" runat="server" Text='&lt;%# Eval("Ans2") %&gt;' GroupName="qu" /&gt; &lt;asp:Button ID="Button2" runat="server" Text="Submit" CommandName="Validate" /&gt; &lt;br /&gt; &lt;/ItemTemplate&gt; </code></pre> <p></p>
c# javascript asp.net
[0, 3, 9]
3,566,767
3,566,768
Stopping autoslide of a slider programatically
<p>I have made a slider jquery plugin. The slider starts automatically in autoplay, but when the mouse hovers the slider it stops. There's a function for this, of course.</p> <p>My problem comes when i have a movie inside one of the slides. if the movie is playing, i want to stop the autoplay completely even if the mouse isnt hovering the slider.</p> <p>How can I call the "stop_autoslide" function inside the plugin, from outside it's code?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
2,232,901
2,232,902
Javascript alternative to jquery html()
<p>How would you write this jQuery method</p> <pre><code>$('body').html(node); </code></pre> <p>for setting html to node in Javascript?</p> <p>thank you</p>
javascript jquery
[3, 5]
1,368,697
1,368,698
How to get inner tr tag using JQuery?
<p>I am trying to grab documentnumber attribute from the tr tags inside tbody, and save it in an array.</p> <p>Below is the html , I am working on</p> <pre><code>&lt;tbody class="line-item-grid-body"&gt; &lt;tr data-group-sequence-number-field-index="" data-sequence-number-field-index="1" documentnumber="80" documentid="4133604" parent="80" class="line-item parent-line-item line-item-show reorderable-row droppable-element"&gt; &lt;td&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr data-group-sequence-number-field-index="" data-sequence-number-field-index="1" documentnumber="80" documentid="4133604" parent="80" class="line-item parent-line-item line-item-show reorderable-row droppable-element"&gt; &lt;/tr&gt; &lt;/tbody&gt; </code></pre> <p>and this is what I did, which is not working. If I don't specify particular class then system also grabs inner tr tags, which I don't want</p> <pre><code>var docs = jQuery("#line-item-grid").find('tbody').find("tr[class='line-item parent-line-item line-item-show reorderable-row droppable-element']"); for (i=1;i&lt;=docs.length;i++) { var tempValue = jQuery(docs[i]).attr('documentnumber'); alert(tempValue); } </code></pre> <p>Any ideas?</p>
javascript jquery
[3, 5]
4,734,121
4,734,122
jquery selector slow when 1000+ elements with 450Mhz machine
<p>I got something like this which contains about 1000 dom elements</p> <pre><code> &lt;table id="tableId"&gt; &lt;tr class="selected"&gt;&lt;td&gt;Text 1&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Text 2&lt;/td&gt;&lt;/tr&gt; ... &lt;tr&gt;&lt;td&gt;Text 500&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>problem is that i need to do something like this:<br /></p> <pre><code>y = new selected tr; $("#tableId").find("tr").removeClass("selected").eq(y).addClass("selected"); </code></pre> <p>The problem here is the selector itself who takes about 600ms to process which is kinda too long for the things we are doing.</p> <p>The machine im using uses a browser <strong>opera10</strong> and has only <strong>450Mhz</strong> running on linux!<br/> Do you guys think that the problem comes from the machine being that slow? </p> <p>Is there a way to improve the selector ?</p>
javascript jquery
[3, 5]
1,662,310
1,662,311
How To write a server side script using jsp and java and How to run it?
<p>I am new to this technology, I dont no how to write a server side program and how to run before jsp page start to load. Any one can you please guide me how to do it?</p> <p>Thanks in Advance, Ver</p>
java javascript
[1, 3]
3,196,241
3,196,242
gridview_RowCommand firing two times
<p>I am performing database update call by clicking on a button which resides on a gridview. It works fine it updates the database properly but the problem is that when i refresh the page it again perform the same operation(db update) i.e again call the RowCommand Event of Gridview. </p> <p>Here is my short code view:</p> <pre><code>protected void gridview_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "lnkBtn1") { userDetails obj=new userDetails(); bool flag=obj.Updatuser(); if (flag) { lblSucess.Visible = true; //this will binds updated table to grid this.BindGrid(); } else { lblError.visible=true; } } } </code></pre>
c# asp.net
[0, 9]
4,068,392
4,068,393
Save base64 encoded image into the file in PHP
<p>I have the following code : </p> <pre><code>&lt;?php header('Content-Type: image/png'); $data = "iVBORw0KGgoAAAANSUhEUgAAAuAAAAI8CAYAAACwIh5dAAAgAElkZJgRCXxOAuIPzzTlg......"; define('UPLOAD_DIR', '/home/Desktop/image.png'); $img = $data; $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $file = UPLOAD_DIR . uniqid() . '.png'; $success = file_put_contents($file, $data); print $success ? $file : 'Unable to save the file.'; ?&gt; </code></pre> <p>Here <code>$data</code> contain the encoded string of image in base-64. I want to save the image into the file. I did the previous code also go through lot of tutorial in google but it's not working. </p> <p>Can anyone help me where I am going wrong.</p> <p>Thanks in advance.</p>
php jquery
[2, 5]
1,236,871
1,236,872
Javascript confirm box blocks background
<p>I have a button in a GridView, and when it is clicked it triggers the </p> <pre><code>protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e) </code></pre> <p>event. In there I have some logic and at the end I am registering some javascript that generates a pop up. The issue I am having is that for the confirm pop up when it comes up. It shows a blank screen on the background and when I click cancel it shows it back again, otherwise it navigates to another page... But while the box is up the background is white.</p> <p>I need to make it so that it shows like the "Alert" pop up that still shows the website in the background. Please note I can only make this work with these pop ups as they are used throughout the website ("not confirm ones"). This is the first confirm box I have had to add but there are many Alerts on other pages. So would not like to change them as it will be too much work (150+ pages website).</p> <p>Thank you</p>
c# javascript asp.net
[0, 3, 9]
542,284
542,285
External looping of the variable
<p>How could I best loop the data through a variable that's nested inside a 'while' loop but it's called outside of it ? Like in this example:</p> <p>PHP:</p> <pre><code> $fr_q2 = mysqli_query($connect,"SELECT * FROM friends WHERE username ='".$_SESSION['user']."' ORDER BY id DESC"); while ($rowsPicFr2 = mysqli_fetch_array($fr_q2)) { $friends_q2[] = $rowsPicFr2['added_friend']; $frn[] = $rowsPicFr2['added_friend']; $frn2 = $rowsPicFr2['added_friend']; } $rowscheck = mysqli_num_rows($fr_q2); for ($i=0; $i&lt;$rowscheck; $i++) </code></pre> <p>HTML:</p> <pre><code> &lt;a href="#" onclick="remdata(&lt;?php echo $frn[$i]; ?&gt;)"&gt;YES&lt;/a&gt; </code></pre> <p>So I need to pass $frn[$i] into a remdata() function - but the $frn[$i] needs to loop....All I get is a string of all ids from 'friend_added' in $frn[$i]....Thanks.</p>
php javascript
[2, 3]
5,452,981
5,452,982
How to disable asp.net after click?
<p>I want to disable a server side asp.net button control after click for some seconds &amp; then fire a server side event. I am trying to use setTimeout but if I use setTimeout the server side event is never fired. Can anybody help?</p> <pre><code> &lt;script type="text/javascript"&gt; function disableBtn(btnId, dspTxt) { var btn = document.getElementById(btnId); btn.value = dspTxt; setTimeout(btn.disabled = true,1000); } &lt;/script&gt; </code></pre>
javascript asp.net
[3, 9]
2,961,216
2,961,217
How to handle single event for multiple Link button in c# asp.net
<p>I have A|B|C|D.....|Z link buttons on web forms . Now i have to add single event in code behind to handles all link buttons. How to do with C# asp.net</p>
c# asp.net
[0, 9]
3,586,649
3,586,650
Validate expression is not working in Internet Explorer 6 while working fine in I.E 8 and 9
<p>I have a change password page and on this page I have a regular expression validator as shown below</p> <pre><code> &lt;asp:RegularExpressionValidator ID="StrongPasswordValidator" runat="server" ControlToValidate="txtNewPassword" Display="Dynamic" ErrorMessage="New password must be from 8 to 50 characters long.It must contain atleast one digit and one uppercase.It cannot contain spaces &amp;amp; letters like /\'?&amp;gt;,&amp;quot;|" meta:resourcekey="StrongPasswordValidatorResource1" SetFocusOnError="True" ValidationExpression="^(?=.*\d)(?=.*[A-Z])(?!.*[\s\\'?&gt;/,&amp;quot;|]).{8,50}$" ValidationGroup="ChangePassword"&gt;&lt;/asp:RegularExpressionValidator&gt; </code></pre> <p>validation Expression is working fine in I.E 8 and 9 but not working in I.E 6, Could anyone help me please???</p>
javascript asp.net
[3, 9]
4,657,498
4,657,499
Java/Android class dependencies
<p>So I've inherited a rather large Android project. I'm trying to pull out the parts of the app that are no longer needed. Trouble is, there isn't anything I can remove that doesn't cause hundreds of compilation errors. Every class references so many other classes that it's almost impossible to remove anything. For example, if I delete an Activiy class, every other Activity in the project gets errors. </p> <p>This is bad practice right? I never really thought about it before. Obviously some classes need to reference other classes (Controllers -> Views), but not to the point where every class is intertwined, right?</p>
java android
[1, 4]
1,199,804
1,199,805
Adding optgroup in select menu
<p>I have a jQuery code which will create <code>select</code> from a <code>ul li menu</code>. I want to add <code>optgroup</code> from parent menu, but don't know how to. Here is my code:</p> <pre><code>// Create the dropdown base jQuery("&lt;select /&gt;").appendTo("#module-menu"); // Create default option "Go to..." jQuery("&lt;option /&gt;", { "selected": "selected", "value" : "", "text" : "Go to..." }).appendTo("#module-menu select"); // Populate dropdown with menu items jQuery("#menu a").each(function() { var el = jQuery(this); jQuery("&lt;option /&gt;", { "value" : el.attr("href"), "text" : el.text() }).appendTo("#module-menu select"); }); jQuery("#module-menu select").change(function() { window.location = jQuery(this).find("option:selected").val(); }); </code></pre>
javascript jquery
[3, 5]
5,396,212
5,396,213
What is the scope of a 'var' declared inside a function?
<p>Could someone clarify for me please... I've read that creating a variable using reserved word 'var' makes that variable public but how can that be if the variable was created inside a function: </p> <pre><code>$('#timeIn').timepicker({ 'scrollDefaultNow': true }); $('#timeIn').on('change', function() { var numIn = $('#timeIn').timepicker(('getSecondsFromMidnight')); var inHours = { hours: (numIn/86400)*24, getter: function() {return this.hours;} }; timeIn = $('#timeIn').val(); inArray.push(timeIn); events.push(timeIn); }); </code></pre> <p>In this example the variables numIn &amp; inHours are only known within that onChange method, correct? If that is the case what would the global declaration look like? The 'timeIn' is globally scoped but without manipulation I only get a string representation back. What are my options for getting a computable time back as return. </p>
javascript jquery
[3, 5]
5,096,169
5,096,170
Post a UTF-8 string to a servlet using jquery
<p>I'm trying to POSt a UTF-8 string to my servlet (hosted in TomCat) but the string read on the server side is not UTF-8. I've verified via firebug that the ajax header's content-type has the utf-8 encoding set. I'm posting "MÉXICO" to the server but I'm receiving "MÉXICO".</p> <pre><code>$.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/x-www-form-urlencoded; charset=UTF-8" }); $.ajax({ url: "SetData", type: 'POST', data: 'MÉXICO', success: function(){ console.log('Data set'); } }); </code></pre> <p>Here's the java code in the servlet</p> <pre><code>request.setCharacterEncoding("UTF-8"); BufferedReader reader = new BufferedReader( new InputStreamReader( request, "UTF-8" ) ); char[] chr = new char[5]; reader.read( chr ); builder.append( chr ); </code></pre> <p><strong>UPDATE 1</strong></p> <p>I changed the posting data in js to encodeURIComponent('MÉXICO') but the server still reads "MÉXICO".</p> <p>But, if I get the string value of encodeURIComponent('MÉXICO') i.e. 'M%C3%89XICO' it works! I'm zapped! Any idea why this should work?</p> <pre><code>$.ajax({ url: "SetData", type: 'POST', //data: 'MÉXICO', ** does not work //data: encodeURIComponent('MÉXICO'), ** does not work data: 'M%C3%89XICO', //works !!!! success: function(){ console.log('Data set'); } }) </code></pre> <p>;</p>
java javascript jquery
[1, 3, 5]
809,926
809,927
How to get current compass reading android 2.1
<p>How do I get the current compass reading in android 2.1? I know that I can initiate a listener and receive updates but I do not need constant updates I only need it to get the compass orientation when the user clicks a button.</p> <p>Also what is the most accurate way to get the compass orientation? </p> <p>Lastly, how do I send fake data to the android console. I know that you're supposed to use the terminal and send it commands but what are the commands I can't seem to find it on the Android website.</p> <p>Thank you</p>
java android
[1, 4]
4,106,447
4,106,448
How to attach class onClick event using JavaScript?
<p>I have a full AJAX page with elements that act like buttons (with events like <code>onclick="$('#workcont').load('pages/mypage.html #m3-to-12');"</code>). The elements being referenced are <code>&lt;li&gt;</code> and <code>&lt;tr&gt;</code> (in a table). </p> <p>How do I attach event handlers to add the class <code>selected</code> on click?</p>
javascript jquery
[3, 5]
2,544,546
2,544,547
AlertBox - Error occured while executing doInBackground()
<pre><code> public class IdAsync extends AsyncTask&lt;String, Void, Void&gt; { AlertDialog alertDialog = new AlertDialog.Builder(MainClass.this).create(); protected Void doInBackground(String... params) { . . alertDialog.setTitle("Reset..."); alertDialog.setMessage("R u sure?"); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //here you can add functions } }); alertDialog.show(); . .} </code></pre> <p>This gives Runtime error E/AndroidRuntime(16606): at android.app.Dialog.show(Dialog.java:241)</p>
java android
[1, 4]
2,090,885
2,090,886
Pressing Escape Key on Open File Dialog Fires a JavaScript Key Press
<p>I have an HTML dialog set to remove itself when the escape key is pressed. I have a file field in the HTML dialog. If a user is using the system file dialog to select a file for the file field in the HTML dialog and presses escape, that event closes the system dialog and also passes the escape key event to the browser, which also closes the HTML dialog. I want the HTML dialog to stay open, and don't want that event to hit the browser.</p> <p>How can I fix this?</p> <p>More info: This behavior is in Firefox.</p>
javascript jquery
[3, 5]
5,414,875
5,414,876
Hide DataPager if Pages = 1
<p>How do I hide the DataPager if there is only one page. I don't know how todo this but maybe in the DataPager Events I have a asp:Button when clicked it gets records of course but sometimes there will be only one record and I need to hide the pager if there is one record so it could be done on postback but I don't know what property is for the page count. If someone has the answer please leave a message thanks</p>
c# asp.net
[0, 9]
4,376,123
4,376,124
how to create rar/zipfile and download
<p>Hi frnds can anyone tel me how to Create a Zip File Using PHP? Actually i am having 10 files with boxes,if i select more than one check box that files should get zip/rar and i am able to save that in some path..</p> <p>Please can anyone help in this solution as i am new to php</p>
php javascript
[2, 3]
2,543,364
2,543,365
Focus on textfield and place marker at end of text with JS
<p>Following js look for the textfield q in queryform and focus it:</p> <p><strong>js:</strong></p> <p><code>if($("#queryform").length){ document.queryform.q.focus(); }</code></p> <p><strong>html:</strong></p> <pre><code>&lt;form id="queryform" name="queryform" action="" method="post"&gt;&lt;input type="text" name="q" /&gt;&lt;/form&gt; </code></pre> <p><strong>current function</strong></p> <p>In chrome: textfield is found and focused and text is highlighted</p> <p>In FF and IE: textfield is focused and marker is placed at the back</p> <p><strong>wanted function</strong></p> <p>Same in all browsers: textfield is focused, text not highlighted, marked at the end of the text</p> <p><strong>jquery</strong></p> <p>I already use jquery on the site so a neat jquery solution is preferable</p>
javascript jquery
[3, 5]
2,596,261
2,596,262
How do you store the visibility of a form into a variable in jquery?
<p>how do we check whether a input box is visible or not....then store its state into variable to be outpu via alert ?</p> <p>right now i'm using and i think it wrong. can any body help ?</p> <pre><code>&lt;input type="hello" name="hello" value="" style="visibility:hidden"/&gt; function testhideinput(){ var $input_state = $('input:text[name=hello]').is('visibility'); alert($input_state); } </code></pre>
javascript jquery
[3, 5]
5,070,822
5,070,823
Event listener, alert when jQuery is defined
<p>How do I create an alert after jQuery is loaded and fully usable?</p>
javascript jquery
[3, 5]
1,018,905
1,018,906
jQuery Ajax call No element found issue
<p>I am getting a javascript error on firefox 3.5, when trying to call an ajax method.</p> <p>Please find the error below:</p> <pre><code>XML Parsing Error: no element found Location: moz-nullprincipal:{1a2c8133-f48f-4707-90f3-1a2b2f2d62e2} Line Number 1, Column 1: ^ </code></pre> <p>this is my javascript function:</p> <pre><code>function Update(Id) { $.ajax({ type: "GET", url: ROOT_URL + "/sevice/udates.svc/Update?Id=" + Id, success: function(response) { }, async: false }); } </code></pre>
javascript jquery
[3, 5]
4,771,584
4,771,585
$.getJSON trigger select change event
<p>I'm trying to add categories to a drop down list using jQuery Ajax. When an option is selected I would like to load the subcategories.</p> <p>The problem that I'm facing is that the addition of options to the drop down list by the Ajax function seems to trigger the change event as well. How can I avoid this or rewrite my code better in order to avoid this behavior?</p> <p>Here's my code:</p> <pre><code>categoryHelper.loadLevel1 = function () { // The control that needs to be filled with categories var $control = $("#select1"); // This function runs $.getJSON() and fills the drop down list // with option elements fillDropDown(url, null, $control); // When I select a value I want to run the function loadLevel2 which // takes the currently selected value from level 1 as parameter $control.change(categoryHelper.loadLevel2($control.val())); }; </code></pre> <p>Code for the fillDropDown:</p> <pre><code>function fillDropDown(url, parameters, dropdown) { /// all data has been loaded&lt;/param&gt; $.getJSON(url, parameters, function (data) { $(dropdown).empty(); $(dropdown).append(createOption("", "")); $(data).each(function () { $(dropdown).append(createOption(this.value, this.text)); }); }); } </code></pre> <p>All help is appreciated!</p>
javascript jquery
[3, 5]
629,565
629,566
Generate a form from an object in ASP.NET
<p>Are there any tools available for ASP.NET that will let you generate a form from an object.</p> <pre><code>CoolLibrary.GenerateFormFromObject(myObject); </code></pre> <p>I can imagine using reflection to bind to various controls, and using the type of fields to determine what type of control to generate (ie if <code>List</code> then generate a <code>DropdownList</code> control). </p> <p>Has anyone built anything like this? (Am I mistaken in thinking this isn't too hard to do?). I see references on the web of people using reflection to bind to forms, but I haven't found anyone generating forms using reflection. </p>
c# asp.net
[0, 9]
605,560
605,561
Flexible enable/disable logging in Android app
<p>For performance wise, some people suggest use the following method, e.g.</p> <pre><code>public class MyActivity extends Activity { private static final String TAG = "MyApp"; private static final boolean D = true; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(D) Log.e(TAG, "MyActivity.onCreate debug message"); } </code></pre> <p>But this is non-senese when are working on a large project, because when you debug, you need to update many files for the <code>debug</code> flag, are there any better method?</p>
java android
[1, 4]
2,847,564
2,847,565
How to handle the Close Button click event on my popup window using jquery
<p>I have this code in my Master page.</p> <pre><code>PopUpWindow = function (titles, message) { document.getElementById('window').innerHTML = message; $("#window").dialog({ resizable: true, height: 140, title: titles, width: 500, message: "something here", modal: true, buttons: { "Close": function () { $(this).dialog("close"); } } }); }; &lt;div id="window" style="display: none;"&gt; &lt;/div&gt; </code></pre> <p>I can able to display the popup mesage perfectly.. My questions is.. </p> <p>I have this code in my controller.</p> <pre><code> return new JavaScriptResult() { Script = "alert('saved Successfully Added. Thank You.'); window.location='/ObnCategory/Index';" }; </code></pre> <p>I changed the code to </p> <pre><code> return new JavaScriptResult() { Script = "PopUpWindow("saved","something here"); window.location='/ObnCategory/Index';" }; </code></pre> <p>Here I am getting the popup perfectly but the problem is the popup closing automatically without clicing close button. due to window.location?</p> <p>can any body tell me how to load the page after close button click.. </p> <p>PopupWindow is generic I can not keep window.location on popupwindow script?</p> <p>thanks</p>
javascript jquery
[3, 5]
1,685,973
1,685,974
java generics and c++ templates
<p>I am little confused on how templates in c++ and generics in java work. it would be helpful if someone explained me how this java code will be c++:</p> <pre><code>public class Box&lt;T&gt; { private T t; public void add(T t1) { this.t = t1; } public T get() { return t; } public &lt;U&gt; void inspect(U u){ System.out.println("T: " + t.getClass().getName()); System.out.println("U: " + u.getClass().getName()); } public static void main(String[] args) { Box&lt;Integer&gt; integerBox = new Box&lt;Integer&gt;(); integerBox.add(new Integer(10)); integerBox.inspect(10); } } </code></pre>
java c++
[1, 6]
2,629,007
2,629,008
Generate Total Price, multiple products on one page
<p>I'm trying to generate the total price on a one page store.</p> <p>I have different products on the same page laid out like this within a foreach:</p> <pre><code>&lt;input type="hidden" name="price_&lt;?=$product_id?&gt;" value="&lt;?=$product_price?&gt;" /&gt; &lt;input type="text" name="&lt;?=$product_id?&gt;" value="" onchange="calculateTotal();" /&gt; </code></pre> <p>So, the first input is hidden and contains the price of the product. The second input contains the quantity, with the name set as the product_id. The only issue is that there can be multiple inputs on one page.</p> <p>Which would be the best way to do it? Either using Javascript to calculate the price, or an Ajax post and using PHP to do the calculations.</p>
php jquery
[2, 5]
3,091,418
3,091,419
How to combine Activities on Android?
<p>I have an a Java Android app that calls different activities. I thought this was how you would go about doing some object encapsulation (these three different activities show different screens but all relevant to the function of the program). </p> <ol> <li>The first is the main GUI and main page of the App.</li> <li>The next essentially parses an XML file and displays some text-based output.</li> <li>Finally the third is a map viewer that builds a map based on the XML file read in the second Activity.</li> </ol> <p>The problem I'm having is that these show up as 3 different activities on the phones. Is there anyway to encapsulate them in just one activity, or is there another method I should go about using to create multiple different screens in one app?</p> <p>Thanks</p>
java android
[1, 4]
1,145,922
1,145,923
Android TextView cannot be resolved
<p>Hello iam getting a problem now with android text view, saying it cant be resolved to a type and i cant fully follow. here is my code</p> <pre><code>i mport android.app.ListActivity; import android.os.Bundle; import android.widget.TextView; public class HttpLTC extends ListActivity { TextView httpStuff; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.bustime); httpStuff = (TextViw) findViewById(R.id.arrivaltime); } } </code></pre> <p>on a side note, im trying to follow a tutorial and i can no longer choose TextView in the grapical side of the XML page on Eclipse, has this changed in the newest SDK?</p>
java android
[1, 4]
4,263,606
4,263,607
how to get dropdown selecteditem in server side when I have set options using javascript
<p>I have set options on dropdownlist using javascript and cant able to get selectedItem. Any idea?</p>
c# javascript asp.net
[0, 3, 9]
1,705,393
1,705,394
How can I load another usercontrol from a visible usercontrol, who is available in the Default.aspx?
<p>How can I load another usercontrol from a visible usercontrol, who is available in the Default.aspx? </p> <p>I select in that case a name of page from a DropDownList. </p> <p>After this event the visible usercontrol will be replaced by the selected usercontrol.</p> <p>The source in Default.aspx</p> <pre><code>&lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt; &lt;div&gt; &lt;br /&gt; &lt;asp:PlaceHolder runat="server" ID="PlaceholderAddressTemplate" &gt;&lt;/asp:PlaceHolder&gt; &lt;br /&gt; &lt;asp:Label ID="lblUser" runat="server"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;/asp:Content&gt; </code></pre> <p>in Default.aspx.cs ...</p> <pre><code>PlaceholderAddressTemplate.Controls.Clear(); int iIndex = Functions.GetItem(PageIndex); _Address = null; switch (iIndex) { case 1: _Address = (uclFirst)Page.LoadControl("~/UserControls/uclFirst.ascx"); break; case 2: _Address = (uclSecond)Page.LoadControl("~/UserControls/uclSecond.ascx"); break; default: _Address = (uclHome)Page.LoadControl("~/UserControls/uclHome.ascx"); break; } </code></pre> <p>PlaceholderAddressTemplate.Controls.Add(_Address);</p> <p>and in uclHome.ascx.cs something like this...</p> <pre><code>protected void OnSelectedIndexChanged(object sender, EventArgs e) { (Default)this.Parent.Page. _default = new Default(); // _default.Page Example1.Text = ddlNames.Items[ddlNames.SelectedIndex].ToString(); } </code></pre> <p>Thanks...</p>
c# asp.net
[0, 9]
5,956,845
5,956,846
Can I use php in javascript?
<p>Begginer's question.</p> <p>Can I use PHP in javascript?</p> <p>For example in jquery,</p> <pre><code>... ... triggers.eq(1).post('&lt;?php admin/categories/delete/'. $list['id']; ?&gt;); </code></pre>
php javascript
[2, 3]
4,337,221
4,337,222
How to get the parameter value from URL in Jquery?
<p>Hi all i have an url where i need to get an parameter from the url</p> <pre><code> var URL="http://localhost:17775/Students/199/Kishore" //here from the url i need to get the value 199 </code></pre> <p>this is what i had been trying but the value is null here </p> <pre><code> function getURLParameter(name) { return parent.decodeURI((parent.RegExp(name + /([^\/]+)(?=\.\w+$)/).exec(parent.location.href) || [, null])[1]); }; $(document).ready(function() { getURLParameter("Students"); //i need to get the value 199 from the url }); </code></pre>
javascript jquery
[3, 5]
3,381,533
3,381,534
Is there any way to make an email's subject bold?
<p>I am sending email using C#.NET, for which I am using <code>System.Net.Mail.MailMessage</code> class. I want to make a portion of the email's subject bold. Is there any way to do it?</p>
c# asp.net
[0, 9]
4,623,803
4,623,804
how to do a getElementById on an ASP.NET control
<p>I have an element on my page.</p> <pre><code>&lt;asp:Button ID="buttonToFind" runat="server" OnClick="SomeProcess" /&gt; </code></pre> <p>In javascript I'm trying to find this control using:</p> <pre><code>document.getElementById("buttonToFind"); </code></pre> <p>However it can't seem to find the control. My understanding is that the asp:Button gets changed to an input element? This input has a new ID that contains the original ID but with a lot of extra characters therefore I can't find the original ID on the page?</p> <p>Is this correct?</p> <p>Also given this how would I go about specifying the correct ID to search for?</p>
javascript asp.net
[3, 9]
2,548,010
2,548,011
Script not running jquery .each
<p>This is a snippet from a puzzle game I'm trying to develop. The problem is it stops working after <code>each()</code> of jquery is called. Please help me figure out the problem. Thanks in advance.</p> <pre><code> function setTotalInPositionPieces() { $("#board").children('div').each(function(index, element) { if(testInPosition(element)) { ++totalInPositionPieces; $(element).attr("data-inPositionStatus", '1'); } }); /* The script does not from here, onward. Please tell me what is the problem. Thanks in advance.*/ if(totalInPositionPieces == totalPieces) { $("#messageBox").text("Puzzle Solved!"); } } </code></pre> <p><code>totalInPositionPieces</code> and <code>totalPieces</code> are global variables.</p>
javascript jquery
[3, 5]
1,864,982
1,864,983
recognize which span tag triggered javascript function in div
<p>I have a div html element that has a click event set on it inline (not the way I want to do it but legacy code). See here</p> <pre><code>&lt;div class="myDiv" onclick="triggerJavascript();" id="myDiv"&gt; &lt;span id="text1"&gt;Text 1&lt;span&gt; &lt;span id="text2"&gt;Text 2&lt;span&gt; &lt;span id="text3"&gt;Text 3&lt;span&gt; &lt;span id="text4"&gt;Text 4&lt;span&gt; &lt;span id="text5"&gt;Text 5&lt;span&gt; </code></pre> <p></p> <p>What I want to do is recognize which span tag the click event originates from test5, then dont carry out the logic in triggerJavascript function, otherwise complete logic in triggerJavascript.</p> <p>How can I set this up? I am working with jquery.</p>
javascript jquery
[3, 5]
4,887,032
4,887,033
add image dynamiacally based on count in ASP.NET
<p>suppose I have 5 check boxes. Based on number of check box checked I have to add image and hyper-link to images. (i.e if I have checked 2 check box I have to load only 2 image and link to those 2 loaded images, in-case of 3 check box checked, 3 images needs to be loaded and link to those 3 loaded images).</p> <p>Is there any possible way that I can do that in asp.net using c#?</p>
c# asp.net
[0, 9]
4,185,653
4,185,654
C# Pager issue with dropdown
<p>I have create a ajax pages custom control with previous and next link and now when I am adding a drop down to the controls it is not working as desired..</p> <p>I have used the code form <a href="http://www.flixon.com/Articles/Custom-ASPNET-Data-Pager-Control-22.aspx" rel="nofollow">http://www.flixon.com/Articles/Custom-ASPNET-Data-Pager-Control-22.aspx</a></p> <p>When I am adding a drop down then on selected index change the previous and next button are getting disappeared. I believe this is due to I am binding the drop down in pre render event</p>
c# asp.net
[0, 9]
796,943
796,944
Using jquery how can I remove a DIV if it's contents are empty?
<p>I'm looking for a way to remove the following empty div using jquery.</p> <p>The following div is output sometimes without content inside it. For display reasons I need to remove it when it's empty.</p> <pre><code>&lt;div class="field-group-format group_call_to_action_aside div group-call-to-action-aside box yellow speed-fast effect-none"&gt;&lt;/div&gt; </code></pre> <p>Thoughts?</p> <p>I've been trying the following and variations of it, but have't had any luck. </p>
javascript jquery
[3, 5]
898,577
898,578
Output page not rendered correctly
<p>I created a page with some controls on it. When I put "&lt;% label.Text = "changed";%>" after the definition of Label, Label's text value is not rendered after the page is executed. Why?</p> <pre><code>&lt;div&gt; &lt;tagprefix:MD ID="CC" runat="server" /&gt; &lt;asp:TextBox runat="server" ID="TextBox1"/&gt; &lt;asp:Button Text="button" ID="Button" runat="server" onclick="Button_Click" /&gt; &lt;%= "Hello..." %&gt; &lt;% label.Text = "changed"; %&gt; //working fine &lt;asp:Label ID="label" Text="text" runat="server" /&gt; &lt;% label.Text = "changed"; %&gt; // do not work &lt;/div&gt; </code></pre>
c# asp.net
[0, 9]
5,544,169
5,544,170
disable default behaviour of Internet Explorer
<p>I am using asp.net C#.</p> <p>I have one html input field, and 3 image buttons (asp.net controls)</p> <ul> <li><p>ImageButton 1 = perform delete operation</p></li> <li><p>ImageButton 2 = perform Edit operation </p></li> <li><p>ImageButoon 3 = perform duplicate operation</p></li> </ul> <p>My problem occurs when the user presses the enter key when the input field is in focus. When he presses the enter key the browser automatically fires by default the next button. In my case it is the delete operation.</p> <p>How can I prevent this? </p>
c# asp.net
[0, 9]