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,025,258
| 3,025,259
|
Opening a select box using js in Android web browser
|
<p>I have a standard <code><select></code> and would like to open it when a user clicks on another element. It's pretty simple in a regular browser and even on the iphone, but for some reason nothing working on Android.</p>
<p>I've tried the click and focus events, and also tried changing the size attribute of the select but none of these worked.</p>
<p>Has anyone accomplished this before?</p>
|
javascript jquery android
|
[3, 5, 4]
|
3,801,263
| 3,801,264
|
Drop down list issue
|
<p><strong>Html</strong></p>
<pre><code> <a id="btn" class="btn" href="#."></a>
<div id="main-dropdown" class="hide">
<ul id="dropdown">
<li><a href="/">Back </a></li>
<li><a href="/foo">Foo </a></li>
<li><a href="/bar">Bar </a></li>
<li><a href="/baz">Baz </a></li>
<li><a href="/no">No Bar </a></li>
</ul>
</div>
</code></pre>
<p><strong>Jquery</strong></p>
<pre><code>$(".btn").click(function(e) {
e.preventDefault();
$("#main-dropdown").removeClass('hide');
$("#main-dropdown").addClass('show');
return false;
});
$("#dropdown").mouseup(function() {
return false
});
$(document).mouseup(function(e) {
if($('#main-dropdown').hasClass('show')) {
$("#main-dropdown").removeClass('show');
$("#main-dropdown").addClass('hide');
return false;
}
$("#main-dropdown").removeClass("show");
$("#main-dropdown").addClass("hide");
});
</code></pre>
<p>Problem:
When I click on the href (id = btn) a drop down comes but when I again click on that button is should hide
which is not happening. Where i am doing wrong.</p>
|
javascript jquery
|
[3, 5]
|
1,585,129
| 1,585,130
|
jQuery clickable not checked input:checkbox? select all check boxes?
|
<p><strong>Q1:</strong> I create a "jQuery clickable" I want when click on <code>input:checkbox</code> in rows checked <code>it input:checkbox</code>(like when click on rows)</p>
<p><strong>Q2:</strong> I want when click on <code>input:checkbox(no row)</code> in "first row(tr)" <strong>select all check boxes</strong>?
<p>
<strong>EXAMPLE:</strong> <a href="http://jsfiddle.net/tKBJ2/3/" rel="nofollow">http://jsfiddle.net/tKBJ2/3/</a></p>
<pre><code>$('.table_show tr, .table_show tr input[type="checkbox"]').live('click',function(){
checkBox = $(this).find("input").prop('checkbox', true);
$id = $('input:checkbox:checked').val();
if (checkBox.prop('checked')) {
$(this).css('backgroundColor', "");
checkBox.prop('checked', false);
}
else {
checkBox.prop('checked', true);
$(this).css('backgroundColor', "#ffd6c1");
}
});
</code></pre>
<p>With respect</p>
|
javascript jquery
|
[3, 5]
|
5,020,604
| 5,020,605
|
jQuery UI Multiselect Events
|
<p>I'm using <a href="http://www.quasipartikel.at/multiselect/" rel="nofollow">this</a> Multiselect jquery component. and I can't figure how to trigger and subscribe to the events of this thing. (I'm new to js).</p>
<p>What I've been trying so far is to trigger a collectionChanged event in the _updateCount function of the ui.multiselect.js file:</p>
<pre><code>_updateCount: function() {
this.selectedContainer.find('span.count').text(this.count + " " + $.ui.multiselect.locale.itemsCount);
//How do I subscribe to the event?
$(this).trigger('collectionChanged');
}
</code></pre>
<p>Then I'm trying to subscribe to the 'collectionChanged' event from asp.net:</p>
<pre><code> $('#<%= dropDown.ClientID %>').bind('collectionChanged', function ()
{
alert("Changed!");
});
</code></pre>
<p>The generated page markup is this:</p>
<pre><code><select name="ctl06$dropDown" id="ctl06_dropDown" class="multiselect" multiple="multiple" name="countries[]">
<option value="1134">A</option>
<option value="1980">B</option>
<option value="17789">C</option>
<option value="180367">D</option>
<option value="1990673">E</option>
</select>
<script type="text/javascript">
$(function () { $('.multiselect').multiselect(); });
$('#ctl06_dropDown').bind('collectionChanged', function ()
{
//Not working (never triggerd)
alert("Changed!");
});
</script>
</code></pre>
<p>Thanks.</p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
2,140,214
| 2,140,215
|
C# and Javascript Variable
|
<p>I have a variable that is like this:</p>
<p><code>var dependentVar = "'<%: somevalue %>', '<%: somevalue2 %>', '<%: somevalue3 %>'";</code></p>
<p>Which must be passed into a another variable </p>
<p><code>var newVar = new var.Function(dependentVar)</code>. </p>
<p>The function is like</p>
<p><code>function(somevalue, somevalue2, somevalue3)</code></p>
<p>The problem I am facing is that when the variable is passed - it passes like this</p>
<p><code>"'123123', '123123123', '123123123'"</code></p>
<p>and it errors due to the <code>"</code> ? How can I fix this ?</p>
|
c# javascript jquery
|
[0, 3, 5]
|
3,821,608
| 3,821,609
|
Repeater Retrieve the previous index Property value
|
<p>I am using the Repeater control in Asp.net.</p>
<p>I have scenario where based on the condition i have to Retrieve the previous index Property value.</p>
<p>Please, help.. </p>
|
c# asp.net
|
[0, 9]
|
2,468,742
| 2,468,743
|
Javascript post data and head to next page
|
<p>I have a php page can check user's data, if data are correct, those data will pass to next page. </p>
<p><code>if(data are correct){header("location:nextpage.php?data=...");}</code></p>
<p>However I don't want those data to show on address bar. Since I can't use post here. Is possible to use javascript or Jquery to achieve this?</p>
|
php javascript jquery
|
[2, 3, 5]
|
4,120,959
| 4,120,960
|
Passing values from ASP.NET to PHP
|
<p>Is there anyway to pass values from ASP.NET to PHP easily using Session or any other? I tried in the below way but it didn't work for me. Anybody either correct the below code or suggest me a way to pass values from ASP.NET to PHP without using URL query string.</p>
<p>ASP.NET code.</p>
<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
HttpCookie cookie = new HttpCookie("myvalue1");
cookie.Value = "joe@example.com";
Response.Redirect("Default.php");
}
</code></pre>
<p>PHP code.</p>
<pre><code><?php
session_start();
$_COOKIE['myvalue1'];
$cookies = getCookies();
$sessionId = $cookies['myvalue1'];
?>
</code></pre>
|
php asp.net
|
[2, 9]
|
5,386,244
| 5,386,245
|
how to get current date in the below format using jquery
|
<p>how to display the date in this below format using jQuery.</p>
<pre><code>Thursday, January 08, 2013
</code></pre>
<p>I saw some plugins but wondering if there is a way without using any plugin.</p>
<p>Please advise if there is a straightforward answer using JavaScript, that's fine too.</p>
|
javascript jquery
|
[3, 5]
|
4,131,114
| 4,131,115
|
Pass value between asp.net web page
|
<p>I'm using asp.net with c# in backcode. On my first page, I have a hyperlink with
<code>NavigateUrl ="Order.aspx?productId = " + ProductID</code> . I want to transfer <code>ProductID</code> in <code>Order.aspx</code> file.
So, how to get it in target file :<code>Order.aspx</code>.</p>
<p>I used a lable to display in Order.aspx file </p>
<p><code>string productId = Request.QueryString["productId"];</code></p>
<p><code>lblTest.Test = productId</code></p>
<p>But <code>lblTest</code> didn't display anything</p>
<p>Thanks.</p>
|
c# asp.net
|
[0, 9]
|
1,833,373
| 1,833,374
|
Display tip on home page by day number in asp.net
|
<p><strong>Scenario:</strong>.I have 30 tips in xml file, now I want to display it on home page by day number.</p>
<p>For example, today is the 12th then tip number 12 will be displayed on the home page and after that 13 and so on. After 30 tips it will start from tip 1.</p>
<p>I have tried following code</p>
<pre><code>public class TipReader
{
private const string TIP_XML_PATH = @"C:\temp\tips.xml";
public static int GetTipNumber()
{
int tipNo = 1;
if (DateTime.Now.Day >0)
{
if (DateTime.Now.Day == 31)
{
tipNo = 1;
}
else if (DateTime.Now.Day == 28)
{
tipNo = DateTime.Now.Day + 1;
}
else
{
tipNo = DateTime.Now.Day;
}
}
return tipNo;
}
public IEnumerable<Tip> GetTipByID(string ID)
{
var result = from tip in XDocument.Load(TIP_XML_PATH).Descendants("Tip")
where (string)tip.Element("ID")==ID
select new Tip
{
ImageUrl = (string)tip.Element("ImageUrl"),
Title = (string)tip.Element("Title").Value,
Desciption = (string)tip.Element("Description"),
};
return result;
}
}
</code></pre>
<p>Now, I am facing issue on GetTipNumber. How would I handle date greater than 30 and less than 30.
<strong>If you have better solution for this please suggest me.</strong>
Thanks in advance</p>
|
c# asp.net
|
[0, 9]
|
1,095,969
| 1,095,970
|
Best Framework for making webbased games in java
|
<p>I have been research tihs topic in web for a while and i want to make a webbased strategy game which can be fast and efective. But my game will not be a graphical game. my game will be like that players will make castles armies, ships etc. Then players going to battle with each other. So ı am stuck with java or php. I dont know php as well </p>
|
java php
|
[1, 2]
|
1,728,654
| 1,728,655
|
c# and checkboxes in asp.net
|
<p>Hy all,</p>
<p>I want an idea from you.I have 2 tables.From table1 I want to populate a checkboxlist and from table2 I want to also populate a checkboxlist but depending on the first checkboxlist.So if I have 5 rows in table1 then 5 checkbox. I want if I check the first checkbox some others checkbox appear with data from table2.So check a checkbox from table1 let's say for exemple 3 other checkboxes appear.So if I have a checkbox with country America when i check it 3 other checkboxes with California,Hawaii and Chicago to appear.Can you give me a point from where I can start? the tables are hooked up with ids that depend one another but I don't know how to make the checkboxes.</p>
|
c# asp.net
|
[0, 9]
|
3,268,214
| 3,268,215
|
Listening to Trigger
|
<p>I am using a library that when complete will trigger an event via <code>$(document).trigger('playlistDone');</code>. I am listening to this trigger but I am not getting the <code>alert()</code> I am expecting.</p>
<pre><code>$(document).bind('playlistDone', function() {
alert('done');
});
</code></pre>
<p>What am I doing wrong?</p>
|
javascript jquery
|
[3, 5]
|
4,716,433
| 4,716,434
|
how to make running activity disable while progress bar running in java android
|
<p>i have an activity or screen which contains mainly 3 views (ex.textview1,textview2,textview3) and a progress bar.</p>
<p>While progress bar running or loading if i click on either of textview1,textview2,textview3,
corresponding next activity or screen is opening.</p>
<p>But i want like while progress bar running relevant screen should disable(not tappable) or should not move to next screen if i click on any of these views. </p>
<p>please reply with an example</p>
|
java android
|
[1, 4]
|
3,232,366
| 3,232,367
|
How to switch activity with item specific data sent
|
<p>I've had a look around, and it might be because I'm not sure what I'm looking for, but I can't find out how to do something I presume should be quite easy with android.</p>
<p>I have an array of data to display on the screen. This data is a class that holds a database key, name and image.</p>
<p>I'm currently displaying this data as an ImageView and a TextView. I loop through the array and add a new row to a TableLayout containing the image and text.</p>
<p>I'd like both the image and text to be clickable, changing to a new activity.</p>
<p>This new activity needs to know the database key of the row clicked in order to display the correct data.</p>
<p>Here's what I have so far:</p>
<pre><code>private void fillSuggestionTable(TableLayout tabSuggestions, Suggestion[] arrToAdd)
{
for(int i = 0; i < arrToAdd.length; i++)
{
/* Create a new row to be added. */
TableRow trSuggestion = new TableRow(this);
trSuggestion.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
/* Create objects for the row-content. */
ImageView imgDisplayPicture = new ImageView(this);
ImageHandler.loadBitmap(arrToAdd[i].strImageURL, imgDisplayPicture);
imgDisplayPicture.setLayoutParams(new LayoutParams(50,50));
TextView txtArtistName = new TextView(this);
txtArtistName.setText(arrToAdd[i].strName);
txtArtistName.setTextColor(Color.parseColor("#000000"));
/* Add data to row. */
trSuggestion.addView(imgDisplayPicture);
trSuggestion.addView(txtArtistName);
/* Add row to TableLayout. */
tabSuggestions.addView(trSuggestion, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
}
}
</code></pre>
|
java android
|
[1, 4]
|
4,225,521
| 4,225,522
|
Expected identifier, string or number
|
<p>I'm trying to implement some webcam jquery script / plugin into my page, in firefox it works flawlessly, in IE i'm getting this error:</p>
<p>Expected identifier, string or number.
Line 151
Char 13</p>
<p>Which is the following part:</p>
<pre><code> $.webcam._flash = $("#jquerywebcamflash");
}
else
{
$.webcam._flashready = true;
}
$.webcam._flash.flash(
{
src: 'jquerywebcamhelper.swf',
width: $.webcam._width,
height: $.webcam._height,
},
{
version: 8
}
);
}
</code></pre>
<p>Line 151 char 13 would be this one: <code>},</code></p>
<p>the complete .js can be found here: <a href="http://pastebin.com/7Uq1pWpZ" rel="nofollow">jquery.webcam.js pastebin.com</a></p>
|
javascript jquery
|
[3, 5]
|
1,997,470
| 1,997,471
|
Java vs native coding in Android Application development
|
<p>I plan to create an SDK (involving huge data manipulations), which can used to create applications on Android.</p>
<p>I plan to develop the complete SDK, including the libraries in Java, for the reason that if I implement my libraries in the native language(C++) the data movement between the Java and the native layer will involve memory copies and will make my application look slow.</p>
<p>I plan to port the same SDK later to other platforms like Windows Mobile. I am a bit confused on the better approach to code in such cases, keeping in mind the portability and performance of the SDK.</p>
<p>Inputs will be greatly appreciated.</p>
|
java android c++
|
[1, 4, 6]
|
4,324,566
| 4,324,567
|
Android Demo's aren't appearing in simulator
|
<p>I'm trying to get my feet wet with Android development. I downloaded Eclipse, and setup the ADT. When I create a project from existing source, I choose the demo projects (API Demo) and compile + run. The simulator pops up but I can't seem to find the API Demo application. How can I get this up and running?</p>
|
java android
|
[1, 4]
|
3,799,439
| 3,799,440
|
iPhones jQuery show/hide conflict with auto scrolling slideshows
|
<p>There seems to be an issue with iPods and iPhones (4,4S, and probably 5). We have an autoscrolling slideshow utilizing Flex Slider. I have a toggle trigger to show and hide our menu (div). When the menu is toggled open and the slideshow auto scrolls to the next image the menu closes. On my Android phone (Android OS 4.1) it seems to work perfectly fine.</p>
<p>Seems like the iDevices are having issues with the Javascript. Would this be a correct assumption? Anyone have a possible idea or solution to my issue?</p>
<p>Thanks in advance.</p>
|
jquery iphone
|
[5, 8]
|
4,606,968
| 4,606,969
|
radio button to enable form fields
|
<p>I have a form containing two radio buttons, I want to enable corresponding fields when a radio button is checked. My code just isn't working, here it is:</p>
<pre><code><head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var $type = $('select'),
$field1 = $("#fieldID1"),
$field2 = $("#fieldID2");
$type.change(function() {
var isDisabled = ($type.filter(":checked").val() === "1");
$field1.prop("disabled", !isDisabled);
$field2.prop("disabled", isDisabled);
}).change();
});
</script>
</head>
</code></pre>
<p>My html body is like:</p>
<pre><code><body>
<form action="" method="post">
<input type="radio" name="select" value="1" />
<input type="text" name="fieldID1" id="fieldID1"/>
<input type="radio" name="select" value="2" />
<table id="fieldID2">
<tr>...</tr>
<tr>...</tr>
...
</table>
<input type="submit" value="Add">
</form>
</body>
</code></pre>
<p>I referenced the code from <a href="http://stackoverflow.com/questions/6036635/improving-use-of-radio-buttons-to-enable-disable-form-fields">this post</a>. Can anyone point me out what the problem is, I am not quite familiar with jQuery, thanks!</p>
<p>Still cannot be fixed...</p>
|
javascript jquery
|
[3, 5]
|
381,450
| 381,451
|
How do I get the index of a list item during a click even on that item?
|
<p>How do I get the index of a list item during a click even on that item?</p>
<pre><code><ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<ul>
$('li').live('click', function(e){
alert(e.index);
})
</code></pre>
<p>Thanks</p>
|
javascript jquery
|
[3, 5]
|
1,578,944
| 1,578,945
|
Syncronize count down time for all users
|
<p>I need to synchronize the count down time for all users.So it will display identical remaining time to all in asp.net.</p>
<p>Waiting for your valuable thoughts </p>
<p>Thanking You </p>
|
c# asp.net
|
[0, 9]
|
4,639,930
| 4,639,931
|
What is the meaning of A potentially dangerous Request.Form value was detected from the client error message
|
<p>I was trying to send an email via my web project using <a href="http://freetextbox.com/" rel="nofollow">Free text box</a> control.It is an text editor . but I've got this error.</p>
<p><strong>A potentially dangerous Request.Form value was detected from the client (FreeTextBox1="<b>hello my dear</b>").</strong>
I set the ValidateRequest=false and I set the isbodyHtml=true. but It doesn't work .</p>
<p>what should I do?</p>
|
c# asp.net
|
[0, 9]
|
3,424,585
| 3,424,586
|
jQuery asp control .prop(“disabled”, “”) not enabling check box in IE 9
|
<p>I’m trying to enable a check box on an Aspx page using the following code.</p>
<pre><code>$("#ctl00_ContentPlaceHolder1_chkCheque1").prop("disabled", "");
</code></pre>
<p>This code is executed when an item in a drop down list is clicked and works in chrome and Firefox, but not IE 9. </p>
<p>I can see the code being run in the script debugger but it doesn’t affect the check box control.</p>
<p>Any and all help is appreciated.</p>
|
jquery asp.net
|
[5, 9]
|
2,260,434
| 2,260,435
|
How to pass textbox value to java script on button click event
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/765205/how-to-pass-text-in-a-textbox-to-javascript-function">How to pass text in a textbox to javascript function?</a> </p>
</blockquote>
<p>I need to pass the text box value as parameter of javascript method which will be fired on button click.</p>
<pre><code><asp:TextBox ID="rowID" runat="server"> </asp:TextBox>
<asp:Button runat="server" ID="Click" OnClientClick="PassValue(Textboxvaluehere)"/>
</code></pre>
<p>PassValue is JavaScript method.</p>
<p>Thanks in Advance.</p>
|
javascript asp.net
|
[3, 9]
|
1,678,218
| 1,678,219
|
Adding Meta Tag Programatically in c#
|
<p>I tried to add meta tag programatically it is working fine when there is Head element with runat ="server" in .aspx page .</p>
<p>The code behind is:</p>
<pre><code>HtmlMeta meta = new HtmlMeta();
meta.Name = "robots";
meta.Content = "noindex,follow";
this.Page.Header.Controls.Add(meta);
</code></pre>
<p>But i have some script in head tag which contains code blocks like <% ... %> .so i cannot keep the runat = "server" value.</p>
<p>The problem is i have to add meta tag only programatically because the meta tag will add based on value coming from database</p>
<p>Is there any way to solve this issue so that my script inside head element works as usual and i can add meta tag programatically. </p>
|
c# asp.net
|
[0, 9]
|
2,875,998
| 2,875,999
|
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]
|
3,128,160
| 3,128,161
|
Convert a string to a resource Uri for mp3 playback
|
<p>I am trying to play an mp3 using the Media player class. When I hardcode the mp3 resource it works, however I would like the resource to come from a string instead of directly accessing it like <code>R.raw.mp3name</code>.</p>
<pre><code>Bundle bundle = getIntent().getExtras();
String Choice= bundle.getString("bundledChoice");
Uri myUri = Uri.parse("R.raw." + Choice);
mPlayer = MediaPlayer.create(activity.this, myUri);
mPlayer.start();
</code></pre>
<p>If I change the second to last line to <code>mPlayer = MediaPlayer.create(activity.this, R.raw.song)</code> it will work, the problem is creating the resource URI dynamically from the string which is obtained from the bundle.</p>
<p>Please advise.</p>
|
java android
|
[1, 4]
|
5,808,326
| 5,808,327
|
Why won't my code work in Java?
|
<p>Here's my code in C#:</p>
<pre><code> string month;
do
{
Console.WriteLine("put month");
month = Console.ReadLine();
switch (month)
{
case "1":
Console.WriteLine("dsad");
Console.ReadLine();
Console.WriteLine("\neheheh!");
Console.WriteLine("\nhihihihi");
break;
}
}while(month!="Quit");
</code></pre>
<p>Here it is in Java:</p>
<pre><code> Console C = System.console();
String month;
int year;
do {
month = C.readLine("\nPlease put a valid month: \n");
switch (month) {
case "1":
C.readLine("\nPlease put a valid year: \n");
System.out.println("\nThe month is January!");
System.out.println("\nJanuary has 31 days!");
break;
}
} while (month != "Quit");
</code></pre>
<p>My problem is that my code in Java won't terminate even if I type the word "Quit". </p>
<p>This is a follow up to <a href="http://stackoverflow.com/questions/12882907/writing-an-infinite-loop-on-the-command-line">this question</a>.</p>
|
c# java
|
[0, 1]
|
2,808,137
| 2,808,138
|
Get codebehind to create a complete JS section
|
<p>I want my codebehind to dump a very large set of JS into the ASPX page. This is required, as I can't use external JS code for this component, and the code is also unique to each customer. Is it possible to do this from codebehind? I know how to set the value of text boxes etc. (.Text/.Value = xxx) but I can't see how I can just 'dump' code straight onto the page.</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
3,778,959
| 3,778,960
|
Passing any variable value from Java to JavaScript
|
<p>I'm using a webview in my android application, and the web address that the webview loads contains some JavaScript. Now, I just want to know if it is possible to pass in some variable values from my Java Code to my JavaScript.</p>
<p>Here's my code:</p>
<pre><code>public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.map_layout);
webView = (WebView) findViewById (R.id.webview);
WebSettings webViewSettings = webView.getSettings();
webViewSettings.setJavaScriptEnabled(true);
webView.addJavascriptInterface(new transferPlaceId(), "Android");
webView.loadUrl("http://webaddress.com/directory/page.html");
</code></pre>
<p>}</p>
<p>Javascript Interface works well, no need to worry about it.
Any help will be much appreciated. Thanks in advance!</p>
|
java javascript android
|
[1, 3, 4]
|
529,591
| 529,592
|
Insert datatable in to sql table
|
<p>I have a data table named <code>dt2</code>. And it contains some datas.I want to add these data to my table named invitationdata.</p>
<p>How can I write the code?any one help?</p>
|
c# asp.net
|
[0, 9]
|
3,019,066
| 3,019,067
|
not called Looper.prepare() when running a Timer from CallBack
|
<p>I'm in this code I am cycling through an attaylist of objects and assigning each object a callback, yet when I get to using a CountDownTimer, it crashes with <strong>Can't create handler inside thread that has not called Looper.prepare()</strong></p>
<pre><code> for ( final ABoxActor a : actList )
{
ActorDamageListener adl = new ActorDamageListener(){
public void ActorDestroyCallback() {
Log.e("KILLED", a.getBitmapName() );
}
public void ActorDamageCallback(float damage) {
Log.e("DAMAGED "+String.valueOf(damage), a.getBitmapName() );
a.setSpriteCurrentFrame(10);
//// THROWS Can't create handler inside thread that has not called Looper.prepare()
CountDownTimer t = new CountDownTimer(500,500){
@Override
public void onFinish() {
a.setSpriteCurrentFrame(15);
}
@Override
public void onTick(long millisUntilFinished) {
}}.start();
/////////////////////////////////
}
};
a.setListener(adl);
}
</code></pre>
<p>Any ideas what would be the easiest way to fix that? Can I somehow add this "looper" to my callback definition?</p>
<p>Thanks!</p>
|
java android
|
[1, 4]
|
825,789
| 825,790
|
How to send an Email with longitude and latitude coordinates or maybe send a Google static map using c#
|
<p>How to send an Email with longitude and latitude coordinates or maybe send a Google static map using c#. The information should represent the sender email address or IP address as to where the sender is located. </p>
<p>I am using a simple email form and would like to add this feature to it. How do I go about this ? I am open to any suggestions or different ways of achieving this.</p>
|
c# asp.net
|
[0, 9]
|
3,600,636
| 3,600,637
|
JavaScript/jQuery weirdness concerning re-insertion of an element
|
<p>I've got a good sized script(200 lines or so) and I'm having problems with a seemingly trivial element of the code. I have a page and I am replacing the entire body with JS, however I need to re-attach a form so it can still be submitted after the page restructuring. (That submission will be triggered through JS.) However, what's happening is the code ceases to run following the <code>insertAfter()</code> call (Assumedly it's crashing within that function). As a result, the second alert and all subsequent code is not being run. Help!</p>
<pre><code>var form = $("form").detach().hide();
$("body").html(newPage);
alert("HI");
form.insertAfter("#grades");
alert("HI2");
</code></pre>
<p>Note that <code>newPage</code> is a string.</p>
|
javascript jquery
|
[3, 5]
|
5,445,353
| 5,445,354
|
access a Properties.Settings via javascript in asp.net?
|
<p>is it possible to access a <code>Properties.Settings</code> which I set in my visual studio asp.net project via javascript?</p>
|
javascript asp.net
|
[3, 9]
|
2,535,594
| 2,535,595
|
Can PHP handle enterprise level sites as well as Java
|
<p>PLEASE NO FLAMING! </p>
<p>I really would love a few objective opinions about the issue. I have a project that has been strongly developed in PHP but have clients that are concerned that Java would be a better solution. I know sites such as Flickr and Digg are run on PHP, but I am concerned that PHP's lack of a running environment may destroy my project. </p>
<p>Example. PHP (that I know of) does not have an easy way to fork another process, nor is there an easy way to start a deamon to run background processes (cron jobs are a little ugly).</p>
<p>I would hate to rewrite a great piece of software, so I am in need of some solid advice. </p>
|
java php
|
[1, 2]
|
4,893,377
| 4,893,378
|
jquery: event for simulating live typing
|
<p><strong>Part 1:</strong><br>
Is there any event I can use to get a callback when the user 'change' the input field. My definition of change is to simulate the following effect. say, I want to update a label while the user typing in the input box. I tried jquery "change" event. It works, but doesn't have the live effect. Once the input field is updated, I have to click on somewhere in the screen to update the label.</p>
<p><strong>Part 2:</strong></p>
<p>well, if this is not a good idea, I may prevent the form being submitted on enter key. Not sure about a good way to do it either. Quick search found this answer.</p>
<pre><code><form action="" method="post" onsubmit="return false;">
</code></pre>
<p>not tested yet, but hopefully the submit button may still works.</p>
<p>EDIT: tested, and onsubmit="return false;" prevents even the submit button.</p>
<p>thanks,<br>
bsr. </p>
|
javascript jquery
|
[3, 5]
|
2,836,163
| 2,836,164
|
How to close total application in Android?
|
<p>I am new to android application development.</p>
<p>I developed one android application, in this application when the user presses back or exit buttons I call the finish() method. This method closes the current activity only.</p>
<p>My requirement is when i click on the exit button, it should close all activities and it show the menu page. Is this possible?</p>
|
java android
|
[1, 4]
|
3,653,046
| 3,653,047
|
Constructing a URL with parameters using jQuery
|
<p>I have for example the following URL stored in a global variable:</p>
<pre><code>var myUrl = "http://mydomain.com/something?row=1";
</code></pre>
<p>Then a function has to add let's say another parameter called "<em>column</em>". How would that function add parameters to a pre-existing URL string using jQuery?</p>
<p>Example of the expected generated string:</p>
<pre><code>"http://mydomain.com/something?row=1&column=9"
</code></pre>
<p>The problem is that <code>myUrl</code> could also be just:</p>
<pre><code>var myUrl = "http://mydomain.com/something";
</code></pre>
<p>(Notice that there are not pre-existing parameters)</p>
|
javascript jquery
|
[3, 5]
|
4,119,958
| 4,119,959
|
Random parameters in javascript
|
<p>I know this may be a very basic question, sorry if it is but in javascript/jquery i sometimes come into contact with a function having a random parameter that doesn't seem to serve an obvious purpose, such as this one below used on the jquery website.</p>
<pre><code> $("div").mousemove(function(e){
var pageCoords = "( " + e.pageX + ", " + e.pageY + " )";
var clientCoords = "( " + e.clientX + ", " + e.clientY + " )";
$("span:first").text("( e.pageX, e.pageY ) : " + pageCoords);
$("span:last").text("( e.clientX, e.clientY ) : " + clientCoords);
});
</code></pre>
<p>Here the function has a parameter of e, i don't get why though i know if it didn't have an e it could also work because that's how i tend to use javascript. Why would a programmer do this? </p>
|
javascript jquery
|
[3, 5]
|
250,723
| 250,724
|
How to automatically reload page after a certain time based on a php variable
|
<p>I currently have a php file that automatically plays the song at the top of a playlist. I have a <code>$duration</code> value that I pull from a mysql database and I want the page to automatically refresh after the song is finished playing.</p>
<p>The song is currently played within an iframe so this is the only way to tell that the song has approximately finished. </p>
<p>I've tried doing this in javascript but I'm having issues trying to pass a variable to the timeout period. </p>
<pre><code><script type="text/JavaScript">
function timedRefresh(timeoutPeriod{
setTimeout("location.reload(true);",timeoutPeriod);
}
</script>
<body onload="JavaScript:timedRefresh($x);">
...
</body>
</code></pre>
|
php javascript
|
[2, 3]
|
3,120,824
| 3,120,825
|
Sugestion for FB meta tags using jquery and php
|
<p>here is my problem:</p>
<p>i have FB app, where i am getting data from json and using that data for making list of items in my main window, i can click on every item, and after i click it opens in new ajax window where i get more info about that item</p>
<p>problem is about meta tags for FB, cos i have LIKE button for every item, so when i click on it, i can post that item on FB wall with infomations like title, picture and description</p>
<p>i have this situation:
when i click on item in my main window, it opens in new ajax window, and i manually add item it to the URL like this:</p>
<pre><code>window.location.href=window.location.href + "?id=" + ID + "#id=" + ID;
</code></pre>
<p>and php code is this:</p>
<pre><code> <?php
if(isset($_GET['id'])){
$json = file_get_contents("http:....." . $_GET['id'] . "&...");
$json_array = json_decode($json);
print '<meta property="og:title" content="' . $json_array->title . '" /> ';
}
?>
</code></pre>
<p>it all work all right, but i get problem with refreshing page, cos every time i click on item in my main window it open new window cos i add GET parameter in url</p>
<p>so how can i avoid refreshing page and still have functionality for describe like option on FB wall</p>
|
php jquery
|
[2, 5]
|
1,423,533
| 1,423,534
|
jQuery override form submit not working when submit called by javascript on a element
|
<p>I've got a page with a normal form with a submit button and some jQuery which binds to the form submit event and overrides it with <code>e.preventDefault()</code> and runs an AJAX command. This works fine when the submit button is clicked but when a link with <code>onclick='document.formName.submit();'</code> is clicked, the event is not caught by the AJAX form submit event handler. Any ideas why not or how to get this working without binding to all the a elements?</p>
|
javascript jquery
|
[3, 5]
|
2,687,527
| 2,687,528
|
@ sign has no effect in C# aspx
|
<p>I am using Webmatrix to write my aspx and I find that @ has no effect to my asp codes.</p>
<pre><code><%@ Page Language="C#" %>
<html>
<body>
@for(var i = 10; i < 21; i++)
{<p>Line @i</p>}
</body>
</html>
</code></pre>
<p>This program, instead of outputing Line 1, Line 2, etc..., it outputs</p>
<blockquote>
<p>@for(var i = 10; i < 21; i++) {</p>
<p>Line @i</p>
<p>}</p>
</blockquote>
<p>Can anyone please help me to solve this? All I have in my workspace is the Default.aspx. Am I missing some config files?</p>
|
c# asp.net
|
[0, 9]
|
1,087,263
| 1,087,264
|
How can I check if the network has change state during run time of my android application?
|
<p>I'am developing an application for android, which needs network in order to retrieve some information from an xml file. I've got this code, that looking for if the users has enabled the network:</p>
<pre><code>public boolean isOnline() {
ConnectivityManager cm =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnected()) {
return true;
}
return false;
}
</code></pre>
<p>I use this function this way:</p>
<pre><code>boolean connected = isOnline();
if(connected)
getLocation();
else
showDialogNetwork();
</code></pre>
<p>The function <strong>showDialogNetwork()</strong>: </p>
<pre><code> public void showDialogNetwork() {
new AlertDialog.Builder(this)
.setMessage("No network")
.setTitle("Error")
.setCancelable(false)
.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// launch settings
Intent settings = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
startActivity(settings);
}
})
.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
// finish activity
finish();
}
})
.show();
}
</code></pre>
<p>If the network on the device is disabled the <strong>showDialogNetwork()</strong> will open the network tab in the settings menu. But when the users turn on the WiFi, and the application is running in the background, it doesn't "understand" that the network is turned on. I need the "kill" the app after the network is turned on, to get the information from the internet. How can I constantly check if the network has change state during run time of my application? Thanks in advance, guys :) </p>
|
java android
|
[1, 4]
|
5,251,068
| 5,251,069
|
Efficiently read binary data into int[]
|
<p>I have binary data in a file (a list of 32-bit integer values) that I need to get into an int array efficiently. I can't see any way to do this other than loading the data into a byte[] and then converting it into an int[] one element at a time. This is too slow for the amount of data I need to load. It takes about 3 seconds to do the conversion on an actual phone. Reading the data from the file in the byte[] is pretty much instantaneous.</p>
<p>Are there any libraries that use native methods for reading an int[] from a file, or for converting a byte[] to int[]?</p>
|
java android
|
[1, 4]
|
5,497,999
| 5,498,000
|
Disable fadein animation
|
<p>I am trying to create a splash screen for my app. The problem is it first renders empty layout with default title bar and then fades in my image.</p>
<p>This is all I have <code>onCreate</code></p>
<pre><code>super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.activity_splash);
</code></pre>
<p>Attempted solution from <a href="http://stackoverflow.com/questions/6972295/switching-activities-without-animation">switching activities without animation</a></p>
<p>Also tried to set window attributes</p>
<pre><code>WindowManager.LayoutParams lp = this.getWindow().getAttributes();
lp.windowAnimations = lp.windowAnimations | android.R.attr.windowDisablePreview;
this.getWindow().setAttributes(lp);
</code></pre>
<p>neither made any visible difference.</p>
|
java android
|
[1, 4]
|
4,009,800
| 4,009,801
|
HashMap doesn't provide values in the order in which added them
|
<p>I am putting values in HashMap.
But when I am reading values from that HashMap;
I am NOT getting those values in the ORDER in which I have added them.
Can any-one help me?.</p>
|
java android
|
[1, 4]
|
4,826,909
| 4,826,910
|
Example code of select display area images
|
<p>Trying to make a better question</p>
<p>There are a lot of images on different width and height, what i want to do is to resize those image to a certain size and shop image on the croppea area to have every image on the same size.</p>
<p>is there any way to archived this.</p>
<hr>
<p>This website his the example of select display images area by jquery here but i can't find the example code of how to do this. what is the example code to display only selected area of images on javascript.</p>
<p><a href="http://odyniec.net/projects/imgareaselect/" rel="nofollow">http://odyniec.net/projects/imgareaselect/</a></p>
<p><img src="http://i.stack.imgur.com/AB2Lm.png" alt="enter image description here"></p>
|
javascript jquery
|
[3, 5]
|
100,577
| 100,578
|
Open source Java Library for guitar chords detection when you play an mp3 music file
|
<p>I am looking for an alternative in java as most of the libraries I found were written in c++
E.x. the clam library. <a href="http://clam-project.org/wiki/Chordata_tutorial" rel="nofollow">http://clam-project.org/wiki/Chordata_tutorial</a></p>
<p>Does any body know a good java library which does pitch synthesis from a raw mp3 file and does chord matching afterwards based on some predefined algorithms?</p>
<p>I want to use it in android.</p>
|
java android
|
[1, 4]
|
4,680,990
| 4,680,991
|
how can i generate dynamic hidden values in a form
|
<p>I have got a shopping cart which is build using jquery and php. and I need to generate hidden values for item id. Every time I click add, the value must be different.</p>
<p>I do not know how to create dynamic values which will be different on each click.</p>
<p>At the moment I created with php the following code.</p>
<pre><code> <form method="post" action="" class="jcart">
<? $unique = md5(uniqid()); ?>
<input type="hidden" name="my-item-id" value="<?=$unique;?>" />
<input type="submit" name="my-add-button" value="add to cart" class="button" />
</form>
</code></pre>
<p>The problem is unless I refresh the page I'm getting same hidden value. What can I do to get different values without refreshing the page.</p>
|
php javascript jquery
|
[2, 3, 5]
|
1,898,036
| 1,898,037
|
Wait for a function to finish before if()else()
|
<p>I have this:</p>
<pre><code>var myError;
function getNames(user,location){
myError=null;
//Make an Ajax Call (this takes some time)
//On Success do this:
if(//Some Condition){
myError=false;
}else{
myError=true
}
}
function first(){
getNames(user, location);
if(myError==false){ //MYCONDITION
//do some custom stuff just for first();
}else{
alert("Failed");
}
}
function second(){
getNames(user, location);
if(myError==false){ //MYCONDITION
//do some custom stuff just for second();
}else{
alert("Failed");
}
}
</code></pre>
<p>Now, when I call first() or second() it always gives me alert message "FAILED". The problem is that //MYCONDITION is being executed before the getNames() function finishes. I want to wait for getNames() to execute before I can check //MYCONDITION.</p>
<p>I cannot set a delay since I don't know how much time getNames() is going to take. I was thinking about using some jQquery function but I cannot seem to find one.</p>
<p>And, I am trying to keep the getNames() as generic as possible. So, I am thinking of a way to not disturb the getNames().</p>
<p>The last option I see is adding callback() to getNames(). But, this function is being called by other functions too that won't need callback().</p>
<p>Any thoughts guys?</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
5,082,680
| 5,082,681
|
jQuery Event Keypress: Which key was pressed? A-Z, & @
|
<p>on a keydown I get the following from jQuery:</p>
<pre><code>jQuery.Event
altKey: false
attrChange: undefined
attrName: undefined
bubbles: true
button: undefined
cancelable: true
charCode: 0
clientX: undefined
clientY: undefined
ctrlKey: false
currentTarget: HTMLDivElement
data: undefined
detail: 0
eventPhase: 2
fromElement: undefined
handleObj: Object
handler: function () {
isDefaultPrevented: function returnFalse() {
jQuery16106168975948821753: true
keyCode: 51
layerX: 0
layerY: 0
metaKey: true
newValue: undefined
offsetX: undefined
offsetY: undefined
originalEvent: KeyboardEvent
pageX: 0
pageY: 0
prevValue: undefined
relatedNode: undefined
relatedTarget: undefined
screenX: undefined
screenY: undefined
shiftKey: false
srcElement: HTMLDivElement
target: HTMLDivElement
timeStamp: 1320206454048
toElement: undefined
type: "keydown"
view: DOMWindow
wheelDelta: undefined
which: 51
__proto__: Object
</code></pre>
<p>How can I get what key was pressed? I tried:</p>
<pre><code> String.fromCharCode(e.keyCode)
</code></pre>
<p>That works for A-Z, but if I press @ I don't get @ I get 2? </p>
<p>Ideas?</p>
|
javascript jquery
|
[3, 5]
|
209,296
| 209,297
|
Script downloading DI.FM list works only under Opera
|
<p>Hello fellow stackoverflow'ers!
Today I was tired of old dead links to my fav internet radio, so I decided to make a downloader for all channels from di.fm. The idea was simple: download the page, get to the menu and parse it. After that create a playlist and make user download it.</p>
<p>So I created a PHP script as an API for my JS script. PHP functions were to download the page (JS cannot really do that), save playlist sent via POST in cookies and to provide it as a file. Cookies are supposed to be a communication channel between JS and PHP (with POST I cannot really make file download itself).</p>
<p>So far so good. Everything works like a charm under Opera. Things are getting complicated in Chrome and Firefox. Chrome reloads the page without a download dialog, Firefox works about the same, just sometimes lets me download the list... that is empty.</p>
<p>Any ideas how to solve it? Here is the code (feel free to use it yourself if you like it):
<code>http://pastebin.com/dcEzxV9w</code></p>
<p>Thanks in advice,</p>
<p>Dracco</p>
|
php javascript jquery
|
[2, 3, 5]
|
4,083,644
| 4,083,645
|
Insert element between index x, y
|
<p>I try to insert list item between list elements:</p>
<pre><code>$('#deals-providers dt').each(function(index) {
if (index == 10) {
$(this).insertBefore($('<dt/>').text('More item'));
}
});
</code></pre>
<p>but it doesn't work. How can I do this?</p>
|
javascript jquery
|
[3, 5]
|
4,835,146
| 4,835,147
|
jQuery not loading on Master Page when the Content Page is in a child folder
|
<p>I have a site where I am trying to implement a jQuery UI based MessageBox in my master page. Content pages are arranged accoring to business area folders, i.e. '~/Branding/Contracts.aspx'. I find that when I load such a content page, jQuery, which is referenced in the master page as below, does not load. I assume that this is because the browser is requesting 'Branding/Scripts/jQuery '. What can I do about this? I don't have the 'root' operator in a plain 'script' tag.</p>
<pre><code><script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
</code></pre>
|
asp.net jquery
|
[9, 5]
|
2,653,464
| 2,653,465
|
Javascript objects and loops optimization
|
<p>So what is the best way to clean up this javascript code (see fiddle link in comments).</p>
<p>By "clean up" I mean replace "document.getElementById..." and fix the output variable to be a reusable function instead of the way I have it there. Two problems I'm having below:</p>
<p>1) When I use .empty then .append for </p>
<p>Currently using:</p>
<pre><code>document.getElementById("results").innerHTML=savedList[keyword];
</code></pre>
<p>Tried using:</p>
<pre><code>$("#results").empty();
$("#results").append(output);
</code></pre>
<p>The output variable isn't defined yet when the list has been cached so that only works for new searches.</p>
<p>2) Creating a function (ie function ABC(data) {...}) outside of the ajax call doesn't let me call the JSON returned data and use it (ie '+ data.repositories[i].followers +'). So not sure how to call that data outside of the ajax request. Ideally I would like to have a function that runs after a successful return that I can just call instead of running all of that inside the success return. (ie success: function(data) {functionToRun();})</p>
<p>I'm looking to optimize the code and learn better ways to make my code more reusable. Any insight is appreciated, thanks!</p>
|
javascript jquery
|
[3, 5]
|
1,424,873
| 1,424,874
|
Dynamically populated javascript slideshow
|
<p>I would like to create a dynamically populated javascript slide show for an e-commerce site, where I have a product list with several categories. </p>
<p>I would like to be able to create slide shows with roughly 5 linked images displaying at one time, starting with newest products. I'd like to be able to take them all from the same list and put them in different slide shows, so for images from category 1 they are in category 1 slide show, same for cat 2,3, etc... </p>
<p>Is there a tutorial or series of tutorials that could teach me this that someone would personally recommend (there is plenty on dynamically populated javascript and plenty on slide shows, but nothing that links the two in a way I can understand). </p>
<p>If there isn't would someone be willing to share a sample code or something for it, if I can see the code I can figure it out for myself, but if you are willing to explain in detail then that would be even better. </p>
<p>Thanks!</p>
|
php javascript
|
[2, 3]
|
2,616,766
| 2,616,767
|
Android, Start App on Launch of Emulator
|
<p>I want to do some testing on the Android emulator to run an app of mine automatically and pass it a parameter how can I do this?</p>
<p>For now lets assume, I have an app that opens a URL (parameter) in a browser. How can I get my emulator to do this upon launch of app?</p>
<p>This is for testing and this app will not be give to other to be used.</p>
<p>Thanks all</p>
|
java android
|
[1, 4]
|
4,521,112
| 4,521,113
|
Disable notification of incoming/outgoing SMS in android
|
<p>Is it possible to disable SMS received and send notification in status bar ??
What is the procedure to do this ?</p>
|
java android
|
[1, 4]
|
1,390,480
| 1,390,481
|
Creating random colors (System.Drawing.Color)
|
<p>I am tring to create random drawing colors. There is an error. Could you help me about this code.</p>
<pre><code> private Random random;
private void MainForm_Load(object sender, EventArgs e)
{
random = new Random();
}
private Color GetRandomColor()
{
return Color.FromArgb(random.Next(0, 255), random.Next(0,255),random.Next(0,255));
// The error is here
}
public SolidBrush brushGet()
{
SolidBrush oBrush = new SolidBrush(GetRandomColor());
return oBrush;
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
2,050,991
| 2,050,992
|
Dividing two integers in Java gives me 0 or 100?
|
<p>I'm trying to divide two integers and multiply by 100 but it keeps giving only 0 or 100. Can someone help me?</p>
<pre><code> int x= (a/b)*100;
</code></pre>
<p>if a was 500 and b was 1000 it would give me 0. The only time it will give me 100 is if a>=b. How can I fix this?</p>
<p>Thanks</p>
|
java android
|
[1, 4]
|
1,607,273
| 1,607,274
|
Break on space (Textbox)
|
<p>In C# I know this</p>
<pre><code> if (textBox1.Text.Length > x)
{
textBox1.AppendText(Environment.NewLine);
}
</code></pre>
<p>(x is some random number)
But what if I want to break on first space before x?</p>
|
c# asp.net
|
[0, 9]
|
2,997,213
| 2,997,214
|
Getting id then selecting that element - jQuery
|
<p>I'm often finding myself getting various attributes, such as the id of an element or class, then selecting that element and doing something.</p>
<p>What I do now for example is:</p>
<pre><code> var id = $(this).closest(".item").attr('id');
$('#'+id).hide();
</code></pre>
<p>Is using '#' and including the id the best way to do this? is there a way to maybe chain these actions together? </p>
<p>Thank you!</p>
|
javascript jquery
|
[3, 5]
|
3,762,686
| 3,762,687
|
localizable strings C#
|
<p>Im thinking about solution which would give mechanizm to localize applications websties etc. On one od the cms I saw option that each time u use localizable string simply put </p>
<p>[LANG::MyText]</p>
<p>and then according to language (each one in different file) tags were replaced.</p>
<p>Should it be done in procompile stage? Or is it something else.</p>
<p>What about aspx pages. Is it possible to do it in simillar way</p>
<p>not put:</p>
<pre><code><asp:Label test="myTextInEnglish>...
</code></pre>
<p>but </p>
<pre><code><asp:Label text="[LANG:MyText]" ...
</code></pre>
<p>I hope that my question is clear</p>
<p>thanks for help</p>
|
c# asp.net
|
[0, 9]
|
679,213
| 679,214
|
Control data to display from MySQL by putting them into a group
|
<p>I have a lot of items in my database and I have no problems displaying them. It's just that I want to organize the items that I get from my database by grouping them.</p>
<p>For example I have 50 items and I want to display the first 10 items first, and then hold the rest for later display. So if a user clicked the "view the next items" button or the appropriate number (for example the 10 items are in "1" and so if the "2" has been clicked it should display the 2nd 10 items, until all items are displayed by 10 along with their corresponding number group items holder), then the next 10 items will be displayed and will replace the first 10 items. In short, I want the items to be displayed by 10.</p>
<p>I have this current code:</p>
<h2>PHP</h2>
<pre><code>$result = mysql_query("SELECT * FROM items");
$data = "";
while($row = mysql_fetch_array($result)) {
$data .= "<a href='#' id='".$row['id']."' class='theitem'><img src='media/".$row['picture']."' /></a>";
}
</code></pre>
<h2>HTML</h2>
<pre><code><div id="itemsholder">
<? echo $data; ?>
</div>
</code></pre>
<p>Below the there should be a numerical navigation and that number should correspond to the number of 10-items set beyond 50 items. For example with 50 items, since I want to display only 10 items, I should have 1, 2, 3, 4, 5 links, or a "display next items" button so that whenever a user hits that, it will display the next 10 items and the rest.</p>
<p>PS: I'm open to suggestions, recommendations and ideas.</p>
<p>Thank you, hope someone here can help, thanks.</p>
|
php jquery
|
[2, 5]
|
4,642,275
| 4,642,276
|
jQuery Collapsible Panel
|
<p>ASP.Net, 2.0 VS2005, .Net 2.0 jQuery 1.8.3, jQuery UI 1.9.2</p>
<p>I have two panels (more will come later on) on my form that can be open or closed at the users request.</p>
<p>i am using the jQuery '.slideToggle' method.</p>
<p>This is my markup</p>
<pre><code><div class="trigger0">Collapsible Header 1 - Click to toggle</div>
<div class="panel0">
content 1
</div>
<div class="trigger1">Collapsible Header 2 - Click to toggle</div>
<div class="panel1">
content 2
</div>
</code></pre>
<p>The following works fine</p>
<pre><code>$(document).ready(function() {
$(".trigger0").click(function(){
$(".panel0").slideToggle("medium");
});
$(".trigger1").click(function() {
$('.panel1').slideToggle("medium");
});
});
</code></pre>
<p>but this doesn't</p>
<pre><code>$(document).ready(function() {
for (var vReportSectionCount = 0; vReportSectionCount < 2; vReportSectionCount++)
{
$(".trigger" + vReportSectionCount).click(function(){
$(".panel" + vReportSectionCount).slideToggle("medium");
});
}
});
</code></pre>
<p>As i dont yet know how many panels will finally exist i dont want to have to write a new line for every panel. Can someone explain to me why and propose a better solution?</p>
|
jquery asp.net
|
[5, 9]
|
1,494,999
| 1,495,000
|
how to use parameters in code behind to access some controls in my aspx file using C#
|
<p>i have 2 textbox that has a date values in my aspx file. I would like to access these 2 controls in my select statement using code behind but i am getting error like this:
'Must declare the scalar variable "@txtStartClosingDate"
so what am i missing here in my code behind here? thanks</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MainGridView.DataSource = GetData("select GroupCategory, Count(Status1) as TotalCount from [MasterProject] where Closing_Date >= @txtStartClosingDate and Closing_Date <= @txtEndClosingDate and Status1 is not null group by GroupCategory");
MainGridView.DataBind();
}
}
</code></pre>
<p>Here is one of the textbox that i am trying to reference:</p>
<pre><code><asp:TextBox ID="txtStartClosingDate" runat="server" CssClass="datepicker"></asp:TextBox>
</code></pre>
|
c# asp.net
|
[0, 9]
|
480,983
| 480,984
|
Hiding Extra Items in a list using jQuery in a tricky situation (markup is not ideal)
|
<p>I want to make a long list short by hiding some elements in long sub-lists without adding extra processing on the server side. The problem is that the markup that comes from the server is not controlled by me and is not designed in a way to make my job easy. here is the code</p>
<pre><code><ul id="long-list">
<li class="item"></li>
<li class="item"></li>
<li class="item"></li>
<li class="header"></li>
<li class="item"></li>
<li class="item"></li>
<li class="item"></li>
<li class="item"></li>
<li class="item"></li>
<li class="header"></li>
<li class="item"></li>
.
.
.
</ul>
</code></pre>
<p>As you've notices the headers are sibling to the items. Now, I want to have a jQuery code that shows only 3 items after each header and hide the rest to make the list shorter and more usable. </p>
<p>Here is my try which is <strong>not</strong> working:</p>
<pre><code> $('#long-list li.header ~ li.item:gt(3)').hide();
$('#long-list li.header ~ li.item:lt(3)').show();
$('#long-list li.header').show();
</code></pre>
<p>The extra feature is adding a node at bottom of each section that has hidden items, saying how many items has been hidden, say "5 more..."</p>
|
javascript jquery
|
[3, 5]
|
1,377,139
| 1,377,140
|
making div/htmlgeneric control visible using asp.net
|
<p>I have a user control with a div like this:</p>
<pre><code> <div runat="server" id="pnlShippingMethods" class="checkoutstep">
<div class="steptitle">
<%=GetLocaleResourceString("CheckoutOnePage.ShippingMethods.Title")%>
<div style="float: right;">
</div>
Date from checkout page one for ship method update panel is <%= DateTime.Now.ToString() %>
</div>
<asp:Panel runat="server" ID="pnlShippingMethodsContent" class="stepcontent">
<nopCommerce:CheckoutShippingMethod ID="ctrlCheckoutShippingMethod" runat="server"
OnePageCheckout="true" />
</asp:Panel>
</div>
</code></pre>
<p>I am making in visible = false on page load where this control is placed. Then from another control on the same page I am trying to make it visible like this:</p>
<pre><code>HtmlGenericControl pnlShippingMethods = this.Parent.Parent.Parent.Parent.Parent.FindControl("pnlShippingMethods") as HtmlGenericControl;
pnlShippingMethods.Visible = true;
</code></pre>
<p>I am able to make visible/invisible user control CheckoutShippingMethod from other user control but not the div. Please suggest how to make it visible</p>
|
c# asp.net
|
[0, 9]
|
5,290,439
| 5,290,440
|
Can you use Routes and Query String Values Together?
|
<p>Is it possible to use routing and query strings together?</p>
<p>An example would be the following as a route in my <em>Global.asax</em> file:</p>
<pre><code> void RegisterRoutes(System.Web.Routing.RouteCollection routes)
{
routes.MapPageRoute("My Route Name", "users/{UserName}", "~/users/UserInfo.aspx");
}
</code></pre>
<p>Could I somehow use <a href="http://www.mywebsite.com/users/usernamehere?info=bla" rel="nofollow">http://www.mywebsite.com/users/usernamehere?info=bla</a> and pass info=bla to the page? I would rather not try to encode this in the route schema.</p>
|
c# asp.net
|
[0, 9]
|
3,171,992
| 3,171,993
|
Save image from Image.Control to website directory
|
<p>Is there a way to save an image from a .net Image Control to the server's directory?</p>
<p>It's a barcode image that gets generated on Page_Load:</p>
<pre><code>Image1.ImageUrl = "~/app/barcode.aspx?code=TEST"
</code></pre>
<p>The barcode image displays just fine on the webpage, but I wnated to save it to a directory as well:</p>
<p><code>~/barcode image/TEST.jpg</code></p>
<hr>
<p>So far, here's what I have:</p>
<pre><code>WebClient webClient = new WebClient();
string remote = Server.MapPath("..") + @"\app\barcode.aspx?code=TEST";
string local = Server.MapPath("..") + @"\barcode image\TEST.jpg";
webClient.DownloadFile(remote, local);
</code></pre>
<p>But it gives me an error: <code>Illegal characters in path.</code></p>
|
c# asp.net
|
[0, 9]
|
5,219,258
| 5,219,259
|
Why when I change the src of an image with jquery, the the src is not changed in my c# codebehind?
|
<p>I have a gallery of thumbnails. When you click on a thumbnail, the main image changes to the thumbnail clicked by using jQuery and changing the 'src' tag of the . This works as expected. </p>
<pre><code>$('#ContentPlaceHolder1_photoSpotImage').attr('src', src.replace(/-thumbs/, ''));
</code></pre>
<p>I have a link that, when clicked, makes the image a downloadable file using the Content-Disposition methods in the header. When hard-set in the code it works as expected. </p>
<pre><code><asp:LinkButton runat="server" PostBackUrl="" ID="link2TheDownload" Text="+ download it" onclick="link2TheDownload_Click"></asp:LinkButton>
</code></pre>
<p>Now, I have added programmatically in the codebehind get the filename of the selected image from the 'src' tag of the tag. </p>
<pre><code> string thisServerName = Request.ServerVariables["SERVER_NAME"].ToString();
string thisHref = "http://" + thisServerName + "/" +photoSpotImage.Src.ToString();
Uri uri = new Uri(thisHref);
string filename = Path.GetFileName(uri.LocalPath);
string thisAttachment = "attachment; filename=" + filename.ToString();
Response.ContentType = "image/jpeg";
Response.AppendHeader("Content-Disposition", thisAttachment.ToString());
Response.TransmitFile(strDirectFilePath.ToString() + "/photos/1/" + filename.ToString());
Response.End();
</code></pre>
<p>The C# only has the filename that is initially set Onload and it appears that the jQuery has not changed the src.</p>
<p>I need to get the current filename so I the user can download the proper image file.</p>
<p>Help!</p>
|
c# jquery asp.net
|
[0, 5, 9]
|
1,486,904
| 1,486,905
|
Iterating Through All DropDownList In an ASP.NET WebForm C#
|
<p>What is the object that I would have to reference in order to iterate through all the DropDownList on a web page. I have a web page with several drop down list on it. I want a piece of code that will do the following:</p>
<pre><code>foreach (DropDownList d in xxx)
{
someFunction(d, d.ID);
}
</code></pre>
<p>Thanks.</p>
|
c# asp.net
|
[0, 9]
|
1,231,792
| 1,231,793
|
prevent form submission if validation failed after iterating over each form element with jquery's .each() function
|
<p>I have the following code in which I'm trying to iterated over html text input elements, do some validation and prevent the form submission if the validation fails:</p>
<pre><code>$("#the_form").submit(function(){
$(":text", this).each(function(){
if($(this).val().length != 0)
{
var str = $(this).val();
str = $.trim($(this).val());
$(this).val(str);
if($(this).val().length < 4)
{
alert("You should enter at least 4 characters");
$(this).focus();
return false;
}
}
}) // end of each() function
return true;
})
</code></pre>
<p>If I remove the .each() function and do each element separately (which obviously is not a very good approach), I get the results wanted. However, if I use the code as it is, the form keeps on submitting even if the user has not entered at leas four characters. Any ideas on what I may be doing wrong here? Any help will be very appreciated. Thanks in advance.</p>
|
javascript jquery
|
[3, 5]
|
4,388,871
| 4,388,872
|
How do i enclose the Single quotes in double quotes in javascript
|
<p>I have a php variable that needs to be interpreted in javascript how do i do this </p>
<pre><code>var cntr = "<?php echo $j;?>";
var opt = "<?php echo $options;?>";
var opt_selected = "<?php echo get_options($val['SOMEVARIABLE'],$opt); ?>";
var reference = "<?php echo $val["RFDREFVAL"];?>";
</code></pre>
<p>How do i correct the above statements iam getting Javascript error "unterminated string contant " .what is the Best to have this php variables interpreted </p>
|
javascript jquery
|
[3, 5]
|
2,066,004
| 2,066,005
|
Android spinner give a NullPointException
|
<p>Any ideas why this code throws a NullPointException?</p>
<pre><code> Spinner spinnerLoadLayouts = (Spinner)this.findViewById(R.id.spnLoadLay);
ArrayAdapter<CharSequence> adapter =
new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item, new ArrayList<CharSequence>());
adapter.add("aaa"); adapter.add("bbb");
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerLoadLayouts.setAdapter(adapter);
</code></pre>
<p>Thanks! :)</p>
|
java android
|
[1, 4]
|
5,485,409
| 5,485,410
|
Get the selected value of an asp dropdownlist in an asp repeater
|
<p>I have a repeater that has multiple dropdown lists and multiple buttons.
Each button is tied to the dropdown list in the repeater row. Is there a way to alert the dropdownlists value on a button click. I want the button click to alert the value of the ddl in the same repeater row.</p>
<p>Is this possible?</p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
566,599
| 566,600
|
javascript to jquery conversions
|
<p>I have a JavaScript function which returns a function. What does it mean ?</p>
<pre><code>function CheckShadowBounds(rounded) {
return function() {
};
}
</code></pre>
<p>How can I convert it to jQuery ?</p>
|
javascript jquery
|
[3, 5]
|
4,357,564
| 4,357,565
|
Jquery function to detect cookies and set focus
|
<p>I have an asp.net login control and I have implemented the user name to be remembered using cookies. How can I use Jquery(javascript) function to detect cookies and set the focus on the password field?</p>
|
javascript asp.net jquery
|
[3, 9, 5]
|
2,000,232
| 2,000,233
|
jquery not responding on select box retrived from a PHP script with jquery.load()
|
<p>I have a hidden div on a admin page. The div reveal itself when an image-link on the site is clicked. The content of the div is loaded with a jquery.load() call to a PHP script which in return send back the HTML-form for the correspodning link. In this way I have constructed an control panel for the admin. When the admin click on an icon a box appears on top of the page and the content is a HTML form where the admin can make settings to the site. I have already made two links that works perfectly. </p>
<p>However, now, I need to make a third form which contains two select boxes.
The content of the second select box has to be dependant on the choice of the first select box. The class of the first select box is "target".
I therefore need to use the jquery code:</p>
<pre><code>$('.target').change(function()
</code></pre>
<p>However this doesn't work since the select box was retrieved with a jquery.load(). It's like jquery can't "see" the select box at all.</p>
<p>How can I fix this?</p>
|
javascript jquery
|
[3, 5]
|
1,198,985
| 1,198,986
|
jQuery event only every time interval
|
<pre><code>$(document).ready(function() {
$('#domain').change(function() {
//
});
});
</code></pre>
<p>The code inside the change function will basically send ajax request to run a PHP script. The #domain is a text input field. So basically what I want to do is to send ajax requests as user types in some text inside the text field (for example search suggestions).</p>
<p>However, I would like to set a time interval in order to lessen the load of PHP server. Because if jQuery sends AJAX request every time user adds another letter to the text field it would consume lots of bandwidth.</p>
<p>So I would like to set let's say 2 seconds as an interval. The AJAX request will be fired every time the user types a letter but with maximum frequency of 2 seconds.</p>
<p>How can I do that?</p>
|
javascript jquery
|
[3, 5]
|
5,681,181
| 5,681,182
|
Javascript: is using t_this inside annonymous functions considered harmful?
|
<p>I've been using:</p>
<pre><code>var t_this = this; // Used inside annonymous functions
</code></pre>
<p>for quite some time when dealing with annonymous functions inside a 'class' but always with unease as it looks like a code smell. Is this a bad practice? Is there a better alternative?</p>
<p>example:</p>
<pre><code>$("#container").click(function() {
t_this.doSomething();
});
</code></pre>
<p>thanks!</p>
|
javascript jquery
|
[3, 5]
|
174,099
| 174,100
|
local variable performance in Javascript vs C#
|
<p>My Javascript code here. Instead of everytime trying to access document which is global context we made it to activation object. So that we can improve our read/write performance.</p>
<pre><code>function initUI(){
var doc = document,
bd = doc.body,
links = doc.getElementsByTagName("a"),
i= 0,
len = links.length;
while(i < len){
update(links[i++]);
}
doc.getElementById("go-btn").onclick = function(){
start();
};
bd.className = "active";
}
</code></pre>
<p>Whether is it applicable to C# as well?
Lets say,</p>
<p>defining <code>var customObject = new CustomClass();</code> as a member variable and accessing like below,</p>
<pre><code>void MyMethod()
{
var obj = customObject;
var name = obj.name;
//some code here
..
..
}
</code></pre>
<p>will increase the performance?</p>
|
c# javascript
|
[0, 3]
|
1,344,526
| 1,344,527
|
Custom ASP.NET Membership controls added via button click
|
<p>Can I customise ASP.NET DB Membership Providers? </p>
<p>In my ASP.NET database I added two columns to Membership table: Age and Address.</p>
<p>In the Register.aspx page there are built-in fields such as User Name, E-Mail, Password, Confirm Password.</p>
<p>I want to add age and address, and when the user clicks Create User button, data entered in age and address will be stored in the ASP.NET DB.</p>
|
c# asp.net
|
[0, 9]
|
4,458,851
| 4,458,852
|
Ensuring unique Javascript identifiers in ASP.NET Web User Controls
|
<p>In my current project, I am creating a number of user controls, some of which include some custom Javascript for event handling on the client side. I am registering my event handlers using OnClientClick="function()" and the like.</p>
<p>Now, I'm wondering how to ensure that all Javascript function names are unique for each specific instance of the control, so I don't risk name conflicts between controls. I have thought about putting all functions inside a named object, like</p>
<pre><code>var <%=ClientID%>_Script {
method1: function() { ...}
}
</code></pre>
<p>and then subscribing to events using something like</p>
<pre><code>OnClientClick="<%=ClientID%>_Script.methodName()"
</code></pre>
<p>It just seems like I can't but <%= %>-expressions inside OnClient* attributes. I am therefore wondering; are there some "best practices" for doing this?</p>
|
asp.net javascript
|
[9, 3]
|
2,820,989
| 2,820,990
|
.bgi library or equivalent in java
|
<p>please help me to find out this:
Is there any package/library in java that provides same functionalities that bgi library c/c++ provides!?</p>
<p>Thanks if any helps to find out this</p>
|
java c++
|
[1, 6]
|
3,674,406
| 3,674,407
|
Android: how to call onCreate() with different arguments after clicking on a list item?
|
<pre><code>protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String path = "/";
...
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
});
}
</code></pre>
<p>I'd like to call onCreate() again inside the OnItemClickListener function but with "path" variable set differently (based on what's clicked).</p>
<p>I had a look at "Intent" class but it didn't help me much. I'm not sure what to look for.</p>
<p>How can I do that?</p>
|
java android
|
[1, 4]
|
3,510,377
| 3,510,378
|
i ajax a file with jquery,and i don't know where does it download to
|
<pre><code>$.ajax({
type: "POST",
url: "http://images.digu.com/web_res_v1/images/logo.png?t=20091230",
success: function(msg){ alert( "Data Saved: " + msg ); }
});
</code></pre>
<p>where is the download file.</p>
<p>thanks</p>
|
javascript jquery
|
[3, 5]
|
5,373,740
| 5,373,741
|
How do I obtain information from the cell that was clicked in the GridView?
|
<p>I need to obtain information from the cell that was clicked in the GridView.</p>
|
c# asp.net
|
[0, 9]
|
1,137,852
| 1,137,853
|
Random string from string array list
|
<p>I have list of countries in my array, I would like to pick random country from the list (using random probably?), but I haven't found out the answer myself...</p>
<p>This is what I have so far:</p>
<pre><code>String[] list = {"Finland", "Russia", "Latvia", "Lithuania", "Poland"};
Random r = new Random();
</code></pre>
|
java android
|
[1, 4]
|
1,496,155
| 1,496,156
|
Difference between Caching object and Hash map
|
<p>I was reading an article on Caching object in asp.net framework and I was looking on the class behavior. It has a HashMap like structure and looks like that I can actually instantiate a Hashmap and use it as collection.</p>
<p>What extra benefit does cache object bring over hashmap?</p>
|
c# asp.net
|
[0, 9]
|
464,732
| 464,733
|
Regular expression or Jquery to validate a ASP.NET textbox for valid date and in the past
|
<p>I am trying to validate a text field for valid date (MM/DD/YYYY) I have not done this
validation before and wondering if it is easy to achieve through regular expression validator or through Jquery?</p>
<p>Example would be greatly appreciated.</p>
|
jquery asp.net
|
[5, 9]
|
3,607,825
| 3,607,826
|
Twitter-bootstrap javascript components not working
|
<p>all in the title.
I cant get the javascript bootstrap components working.</p>
<pre><code><div id="example">Some element</div>
<script>
$('#example').popover({
title: 'A title!',
content: 'Some content!',
trigger: "hover"
});
</script>
</code></pre>
<p>this is not working and not loading the popover.
same problem with:</p>
<pre><code>$('#try').typeahead();
</code></pre>
<p>try.</p>
<p>loading sequence:</p>
<pre><code><script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
<script src="js/vendor/jquery-1.9.1.js"></script>
<script src="js/vendor/bootstrap.min.js"></script>
//or <script src="js/vendor/bootstrap.js"></script>
</code></pre>
<p>i am not using data attributes for the sake of retrocompatibility.</p>
|
javascript jquery
|
[3, 5]
|
596,796
| 596,797
|
How to determine the best "framerate" (setInterval delay) to use in a JavaScript animation loop?
|
<p>When writing a JavaScript animation, you of course make a loop using setInterval (or repeated setTimeout). But what is the best delay to use in the setInterval/setTimeout call(s)?</p>
<p>In the <a href="http://api.jquery.com/animate/" rel="nofollow">jQuery API page for the .animate() function</a>, the user "fbogner" says:</p>
<blockquote>
<p>Just if anyone is interested: Animations are "rendered" using a setInterval with a time out of 13ms. This is quite fast! Chrome's fastest possible interval is about 10ms. All other browsers "sample" at about 20-30ms.</p>
</blockquote>
<p>Any idea how jQuery determined to use this specific number?</p>
<hr>
<p>Started bounty. I'm hoping someone with knowledge of the source code behind Chromium or Firefox can provide some hard facts that might back up the decision of a specific framerate. Or perhaps a list of animations (or frameworks) and their delays. I believe this makes for an interesting opportunity to do a bit of research.</p>
<hr>
<p>Interesting - I just took the time to look at Google's <a href="http://www.google.com/pacman" rel="nofollow">Pac-Man</a> source to see what they did. They set up an array of possible FPSes (90, 45, 30), start at the first one, and then each frame they check the "slowness" of the frame (amount the frame exceeded its allotted time). If the slowness exceeds 50ms 20 times, the framerate is notched down to the next in the list (90 -> 45, 45 -> 30). It appears that the framerate is never raised back up, presumably because the game is so short-lived that it wouldn't be worth the trouble to code that.</p>
<p>Oh, and the setInterval delay is of course set to 1000 / framerate. They do, in fact, use setInterval and not repeated setTimeouts.</p>
<p>I think this dynamic framerate feature is pretty neat!</p>
|
javascript jquery
|
[3, 5]
|
908,547
| 908,548
|
Easy way to turn Javascript array into comma-separated list?
|
<p>I have a one-dimensional array of strings in Javascript that I'd like to turn into a comma-separated list. Is there a simple way in garden-variety Javascript (or jQuery) to turn that into a comma-separated list? (I know how to iterate through the array and build the string myself by concatenation if that's the only way.)</p>
|
javascript jquery
|
[3, 5]
|
2,124,154
| 2,124,155
|
jQuery: clicking nested elements
|
<p>I have the following markup</p>
<pre><code><ol>
<li class="ListItem">
<span class="sub">@qItem.CategoryText</span>
<input type="image" src="http://icons.iconarchive.com/icons/tatice/just-bins/256/bin-red-full-icon.png" width="30" class="deleteIcon" name="QuestionId" value="@qItem.Id" />
</li>
</ol>
</code></pre>
<p>and the following script</p>
<pre><code>$(".ListItem").click(function(){
doActionA();
});
$(".deleteIcon").click(function(){
doActionB();
});
</code></pre>
<hr>
<p>When I click in image, it also triggers click of ListItem. I understand this is because image is inside ListItem. but I want ListItem's click not to be fired when image is clicked.
Is there any way to do that ?</p>
|
javascript jquery
|
[3, 5]
|
1,010,388
| 1,010,389
|
Adding an ItemCommand to a CompositeDataBoundControl
|
<p>I have a CompositeDataBoundControl and im trying to add a ItemCommand to it, ala the System.Web.UI.WebControls.Repeater - so like a numpty, I just thought if I reflector'ed and added the code like so, it should work:</p>
<pre><code>private static readonly object EventItemCommand = new object();
protected override bool OnBubbleEvent(object sender, EventArgs e)
{
// throw new Exception();
bool flag = false;
if (e is RepeaterCommandEventArgs)
{
this.OnItemCommand((RepeaterCommandEventArgs)e);
flag = true;
}
return flag;
}
protected virtual void OnItemCommand(RepeaterCommandEventArgs e)
{
RepeaterCommandEventHandler handler = (RepeaterCommandEventHandler)base.Events[EventItemCommand];
if (handler != null)
{
handler(this, e);
}
}
public event RepeaterCommandEventHandler ItemCommand
{
add
{
base.Events.AddHandler(EventItemCommand, value);
}
remove
{
base.Events.RemoveHandler(EventItemCommand, value);
}
}
</code></pre>
<p>Unfortunatly, even though I have the event bound, it does not seem to fire. Iv tried to go down the route of IPostBackEventHandler, but its still not quite right (I can fire an empty event off with no args, but I cant see a decent way to call the OnItemCommand with the RepeaterCommandEventArgs</p>
<p>Any ideas how to get this to work? </p>
<p>Iv been sitting on the office for the last 4 hours trying to get this to work! Help!</p>
|
c# asp.net
|
[0, 9]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.