Search Results

Search found 36880 results on 1476 pages for 'value initialization'.

Page 12/1476 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • jQuery - google chrome won't get updated textarea value

    - by Phil Jackson
    Hi, I have a textarea with default text 'write comment...'. when a user updates the textarea and clicks 'add comment' Google chrome does not get the new text. heres my code; function add_comment( token, loader ){ $('textarea.n-c-i').focus(function(){ if( $(this).html() == 'write a comment...' ) { $(this).html(''); } }); $('textarea.n-c-i').blur(function(){ if( $(this).html() == '' ) { $(this).html('write a comment...'); } }); $(".add-comment").bind("click", function() { try{ var but = $(this); var parent = but.parents('.n-w'); var ref = parent.attr("ref"); var comment_box = parent.find('textarea'); var comment = comment_box.val(); alert(comment); var con_wrap = parent.find('ul.com-box'); var contents = con_wrap .html(); var outa_wrap = parent.find('.n-c-b'); var outa = outa_wrap.html(); var com_box = parent.find('ul.com-box'); var results = parent.find('p.com-result'); results.html(loader); comment_box.attr("disabled", "disabled"); but.attr("disabled", "disabled"); $.ajax({ type: 'POST', url: './', data: 'add-comment=true&ref=' + encodeURIComponent(ref) + '&com=' + encodeURIComponent(comment) + '&token=' + token + '&aj=true', cache: false, timeout: 7000, error: function(){ $.fancybox(internal_error, internal_error_fbs); results.html(''); comment_box.removeAttr("disabled"); but.removeAttr("disabled"); }, success: function(html){ auth(html); if( html != '<span class="error-msg">Error, message could not be posted at this time</span>' ) { if( con_wrap.length == 0 ) { outa_wrap.html('<ul class="com-box">' + html + '</ul>' + outa); outa_wrap.find('li:last').fadeIn(); add_comment( token, loader ); }else{ com_box.html(contents + html); com_box.find('li:last').fadeIn(); } } results.html(''); comment_box.removeAttr("disabled"); but.removeAttr("disabled"); } }); }catch(err){alert(err);} return false; }); } any help much appreciated.

    Read the article

  • Liqn to sql null-able value in query

    - by msony
    I need get all items what have no categories int? categoryId = null; var items=db.Items.Where(x=>x.CategoryId==categoryId); this code generate in where: where CategoryId=null instead of where CategoryId is null ok, when i write var items=db.Items.Where(x=>x.CategoryId==null); in my sql profiler it works: where CategoryId is null BUT when i do this HACK it doesn't: var items=db.Items.Where(x=>x.CategoryId==(categoryId.HasValue ? categoryId : null)); so what's the problem? is there by in L2S?

    Read the article

  • Objective PHP and key value coding

    - by Lukasz
    Hi Guys. In some part of my code I need something like this: $product_type = $product->type; $price_field = 'field_'.$product_type.'_price'; $price = $product->$$price_field; In other words I need kind of KVC - means get object field by field name produced at the runtime. I simply need to extend some existing system and keep field naming convention so do not advice me to change field names instead. I know something like this works for arrays, when you could easily do that by: $price = $product[$price_field_key]. So I can produce key for array dynamically. But how to do that for objects? Please help me as google gives me river of results for arrays, etc... Thank you

    Read the article

  • Bind the value of a parameter in an ObjectDataProvider in WPF

    - by Andrei Rinea
    I would like to be able to be doing this : <ObjectDataProvider x:Key="dataProvider" ObjectInstance="uiRoot:App.Current.Controller" MethodName="GetMyViewModel"> <ObjectDataProvider.MethodParameters> <system:Int32>{Binding Id}</system:Int32> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> The emphasis being on <system:Int32>{Binding Id}</system:Int32> I can't get around this. Any ideas? :(

    Read the article

  • Flex Datagrid File Download old value

    - by Vish
    Hi, We use a AIR client and WAMP server. Got a weird issue with Flex datagrid. When I download an image by double clicking on a datagrid row, the file gets downloaded correctly. But when I go on to select another row for download, even though the correct parameters are being passed, it again prompts download of old file. Upon cancelling that and trying again, it picks up the selected row. Not sure how to fix this issue, below is the datagrid code I am using, <mx:DataGrid x="10" y="10" id="ourDataGrid" visible="true" enabled="true" dataProvider="{fileList}" verticalScrollPolicy="on" selectionColor="#B7C6E7" itemClick="downloadFile(event)"> <mx:columns> <mx:DataGridColumn headerText="Name" dataField="@name" /> <mx:DataGridColumn headerText="LastName" dataField="@lastname" /> <mx:DataGridColumn headerText="FirstName" dataField="@firstname" /> </mx:columns> </mx:DataGrid>

    Read the article

  • Java: How can a constructor return a value?

    - by HH
    $ cat Const.java public class Const { String Const(String hello) { return hello; } public static void main(String[] args) { System.out.println(new Const("Hello!")); } } $ javac Const.java Const.java:7: cannot find symbol symbol : constructor Const(java.lang.String) location: class Const System.out.println(new Const("Hello!")); ^ 1 error

    Read the article

  • How to change the value of value in BASH ??

    - by debugger
    Hello All, Let's say i have the Following, Vegetable=Potato ( Kind of vegetable that i have ) Potato=3 ( quantity available ) If i wanna know how many vegetables i have (from a script where i have access only to variable Vegetable), i do the following: Quantity=${!Vegetable} But let's say i take one Potato then i want to update the quantity, i should be able to do the following: ${Vegetable}=$(expr ${!Vegetable} - 1) It does not work !! Any clues to realize this Thanks

    Read the article

  • Value object or not for 3d points ?

    - by Stefano Borini
    I need to develop a geometry library in python, describing points, lines and planes in 3d space, and various geometry operations. Related to my previous question. The main issue in the design is if these entities should have identity or not. I was wondering if there's a similar library out there (developed in another language) to take inspiration from, what is the chosen design, and in particular the reason for one choice vs. the other.

    Read the article

  • SQL Server 2005 Create Table with Column Default value range

    - by Matt
    Trying to finish up some homework and ran into a issue for creating tables. How do you declare a column default for a range of numbers. Its reads: "Column Building (default to 1 but can be 1-10)" I can't seem to find ...or know where to look for this information. CREATE TABLE tblDepartment ( Department_ID int NOT NULL IDENTITY, Department_Name varchar(255) NOT NULL, Division_Name varchar(255) NOT NULL, City varchar(255) default 'spokane' NOT NULL, Building int default 1 NOT NULL, Phone varchar(255) ) I tried Building int default 1 Between 1 AND 10 NOT NULL, that didn't work out I tried Building int default 1-10, the table was created but I don't think its correct.

    Read the article

  • save the input value in a 2dimentsion array

    - by arash
    hi friends,how can i save the number that user enter in textbox in a 2 dimension array? for example: i have this numbers in textbox:45,78 and now i want to save 45,32 like this: array[0,0]=45 and array[0,1]=78 how can i do that?thanks,so much edited: oh,when i entered 1,2,3,4,5,6,7,8,9 in textbox and it takes [2,2]=56 private void button10_Click(object sender, EventArgs e) { int matrixDimention = 2; int[,] intValues = new int[matrixDimention + 1, matrixDimention + 1]; string[] splitValues = textBox9.Text.Split(','); for (int i = 0; i < splitValues.Length; i++) intValues[i % (matrixDimention + 1), i % (matrixDimention + 1)] = Convert.ToInt32(splitValues[i]); string a=intValues[2,2].ToString(); MessageBox.Show(a); } when i take: string a=intValues[2,1].ToString(); it shows 0

    Read the article

  • default value for a static property

    - by Blitzz
    I like c#, but why can I do : public static bool Initialized { private set; get; } or this : public static bool Initialized = false; but not a mix of both in one line ? I just need to set access level to my variable (private set), and I need it set at false on startup. I wouldn't like to make that boring private _Initialized variable, which would be returned by the getter of the public Initialized var. I like my code to be beautiful. (NB: my variable is static, it can't be initialized in the constructor). Thanks

    Read the article

  • .click() callback references local variable from the calling method instead of copying by value

    - by Eric Freese
    The following jQuery Javascript code is included on an otherwise empty page. $(function() { for (var i = 0; i < 10; i++) { element = $('<div>' + i + '</div>'); element.click(function() { alert(i); }); $('body').append(element); } }); The desired behavior is that this code should generate 10 div elements numbered from 0 to 9. When you click on a div element, an alert popup will show the number of the div element you clicked on (i.e. if a user clicks on the div element labeled '4', the alert popup should show the number 4). The alert popup instead shows the number 10 regardless of which div element is clicked on. How can I modify this code to make it behave in the desired way?

    Read the article

  • how to use database name as a value

    - by user316833
    I have more than 1000 access databases with the same table names.Each database has a unique name. In each database, I want to add column to one existing table and populate that new column (all rows in the table would be the same) with the database name. I found the example below - How can I alter this to give the new column the name of the database. ALTER TABLE TestTable ADD NewColumn INT; UPDATE TestTable SET NewColumn = 0;

    Read the article

  • PHP delete script, return to 'viewsubjects.php?classroom_id=NO VALUE'

    - by Derek
    Hi, As the title states... I am deleting a 'subject' from a 'classroom' I view classrooms, then can click on a classroom to view the subject for that classroom. So the link where I am viewing subjects looks like: viewsubjects.php?classroom=23 When the user selects the delete button (in a row) to remove a subject from a class, I simply want the user to be redirected back to the list of subjects for the classroom (exactly where they were before!!) So I though this is simply a case of calling up the classroom ID within my delete script. Here is what I have: EDIT: corrected spelling mistake in code (this was not the problem) $subject_id = $_GET['subject_id']; $classroom_id = $_GET['classroom_id']; $sql = "DELETE FROM subjects WHERE subject_id=".$subject_id; $result = mysql_query($sql, $connection) or die("MySQL Error: ".mysql_error()); header("Location: viewsubjects.php?classroom_id=".$classroom_id); exit(); The subject is being removed from the DB, but when I am redirected back the URI is displaying with an empty classroom ID like: viewsubjects.php?classroom_id= Is there a way to carry the classroom ID through successfully through the delete script so it can be displayed after, allowing the user to be redirected back to the page? Thanks for any help!

    Read the article

  • php, how to get a array varible value ?

    - by NovaYear
    $lang['profil_basic_medeni'] = array( 1 => 'Bekâr', 2 => 'Evli', 3 => 'Nisanli', 4 => 'Iliskide', 5 => 'Ayrilmis', 6 => 'Bosanmis' ); $lang['profil_basic_sac'] = array( 1 => 'Normal', 2 => 'Kisa', 3 => 'Orta', 4 => 'Uzun', 5 => 'Fönlü', 6 => 'Saçsiz (Dazlak)', 7 => 'Karisik/Daginik', 8 => 'Her Zaman Bol Jöleli :)' ); function sGetVAL($item,$valno) { $sonuc = $lang[$item][$valno]; return $sonuc; } $tempVAL1 = sGetVAL('profil_basic_medeni','3'); // return null //or $tempVAL2 = sGetVAL('profil_basic_sac','7'); // return null $tempVAL1 or $tempVAL2 always return null. why ? how to fix function sGetVAL ???

    Read the article

  • Creating metadata value relationships

    - by kyle.hatlestad
    I was recently asked an question about an interesting use case. They wanted content to be submitted into UCM with a particular ID in a custom metadata field. But they wanted that ID to be translated during submission into an employee name in another metadata field upon submission. My initial thought was that this could be done with a dependent choice list (DCL). One option list field driving the choices in another. But this didn't work in this case for a couple of reasons. First, the number of IDs could potentially be very large. So making that into a drop-down list would not be practical. The preference would be for that field to simply be a text field to type in the ID. Secondly, data could be submitted through different methods other then the web-based check-in form. And without an interface to select the DCL choices, the system needed a way to determine and populate the name field. So instead I went the approach of having the value of the ID field drive the value of the Name field using the derived field approach in my rule. In looking at it though, it was easy to simply copy the value of the ID field into the Name field...but to have it look up and translate the value proved to be the tricky part. So here is the approach I took... First I created my two metadata fields as standard text fields in the Configuration Manager applet. Next I create a table that stores the relationship between the IDs and Names. I then create a View into that table and set the column to the EmployeeID. I now create a new Application Field and set it as an option list using the View I created in the previous step. The reason I create it as an Application field is because I don't need to display the field or store a value in it. I simply need to make use of the option list in the next step... Finally, I create a Rule in which I select the Employee Name field and turn on the 'Is derived field' checkbox. I edit the derived value and add a new condition. Because the option list is a Application field and not an Information field, I can't use the Compute button. Instead, I insert this line directly in the Value field: @getFieldViewValue("EmployeeMapping",#active.xEmployeeID, "EmployeeName") The "EmployeeMapping" parameter designates that the value should be pulled from the EmployeeMapping Application field that I had created in the previous step. The #active.xEmployeeID field is the ID value that should be pulled from what the user entered. "EmployeeName" is the column name in the table which has the value which corresponds to the ID. The extracted name then becomes the value within our Employee Name field. That's it. You can then add additional Rules to make the Name field read-only/hidden on the check-in page and such.

    Read the article

  • comparing value with array value problem Javascript

    - by Java starter
    This code is what I use now, it dos not work when I trie to use an array to compate values. If anybody has any idea of why, please respond. <html> <head> <script type-'text/javascript'> function hovedFunksjon() { //alert("test av funksjon fungerte"); //alert(passordLager); window.open("index10.html","Window1","menubar=no,width=430,height=360,toolbar=no"); } function inArray(array, value) { for (var i = 0; i < array.length; i++) { if (array[i] == value) return true; } return false; } function spørOmPassord() { var passordLager = ["pass0","pass1","pass2"]; window.passordInput = prompt("password");//Ved å bruke "window." skaper man en global variabel //if (passordInput == passordLager[0] || passordLager[1] || passordLager[2]) if (inArray(passordLager,passorInput) ) { hovedFunksjon(); } else { alert("Feil passord"); //href="javascript:self.close()">close window } } function changeBackgroundColor() { //document.bgColor="#CC9900"; //document.bgColor="YELLOW" document.bgColor="BLACK" } </script> </head> <body> <script type-'text/javascript'> changeBackgroundColor(); </script> <div align="center"> <form> <input type = "button" value = "Logg inn" onclick="spørOmPassord()"> </form> </div> </body> </html>

    Read the article

  • My IIS server won't serve SSL sites to some browsers

    - by sbleon
    (Update: This is now cross-posted at http://stackoverflow.com/questions/3355000. This is the more appropriate forum, but StackOverflow gets a lot more traffic.) I've got an IIS 6.0 server that won't serve pages over SSL to some browsers. In Webkit-based browsers on OS X 10.6, I can't load pages at all. In MSIE 8 on Windows XP SP3, I can load pages, but it will sometimes hang downloading images or sending POSTs. Working: Firefox 3.6 (OS X + Windows) Chrome (Windows) Partially Working: MSIE 8 (works sometimes, but hangs up, especially on POSTs) Not Working: Chrome 5 (OS X) Safari 5 (OS X) Mobile Safari (iOS 4) On OS X (the easiest platform for me to test on), Chrome and Firefox both negotiate the same TLS Cipher, but Chrome hangs on or after the post-negotiation handshake. Chrome packet capture (via ssldump): 1 1 0.0485 (0.0485) C>S Handshake ClientHello Version 3.1 cipher suites Unknown value 0xc00a Unknown value 0xc009 Unknown value 0xc007 Unknown value 0xc008 Unknown value 0xc013 Unknown value 0xc014 Unknown value 0xc011 Unknown value 0xc012 Unknown value 0xc004 Unknown value 0xc005 Unknown value 0xc002 Unknown value 0xc003 Unknown value 0xc00e Unknown value 0xc00f Unknown value 0xc00c Unknown value 0xc00d Unknown value 0x2f TLS_RSA_WITH_RC4_128_SHA TLS_RSA_WITH_RC4_128_MD5 Unknown value 0x35 TLS_RSA_WITH_3DES_EDE_CBC_SHA Unknown value 0x32 Unknown value 0x33 Unknown value 0x38 Unknown value 0x39 TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA compression methods NULL 1 2 0.3106 (0.2620) S>C Handshake ServerHello Version 3.1 session_id[32]= bb 0e 00 00 7a 7e 07 50 5e 78 48 cf 43 5a f7 4d d2 ed 72 8f ff 1d 9e 74 66 74 03 b3 bb 92 8d eb cipherSuite TLS_RSA_WITH_RC4_128_MD5 compressionMethod NULL Certificate ServerHelloDone 1 3 0.3196 (0.0090) C>S Handshake ClientKeyExchange 1 4 0.3197 (0.0000) C>S ChangeCipherSpec 1 5 0.3197 (0.0000) C>S Handshake [hang, no more data transmitted] Firefox packet capture: 1 1 0.0485 (0.0485) C>S Handshake ClientHello Version 3.1 resume [32]= 14 03 00 00 4e 28 de aa da 7a 25 87 25 32 f3 a7 ae 4c 2d a0 e4 57 cc dd d7 0e d7 82 19 f7 8f b9 cipher suites Unknown value 0xff Unknown value 0xc00a Unknown value 0xc014 Unknown value 0x88 Unknown value 0x87 Unknown value 0x39 Unknown value 0x38 Unknown value 0xc00f Unknown value 0xc005 Unknown value 0x84 Unknown value 0x35 Unknown value 0xc007 Unknown value 0xc009 Unknown value 0xc011 Unknown value 0xc013 Unknown value 0x45 Unknown value 0x44 Unknown value 0x33 Unknown value 0x32 Unknown value 0xc00c Unknown value 0xc00e Unknown value 0xc002 Unknown value 0xc004 Unknown value 0x96 Unknown value 0x41 TLS_RSA_WITH_RC4_128_MD5 TLS_RSA_WITH_RC4_128_SHA Unknown value 0x2f Unknown value 0xc008 Unknown value 0xc012 TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA Unknown value 0xc00d Unknown value 0xc003 Unknown value 0xfeff TLS_RSA_WITH_3DES_EDE_CBC_SHA compression methods NULL 1 2 0.0983 (0.0497) S>C Handshake ServerHello Version 3.1 session_id[32]= 14 03 00 00 4e 28 de aa da 7a 25 87 25 32 f3 a7 ae 4c 2d a0 e4 57 cc dd d7 0e d7 82 19 f7 8f b9 cipherSuite TLS_RSA_WITH_RC4_128_MD5 compressionMethod NULL 1 3 0.0983 (0.0000) S>C ChangeCipherSpec 1 4 0.0983 (0.0000) S>C Handshake 1 5 0.1019 (0.0035) C>S ChangeCipherSpec 1 6 0.1019 (0.0000) C>S Handshake 1 7 0.1019 (0.0000) C>S application_data 1 8 0.2460 (0.1440) S>C application_data 1 9 0.3108 (0.0648) S>C application_data 1 10 0.3650 (0.0542) S>C application_data 1 11 0.4188 (0.0537) S>C application_data 1 12 0.4580 (0.0392) S>C application_data 1 13 0.4831 (0.0251) S>C application_data [etc] Update: Here's a Wireshark capture from the server end. What's going on with those two much-delayed RST packets? Is that just IIS terminating what it perceives as a non-responsive connection? 19 10.129450 67.249.xxx.xxx 10.100.xxx.xx TCP 50653 > https [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=3 TSV=699250189 TSER=0 20 10.129517 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50653 [SYN, ACK] Seq=0 Ack=1 Win=16384 Len=0 MSS=1460 WS=0 TSV=0 TSER=0 21 10.168596 67.249.xxx.xxx 10.100.xxx.xx TCP 50653 > https [ACK] Seq=1 Ack=1 Win=524280 Len=0 TSV=699250189 TSER=0 22 10.172950 67.249.xxx.xxx 10.100.xxx.xx TLSv1 Client Hello 23 10.173267 10.100.xxx.xx 67.249.xxx.xxx TCP [TCP segment of a reassembled PDU] 24 10.173297 10.100.xxx.xx 67.249.xxx.xxx TCP [TCP segment of a reassembled PDU] 25 10.385180 67.249.xxx.xxx 10.100.xxx.xx TCP 50653 > https [ACK] Seq=148 Ack=2897 Win=524280 Len=0 TSV=699250191 TSER=163006 26 10.385235 10.100.xxx.xx 67.249.xxx.xxx TLSv1 Server Hello, Certificate, Server Hello Done 27 10.424682 67.249.xxx.xxx 10.100.xxx.xx TCP 50653 > https [ACK] Seq=148 Ack=4215 Win=524280 Len=0 TSV=699250192 TSER=163008 28 10.435245 67.249.xxx.xxx 10.100.xxx.xx TLSv1 Client Key Exchange 29 10.438522 67.249.xxx.xxx 10.100.xxx.xx TLSv1 Change Cipher Spec 30 10.438553 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50653 [ACK] Seq=4215 Ack=421 Win=65115 Len=0 TSV=163008 TSER=699250192 31 10.449036 67.249.xxx.xxx 10.100.xxx.xx TLSv1 Encrypted Handshake Message 32 10.580652 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50653 [ACK] Seq=4215 Ack=458 Win=65078 Len=0 TSV=163010 TSER=699250192 7312 57.315338 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50644 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 19531 142.316425 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50653 [RST, ACK] Seq=4215 Ack=458 Win=0 Len=0

    Read the article

  • Multiplying field value with retreived value jQuery

    - by Efe
    I pull product price from another page. Then I multiply it with quantity entered in the quantity input field. The problem is, if I forget to enter quantity value before I pull product price data or if I change the quantity field later, the final total price is not updated. I hope I clearly explained it. javascript: $('#AddProduct').click(function() { var i = 0; var adding = $(+(i++)+'<div class="row'+(i)+'"><div class="column width50"><input type="text" id="PRODUCTNAME" name="PRODUCTNAME'+(i)+'" value="" class="width98" /><input type="hidden" class="PRODUCTID" name="PRODUCTID" /><input type="hidden" class="UNITPRICE" name="UNITPRICE'+(i)+'" /><small>Search Products</small></div><div class="column width20"><input type="text" class="UNITQUANTITY" name="UNITQUANTITY'+(i)+'" value="" class="width98" /><small>Quantity</small></div><div class="column width30"><span class="prices">Unit Price:<span class="UNITPRICE"></span><br />Total Price:<span class="TOTALPRICE"></span><br /><a href="#" id="RemoveProduct(".row'+(i)+'");">Remove</a></span></div>'); $('#OrderProducts').append(adding); adding.find("#PRODUCTNAME").autocomplete("orders.cs.asp?Process=ListProducts", { selectFirst: false }).result(function(event, data, formatted) { if (data) { adding.find(".UNITPRICE").html(data[1]); adding.find(".PRODUCTID").val(data[2]); adding.find(".TOTALPRICE").html(data[1] * $('.UNITQUANTITY').val()); } }); return false; }); $('#RemoveProduct').click(function() { $().remove(); return false; }); my html: <fieldset> <h2>Order Items</h2> <div id="OrderProducts"> <a href="#" id="AddProduct"><img src="icons/add.png" alt="Add" /></a> </div> </fieldset> edit Now I totaly messed it up. Removing a row is not working anymore as well... Test link: http://refinethetaste.com/html/cp/?Section=orders&Process=AddOrder#

    Read the article

  • ControlTemplate with "Control.IsMouseOver" Value="True" and "Control.IsMouseOver" Value="False">

    - by Vinjamuri
    In my WPF control, I have below code. If I don't have a trigger with false, I can see the my storyboard, but if I have both ture and false triggers, I don't see any thing. How to fix this? Appreciate your help! <Trigger Property="Control.IsMouseOver" Value="True"> <StoryBoard> Image with Opacity 1 </StoryBoard> </Trigger> <Trigger Property="Control.IsMouseOver" Value="False"> <StoryBoard> Image with Opacity 0 </StoryBoard> </Trigger>

    Read the article

  • How do you set a double value to a "non-value"

    - by Ankur
    I have two double data elements in an object. Sometimes they are set with a proper value and sometimes not. When the form field from which they values are received is not filled I want to set them to some value that tells me, during the rest of the code that the form fields were left empty. I can't set the values to null as that gives an error, is there some way I can make them 'Undefined'. PS. Not only am I not sure that this is possible, it might not also make sense. But if there is some best practice for such a situation I would be keen to hear it.

    Read the article

  • Change xml attribute in foreach statement c#

    - by user1913479
    I need to save XML-attribute value in a database, using information if checkbox is checked. If checkbox is checked, the attribute value is "TRUE", otherwise it's false. When I use foreach statement, the last enumerated value is usually assigned. Here is the part of my code: XmlAttribute xmlAttribute = xmlDoc.CreateAttribute("BooleanValue"); foreach (string value in list) //list is a List<object> { XmlNode xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "VALUE", ""); if (checkBox1.Checked || checkBox2.Checked || checkBox3.Checked) xmlAttribute.Value = "TRUE"; if (!checkBox1.Checked || !checkBox2.Checked || !checkBox3.Checked) xmlAttribute.Value = "FALSE"; xmlNode.Attributes.Append(xmlAttribute); xmlNode.InnerText = val; childNode.AppendChild(xmlNode); } When I run my application, I get an XML attribute xmlAttribute "FALSE" value anyway. What I need to have: I need to have the following XML: <ROOT><NODE><VALUE ATTRIBUTE="TRUE">Value 1</VALUE></NODE> <NODE><VALUE ATTRIBUTE="TRUE">Value 2</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 3</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 4</VALUE></NODE> <NODE><VALUE ATTRIBUTE="TRUE">Value 5</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 6</VALUE></NODE> </ROOT> What I actually get: <ROOT><NODE><VALUE ATTRIBUTE="FALSE">Value 1</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 2</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 3</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 4</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 5</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 6</VALUE></NODE> </ROOT> Because in C# FALSE value is stayed at last position in foreach loop The question is: how do I do to assign the correct values of my attribute. Thanks

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >