Search Results

Search found 1117 results on 45 pages for 'conditional'.

Page 3/45 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Conditional Markup in aspx

    - by Dynde
    Hi... I have a ListView. If I want to base the html markup on a condition in respects to the databound item, what would be the best way to do that? What I mean is, is there any other way then putting <% % if/else blocks directly in the markup? I'm aware that a really ugly way of doing it, is putting html markup in the database field, and just let the Eval() squeeze out the proper markup (I'm not doing that). I would like to avoid putting actual <% % C# blocks in the code as well. Any good ideas?

    Read the article

  • Flex, Ant, mxmlc and conditional compilation

    - by Rezmason
    My ActionScript project builds with several compile-time specified constants. They are all Booleans, and only one of them is true at any given time. The rest must be false. When I represented my build process in a bash script, I could loop through the names of all these constants, set one of them to be true and the rest to be false, then concatenate them onto a string to be inserted as a set of arguments passed to mxmlc. In Ant, looping is more complicated. I've tried the ant-contrib for tag: <mxmlc file='blah' output='blah'> <!- ... -> <for list='${commaSeparatedListOfConstNames}' param='constName'> <sequential> <define> <name>${constName}</name> <value>${constName} == ${theTrueConst}</value> <!-- (mxmlc's define arguments can be strings that are evaluated at compile time) --> </define> </sequential> </for> </mxmlc> Long story short, ant-contrib tags like the for tag can't go in the mxmlc task. So now I'm using Ant's propertyregex to take my list of arguments and format them into a set of define args, like my old bash script: <propertyregex property='defLine.first' override='false' input='${commaSeparatedListOfConstNames}' regexp='([^\|]+)\,' replace='\1,false ' /> <propertyregex property='defLine.final' input='${defLine.first}' regexp='(@{theTrueConst}\,)false' replace='\1true' /> <!-- result: -define+=CONST_ONE,false -define+=CONST_TWO,false -define+=TRUE_CONST,true --> Now my problem is, what can I do with this mxmlc argument and the mxmlc task? Apparently arg tags can go inside the mxmlc task without it throwing an error, but they don't seem to have any effect. What am I supposed to do? How do I make this work with the mxmlc task?

    Read the article

  • Jquery cookie plugin - conditional content determined by cookie being set

    - by Dave
    Hello I have a sign up form that is displayed to all new site visitors. If a user fills out the form, the next time they visit the site, I would like to display a "welcome back" message where the form would usually sit. I am trying to do this via the jquery cookie plugin (http://plugins.jquery.com/project/Cookie). My form would look like this: <div id="sign_up_form_wrapper"><form id="sign_up" action="" method="POST" name="form"> <input type="checkbox" name="checkbox" id="checkbox" value="1">&nbsp; I accept the terms and conditions</a> <br /><br /><input type="submit" value="ENTER"> </form></div> And I am setting my cookie here: <script type="text/javascript" language="javascript"> $().ready(function() { $('#sign_upm').submit(function(e) { e.preventDefault(); if ($('#sign_up input[name=checkbox]').is(':checked')) { $.cookie('agreed_to_terms', '1', { path: '/', expires: 999999 }); } }); }); </script> That will set the cookie when a user has checked the box, but now I need to do somehting like this: if the cookie has been set, do this: <div id="sign_up_form_wrapper"> <p>Welcome back, John</p> </div> otherwise do this: <div id="sign_up_form_wrapper"> <!-- full form code here --> </div> Any ideas or pointers would be very appreciated, thanks.

    Read the article

  • ActiveReports Conditional Formatting - Picture Visibility

    - by Joe
    In ActiveReports, how can I change formatting based on values in the report data? Specifically, I want to show or hide pictures based on a value in the data. The report gets bound to a list of objects via a set to its DataSource property. These objects have a Condition property with values "Poor", "Normal", etc. I have some pictures in the report that correspond to the different conditions, and I want to hide all the pictures except for the one corresponding to the value. Should I subscribe to the Format event for the detail section? If so, how do I get to the "current record" data?

    Read the article

  • What's wrong with this conditional?

    - by David
    I am trying to make a method that tests to see if 3 lengths can make a triangle. I think i'm making some kind of syntax error but i can't figure out what it is. Here is the relevant bit of code: (its in java) public static void trya (int a, int b, int c) { if (c>(a+b)) { System.out.println ("yes") ; } else { if (b>(a+c)) { System.out.println ("yes") ; } } else { if (a>(b+c)) { System.out.println ("yes") ; } } else { System.out.println ("no") ; } } this is the error message i get: tryangle.java:17: 'else' without 'if' else ^

    Read the article

  • C# Conditional Operator Not a Statement?

    - by abelenky
    I have a simple little code fragment that is frustrating me: HashSet<long> groupUIDs = new HashSet<long>(); groupUIDs.Add(uid)? unique++ : dupes++; At compile time, it generates the error: Only assignment, call, increment, decrement, and new object expressions can be used as a statement HashSet.Add is documented to return a bool, so the ternary (?) operator should work, and this looks like a completely legitimate way to track the number of unique and duplicate items I add to a hash-set. When I reformat it as a if-then-else, it works fine. Can anyone explain the error, and if there is a way to do this as a simple ternary operator?

    Read the article

  • Jquery if visible conditional not working

    - by Wade D Ouellet
    Hey, I have a page going here that uses jQuery: http://treethink.com/services What I am trying to do is, if a slide or sub-page is shown in there, change the background colour and colour of the button. To do this I tried saying, if a certain div is shown, the background colour of a certain button changes. However, you can see there that it isn't working properly, it is changing the colour for the web one but not removing the colour change and adding a colour change on a different button when you change pages. Here is the overall code: /* Hide all pages except for web */ $("#services #web-block").show(); $("#services #print-block").hide(); $("#services #branding-block").hide(); /* When a button is clicked, show that page and hide others */ $("#services #web-button").click(function() { $("#services #web-block").show(); $("#services #print-block").hide(); $("#services #branding-block").hide(); }); $("#services #print-button").click(function() { $("#services #print-block").show(); $("#services #web-block").hide(); $("#services #branding-block").hide(); }); $("#services #branding-button").click(function() { $("#services #branding-block").show(); $("#services #web-block").hide(); $("#services #print-block").hide(); }); /* If buttons are active, disable hovering */ if ($('#services #web-block').is(":visible")) { $("#services #web-button").css("background", "#444444"); $("#services #web-button").css("color", "#999999"); } if ($('#services #print-block').is(":visible")) { $("#services #print-button").css("background", "#444444"); $("#services #print-button").css("color", "#999999"); } if ($('#services #branding-block').is(":visible")) { $("#services #branding-button").css("background", "#444444"); $("#services #branding-button").css("color", "#999999"); } Thanks, Wade

    Read the article

  • Jquery hasClass conditional not working

    - by Wade D Ouellet
    Hey, I have my site going here: http://www.treethink.com I am trying to make it so when a navigation item is clicked, it retracts the news ticker on the right and then doesn't run any of the extracting/timer functions anymore. I got it to retract but it still extracts. How I am doing it is I am adding a "noTicker" class with the nav buttons and removing it with colorbox's close button. The function runs on the page initially and if there isn't a "noTicker" class it runs the news ticker as planned. When a nav or close button is clicked it runs the function again which checks again to see if it has that class. So if it has the class it should retract (which it is so that must mean it's adding the class properly) and then not run any of the timer functions, but it still runs the timer functions for some reason. Here is my jQuery. /* Initially hide all news items */ $('#ticker1').hide(); $('#ticker2').hide(); $('#ticker3').hide(); var randomNum = Math.floor(Math.random()*3); /* Pick random number */ newsTicker(); function newsTicker() { if (!$("#ticker").hasClass("noTicker")) { $("#ticker").oneTime(2000,function(i) { /* Do the first pull out once */ $('div#ticker div:eq(' + randomNum + ')').show(); /* Select div with random number */ $("#ticker").animate({right: "0"}, {duration: 800 }); /* Pull out ticker with random div */ }); $("#ticker").oneTime(15000,function(i) { /* Do the first retract once */ $("#ticker").animate({right: "-450"}, {duration: 800}); /* Retract ticker */ $("#ticker").oneTime(1000,function(i) { /* Afterwards */ $('div#ticker div:eq(' + (randomNum) + ')').hide(); /* Hide that div */ }); }); $("#ticker").everyTime(16500,function(i) { /* Everytime timer gets to certain point */ /* Show next div */ randomNum = (randomNum+1)%3; $('div#ticker div:eq(' + (randomNum) + ')').show(); $("#ticker").animate({right: "0"}, {duration: 800}); /* Pull out right away */ $("#ticker").oneTime(15000,function(i) { /* Afterwards */ $("#ticker").animate({right: "-450"}, {duration: 800});/* Retract ticker */ }); $("#ticker").oneTime(16000,function(i) { /* Afterwards */ /* Hide all divs */ $('#ticker1').hide(); $('#ticker2').hide(); $('#ticker3').hide(); }); }); } else { $("#ticker").animate({right: "-450"}, {duration: 800}); /* Retract ticker */ $("#ticker").oneTime(1000,function(i) { /* Afterwards */ $('div#ticker div:eq(' + (randomNum) + ')').hide(); /* Hide that div */ }); } } /* when nav item is clicked re-run news ticker function but give it new class to prevent activity */ $("#nav li").click(function() { $("#ticker").addClass("noTicker"); newsTicker(); }); /* when close button is clicked re-run news ticker function but take away new class so activity can start again */ $("#cboxClose").click(function() { $("#ticker").removeClass("noTicker"); newsTicker(); }); Thanks, Wade

    Read the article

  • Conditional Validation using JQuery Validation Plugin

    - by Steve Kemp
    I have a simple html form that I've added validation to using the JQuery Validation plugin. I have it working for single fields that require a value. I now need to extend that so that if a user answers Yes to a question they must enter something in the Details field, otherwise the Details field can be left blank. I'm using radio buttons to display the Yes/No. Here's my complete html form - I'm not sure where to go from here: <script type="text/javascript" charset="utf-8"> $.metadata.setType("attr", "validate"); $(document).ready(function() { $("#editRecord").validate(); }); </script> <style type="text/css"> .block { display: block; } form.cmxform label.error { display: none; } </style> </head> <body> <div id="header"> <h1> Questions</h1> </div> <div id="content"> <h1> Questions Page 1 </h1> </div> <div id="content"> <h1> </h1> <form class="cmxform" method="post" action="editrecord.php" id="editRecord"> <input type="hidden" name="-action" value="edit"> <h1> Questions </h1> <table width="46%" class="record"> <tr> <td width="21%" valign="top" class="field_name_left"><p>Question 1</p></td> <td width="15%" valign="top" class="field_data"> <label for="Yes"> <input type="radio" name="Question1" value="Yes" validate = "required:true" /> Yes </label> <label for="No"> <input type="radio" name="Question1" value="No" /> No </label> <label for="Question1" class="error">You must answer this question to proceed</label> </td> <td width="64%" valign="top" class="field_data"><strong>Details:</strong> <textarea id = "Details1" class="where" name="Details1" cols="25" rows="2"></textarea></td> </tr> <tr> <td valign="top" class="field_name_left">Question 2</td> <td valign="top" class="field_data"> <label for="Yes"> <input type="radio" name="Question2" value="Yes" validate = "required:true" /> Yes </label> <label for="No"> <input type="radio" name="Question2" value="No" /> No </label> <label for="Question2" class="error">You must answer this question to proceed</label> </td> <td valign="top" class="field_data"><strong>Details:</strong> <textarea id = "Details2" class="where" name="Details2" cols="25" rows="2"></textarea> </td> </tr> <tr class="submit_btn"> <td colspan="3"> <input type="submit" name="-edit" value="Finish"> <input type="reset" name="reset" value="Reset"> </td> </tr> </table> </form> </div> </body> </html>

    Read the article

  • Conditional XAML

    - by Nicholas
    For easy of development I'm using a ViewBox to wrap all content inside a Window. This is because my development machine has a smaller screen than the deployment machine so using a ViewBox allows for better realisation of proportion. Obviously there is no reason for it to be there on Release versions of the code. Is there an easy method to conditionally include/exclude that 'wrapping' ViewBox in XAML? E.g. <Window> <Viewbox> <UserControl /*Content*/> </Viewbox> </Window>

    Read the article

  • conditional update records mysql query

    - by Shakti Singh
    Hi, Is there any single msql query which can update customer DOB? I want to update the DOB of those customers which have DOB greater than current date. example:- if a customer have dob 2034 update it to 1934 , if have 2068 updated with 1968. There was a bug in my system if you enter date less than 1970 it was storing it as 2070. The bug is solved now but what about the customers which have wrong DOB. So I have to update their DOB. All customers are stored in customer_entity table and the entity_id is the customer_id Details is as follows:- desc customer_entity -> ; +------------------+----------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+----------------------+------+-----+---------------------+----------------+ | entity_id | int(10) unsigned | NO | PRI | NULL | auto_increment | | entity_type_id | smallint(8) unsigned | NO | MUL | 0 | | | attribute_set_id | smallint(5) unsigned | NO | | 0 | | | website_id | smallint(5) unsigned | YES | MUL | NULL | | | email | varchar(255) | NO | MUL | | | | group_id | smallint(3) unsigned | NO | | 0 | | | increment_id | varchar(50) | NO | | | | | store_id | smallint(5) unsigned | YES | MUL | 0 | | | created_at | datetime | NO | | 0000-00-00 00:00:00 | | | updated_at | datetime | NO | | 0000-00-00 00:00:00 | | | is_active | tinyint(1) unsigned | NO | | 1 | | +------------------+----------------------+------+-----+---------------------+----------------+ 11 rows in set (0.00 sec) And the DOB is stored in the customer_entity_datetime table the column value contain the DOB. but in this table values of all other attribute are also stored such as fname,lname etc. So the attribute_id with value 11 is DOB attribute. mysql> desc customer_entity_datetime; +----------------+----------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+----------------------+------+-----+---------------------+----------------+ | value_id | int(11) | NO | PRI | NULL | auto_increment | | entity_type_id | smallint(8) unsigned | NO | MUL | 0 | | | attribute_id | smallint(5) unsigned | NO | MUL | 0 | | | entity_id | int(10) unsigned | NO | MUL | 0 | | | value | datetime | NO | | 0000-00-00 00:00:00 | | +----------------+----------------------+------+-----+---------------------+----------------+ 5 rows in set (0.01 sec) Thanks.

    Read the article

  • iphone sdk conditional in switch function

    - by Oliver
    I'm trying to make a random image appear on the press of a button. So it generates a random number, and the switch algorithm swaps the chosen image with the one in the imgview. but I want a switch in the settings app to toggle which set of images to use. I know pretty much how to do it...it's just that it doesn't work. I'm missing some syntax thing...Please help, stackoverflow? it's my birthday. int Number = rand() %30; NSString *toggleValue = [[NSUserDefaults standardUserDefaults] stringForKey:@"enabled_preference"]; switch (Number) { if (*toggleValue == 0) { case 0: picture.image = [UIImage imageNamed:@"1.png"]; break; case 1: picture.image = [UIImage imageNamed:@"2.png"]; break;} else { case 0: picture.image = [UIImage imageNamed:@"3.png"]; break; case 1: picture.image = [UIImage imageNamed:@"4.png"]; break;} }

    Read the article

  • Javascript for conditional URL append or redirect based on window.location.href

    - by Wintermute
    ::Hi all:: I am trying to make a bookmarklet that when clicked will check the URL of the current tab\window to see if it contains 'char1' and\or 'char2' (a given character). If both chars are present it redirects to another URL, for the other two it will append the current URL respectively. I believe there must be a more elegant way of stating this than the following (which has so far worked perfectly for me) but I don't have great knowledge of Javascript. My (unwieldy & repetitive) working code (apologies): if (window.location.href.indexOf('char1')!=-1 && window.location.href.indexOf('char2')!=-1) {window.location="https://website.com/";} else if (window.location.href.indexOf('char1')!=-1) {window.location.assign(window.location.href+='append1');} else if (window.location.href.indexOf('char2')!=-1) {window.location.assign(window.location.href+='append2');} Does exactly what I need it to but, well... not very graceful to say the least. Is there a simpler way to do this, perhaps with vars or a pseudo-object? Or better code :D

    Read the article

  • Conditional macro expansion

    - by Dave DeLong
    Heads up: This is a weird question. I've got some really useful macros that I like to use to simplify some logging. For example I can do Log(@"My message with arguments: %@, %@, %@", @"arg1", @"arg2", @"arg3"), and that will get expanded into a more complex method invocation that includes things like self, _cmd, __FILE__, __LINE__, etc, so that I can easily track where things are getting logged. This works great. Now I'd like to expand my macros to not only work with Objective-C methods, but general C functions. The problem is the self and _cmd portions that are in the macro expansion. These two parameters don't exist in C functions. Ideally, I'd like to be able to use this same set of macros within C functions, but I'm running into problems. When I use (for example) my Log() macro, I get compiler warnings about self and _cmd being undeclared (which makes total sense). My first thought was to do something like the following (in my macro): if (thisFunctionIsACFunction) { DoLogging(nil, nil, format, ##__VA_ARGS__); } else { DoLogging(self, _cmd, format, ##__VA_ARGS__); } This still produces compiler warnings, since the entire if() statement is substituted in place of the macro, resulting in errors with the self and _cmd keywords (even though they will never be executed during function execution). My next thought was to do something like this (in my macro): if (thisFunctionIsACFunction) { #define SELF nil #define CMD nil } else { #define SELF self #define CMD _cmd } DoLogging(SELF, CMD, format, ##__VA_ARGS__); That doesn't work, unfortunately. I get "error: '#' is not followed by a macro parameter" on my first #define. My other thought was to create a second set of macros, specifically for use in C functions. This reeks of a bad code smell, and I really don't want to do this. Is there some way I can use the same set of macros from within both Objective-C methods and C functions, and only reference self and _cmd if the macro is in an Objective-C method?

    Read the article

  • PHP conditional loop help

    - by sea_1987
    Hi there in my database I have 3 columns, is_contract, is_permenant and is_temporary. Within these columns there is either a Y or N value. I am using these columns to echo onto the page what kind of work someone is looking for, my problem is that the user can be looking for more than one type of work, I am currently running 3 if statements to determine what to echo to the page, however I am struggling to add a comma if more than one of the statemnts returns as true, below is my code so far, <?php if($rslt['is_contract'] == 'Y') { echo "Contract "; } if($rslt['is_permanent'] == 'Y') { echo "Permanent "; } if($rslt['is_temporary'] == 'Y') { echo "Temporary"; } ?>

    Read the article

  • Need help with a conditional SELECT statement

    - by Ethan
    I've got a stored procedure with a select statement, like this: `SELECT author_ID, author_name, author_bio FROM Authors WHERE author_ID in (SELECT author_ID from Books) ` This limits results to authors who have book records. This is the Books table: Books book_ID INT author_ID INT book_title NVARCHAR featured_book BIT What I want to do is conditionally select the ID of the featured book by each author as part of the select statement above, and if none of the books for a given author are featured, select the ID of the first (top 1) book by the author from the books table. How do I approach this?

    Read the article

  • Optimize conditional operators branching in C#

    - by abatishchev
    Hello. I have next code: return this.AllowChooseAny.Value ? radioSpecific.Checked ? UserManager.CurrentUser.IsClient ? txtSubject.Text : subjectDropDownList.SelectedItem.Text : String.Empty : UserManager.CurrentUser.IsClient ? txtSubject.Text : subjectDropDownList.SelectedItem.Text; or in less complex form: return any ? specified ? isClient ? textbox : dropdown : empty : isClient ? textbox : dropdown; or in schematic form: | any / \ specified isClient / \ / \ isClient empty textbox dropdown / \ textbox dropdown Evidently I have a duplicated block on two different levels. Is it possible to optimize this code to probably split them to one? Or something like that..

    Read the article

  • Conditional operator in if-statement?

    - by Pindatjuh
    I've written the following if-statement in Java: if(methodName.equals("set" + this.name) || isBoolean() ? methodName.equals("is" + this.name) : methodName.equals("get" + this.name)) { ... } Is this a good practice to write such expressions in if, to separate state from condition? And can this expression be simplified?

    Read the article

  • How does this If conditional work in Python?

    - by Sergio Boombastic
    from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app class MainPage(webapp.RequestHandler): def get(self): user = users.get_current_user() if user: self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, ' + user.nickname()) else: self.redirect(users.create_login_url(self.request.uri)) application = webapp.WSGIApplication( [('/', MainPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() I don't understand how this line works: if user: self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, ' + user.nickname()) else: self.redirect(users.create_login_url(self.request.uri)) I'm guessing the users.get_current_user() return a boolean? Then, if that is the case how can it get a .nickname() method? Thanks for the guidance.

    Read the article

  • Inline Conditional Statement in Stored Procedure

    - by Jason
    Here is the pseudo-code for my inline query in my code: select columnOne from myTable where columnOne = '#variableOne#' if len(variableTwo) gt 0 and columnTwo = '#variableTwo#' end I would like to move this into a stored procedure but am having trouble building the query correctly. I assume it would be something like select columnOne from myTable where columnOne = @variableOne CASE WHEN len(@variableTwo) <> 0 THEN and columnTwo = @variableTwo END This is giving me a syntax error. Could someone tell me what I've got wrong. Also, I would like to keep it to only one query and not just have one if statement. Also, I do not want to build the sql in the stored procedure and run Exec() on it.

    Read the article

  • .NET Conditional Callback on a type.

    - by Mahesh
    I have a stock price which changes by nature all the time. And, there will be many users who wants to buy that stock. Let's say that the stock price is started at 10 and let's say, 30 people bid for 10.98, 20 people bid for 7.45, 100 people bid for 8.99. During the day, the stock price can touch any of these values, and if that happens, I want to execute all the orders for users who quoted that price. Technically, I am storing in a List. Whenever the price changes, I am checking against all the values in the list and executing those that satisfy the quoted price. Class Bids { string stockname; double quote; } Is there any better alternative way to callback the satisfied items in the list rather than checking all the items whenever there is a change?? If storing in a list is not right way of doing it, let me know the best way.

    Read the article

  • Basic Conditional Checking for IF statements in C

    - by ZaZu
    Hi there, Can someone please explain what really goes on in this code ? If I put the AND statement, the message wont show if values are less than 0 or greater than 10 ... I think I must use 1 0 logic to work this out right ? I just need someone to briefly explain it please. #include<stdio.h> main(){ puts("enter number"); scanf("%d",num); if(num<0 || num >10) puts("yay"); } How is that IF statement different when AND is put : #include<stdio.h> main(){ puts("enter number"); scanf("%d",num); if(num<0 && num >10) puts("yay"); } Thanks !!

    Read the article

  • Impromptu conditional display of dtpicker

    - by pritisolanki
    Hi, I have two checkbox on prompt box i.e If user click yes I have to show dtpicker and user click no hidden the dtpicker. I tried following $('#yes').click(function(){$('#dtpickerdiv').css("display","block");}); but the hidden div doesn't appear on prompt box? I tried alerting following alert -$(‘#dtpickerdiv’).css(“display”) : This alert “undefined” alert – $(‘#dtpickerdiv’)) : “object object Any idea how to resolve this? Regards, Priti

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >