Posts

asp.net - In WebForms, why does my anonymous event handler not get called when added after OnLoad? -

i have asp.net webforms page several buttons added programmatically this: private void addexportbutton(control control, action clickaction) { linkbutton exportbutton = new linkbutton { text = "export", enableviewstate = false /*buttons recreated on each postback anyway.*/ }; exportbutton.click += (sender, e) => clickaction(); control.controls.add(exportbutton); } now works, long addexportbutton() method called along path onload() or onpreload() method. not fire handler action however, when addexportbutton() called onloadcomplete() method. i add/create buttons when event handler (coming dropdown) gets called. happens after onload(), break code. why this, , how can use anonymous methods event handlers in case? see nice cheat sheet asp.net page lifecycle léon andrianarivony more info order of page/control creation. in page life cycle, internal raisepostbackevent method (which raises ...

Python: split and select the best one for undefined number of entries -

sorry if question silly... looking trick in python allow splitting line , selecting best value , corresponding source, actual number of entries unknown, can 1 100. x = "32.1 (pdbbind), 50.1 (bdb), 83.0 (bmoad_4832)" in x.split(","): b = [] if float(i.split()[0]) < float(b[0]): b = i.split()[0] i error "list index out of range". the problem here: b = [] if float(i.split()[0]) < float(b[0]): #^ b empty list, b[0] raise error if understand problem right, concise solution be: >>> max(x.split(","), key=lambda x: float(x.split()[0])) ' 83.0 (bmoad_4832)'

ios - How to highlight searched text in UITableView rows? -

i have uitableview , uisearchbar associated it. want highlight searched string if substring in row. if understand question, you're done searching within uitableview if highlight result you've 2 options, if you're targeting ios 6.0 , higher there's 1 nsattributedstring see doc here , can bold , colored or apply different fonts substring within string like, this example of highlighted text check this, how use nsattributedstring? or if want support ios 6 previous versions have use attributed labels highlight search, implemented labels are, 1) tttattributedlabel 2) ohattributedlabel if you've not implemented searching in uitableview yet here's example .

Jquery on submit not responding -

so have form wuth button. on click need use run google analytics code (_gap.push). wasnt working have decided alert test. alert showing word "outside" works alert showing word "inside" not working. means not going function js code applyregisternewuserlistener: function() { alert ("outside") // form attempts register users $(document).on('submit', 'form#signup-form', function() { alert ("inside" _gaq.push(['_trackevent', 'register', 'account', 'form',, false]); }) }, html <form method="post" id="#signup-form"> <input type="submit" value="submit"> </form> i cannot understand problem. function being called too. the # sign should not in id form markup. <form method="post" id="signup-form"> there syntax error in section of code. ...

list - Two floated spans inside li a -

trying style few li's in calendar having bit of bother creating 2 columns inside li. notice orange not fill area , 2 spans not align... http://jsfiddle.net/qn4tp/3/ <ol> <li> <a href="#"> <span class="event-time">12:00pm</span> <span class="event-name">retail sales grew @ fastest pace in 7 years during july, according latest data british retail consortium , kpmg. sales 2.2% year-on-year, driven by… </span> </a> </li> </ol> this css might you. add attribute li. add overflow:hidden . , reduce width of event_name class. thats :) ol { width: 83%; margin:0; } li { line-height: 1.2; margin: 0; padding: 5px; list-style-type: none; background: #d4481b; border:1px solid ; color: #ccc; overflow:hidden} { text-decoration: none; line-height:1.2} .event-time { width: 20%; float: left; display:inline} .event-name { width: 70%; float: le...

javascript - Angular Get Selected CheckBoxes -

i have list of dynamically filled checkboxes using angular. <div ng-repeat="x in xlist"> <label>{{x.header}}</label> <input type="checkbox" name="x" value="{{x.item.id}}" /> <p>{{x.header}}</p> </div> i want method retrieve list of selected checkboxes. i'd use $('input[name=checkboxlist]:checked').each(function() { } but not acceptable angular .... there appropriate method so? here implemented plunker <input type="checkbox" ng-model="selected[record.id]"> {{record.id}} $scope.showselected = function() { console.log($scope.selected); alert(json.stringify($scope.selected)); };

spring - In Thymeleaf with multiple actions and multiple forms are possible? -

hi new in thymeleaf + spring , start learn it. , wanted integrate these 2 form in one page . that means now 2 forms in 2 different pages , th:action different .. here want these 2 forms work in 1 page i tried page 2 forms , 2 actions caught error.. create standard code <form action="#" th:action="@{/savestandard.html}" th:object="${standard}"> <table> <h1>create standard</h1> <tr> <td>standard name:</td> <td><input type="text" placeholder="enter standard name" required="required" th:field="*{standardname}"/></td> </tr> <tr> <td><input type="submit" value="create" name="save" /></td> </tr> </table> </form> create division code <form action="#" th...