Sunday, August 19, 2012

Get Checkbox values comma separated using jquery

<div id="c_b">
<div class="checktextrow">
                                    <div class="peroperty_checks"><input type="checkbox" name="swimmingpool" id="swimmingpool" value="1"></div>
                                    <div class="peroperty_text">Swimming Pool</div>
                                    </div>
                                      <div class="checktextrow">
                                    <div class="peroperty_checks"><input type="checkbox" name="fitnesscenter" id="fitnesscenter" value="2"></div>
                                    <div class="peroperty_text">fitness center</div>
                                    </div>
                                      <div class="checktextrow">
                                    <div class="peroperty_checks"><input type="checkbox" name="restaurant" id="restaurant" value="3"></div>
                                    <div class="peroperty_text">restaurant</div>
                                    </div>
                                      <div class="checktextrow">
                                    <div class="peroperty_checks"><input type="checkbox" name="childrenactivities" id="childrenactivities" value="4"></div>
                                    <div class="peroperty_text">children’s activities</div>
                                    </div>
                                    
                                     <div class="checktextrow">
                                    <div class="peroperty_checks"><input type="checkbox" name="complimentarybreakfast " id="complimentarybreakfast " value="5"></div>
                                    <div class="peroperty_text">complimentary breakfast </div>
                                    </div>
                                    
                                     <div class="checktextrow">
                                    <div class="peroperty_checks"><input type="checkbox" name="meetingfacilities" id="meetingfacilities" value="6"></div>
                                    <div class="peroperty_text">meeting facilities</div>
                                    </div>
                                    
                                    
                                    <div class="checktextrow">
                                    <div class="peroperty_checks"><input type="checkbox" name="petsallowed " id="petsallowed " value="7"></div>
                                    <div class="peroperty_text">pets allowed </div>
                                    </div>
                                    
                                     <div class="checktextrow">
                                    <div class="peroperty_checks"><input type="checkbox" name="wheelchair" id="wheelchair" value="8"></div>
                                    <div class="peroperty_text">wheelchair accessible</div>
                                    </div>
                                    
                                    <div class="checktextrow">
                                    <div class="peroperty_checks"><input type="checkbox" name="kitchen" id="kitchen" value="9"></div>
                                    <div class="peroperty_text">kitchen/kitchenette</div>
                                    </div>
</div>

 <textarea id="t"></textarea>



Here is jquery code for access all checkbox using jquery and set the checkboxes values in textarea.



 function updateTextArea() {
         
         var allVals = [];
         $('#c_b :checked').each(function() {
           allVals.push($(this).val());
         });
         $('#t').val(allVals)
      }
     $(function() {
       $('#c_b input').click(updateTextArea);
         updateTextArea();
     });



complete  working example can be check here 



Tuesday, August 14, 2012

replace html of a div using jquery

replace html of a div using jquery 
this is  simple . just use .html() method of jquery to set new html for a div .

$("#divID").html("new text");

Tuesday, August 7, 2012

why only 24 hours ?

i m feelin these days that in a day we have "only " 24 hours ?

does method signature include return type in C sharp (c#)

does method signature include return type in C sharp (c#)

I would say  BIG  NO


I read a lot of blogs and finally i have decieded to test by self and i just make some simple code

protected int sum(int a, int b)
    {
        return a + b;
    }

    protected float sum(int a, int b)
    {
        return a + b;
    }


when i run this its throws error

already defines a member called 'sum' with the same parameter types

but if i change the parameter type then its runs OK

so final result is method signature not  include return type. and a method can be not overloaded just by changing its return type .



what is the difference between wcf service and web service?

WCF is a programming model and API. "WCF Service" implies an app that is built using that programming model and API.
"Web Service" is an app that exposes an HTTP (REST (XML or JSON), SOAP or otherwise) interface.
You can build a Web service using WCF, but you can also build a Web service using other APIs or "stacks". Like PHP or Java, for example.
With WCF you can build web services but you can also build services that are not, "Webbish". For example you can build a service that accepts incoming binary requests over only a local pipe interface. It is still a service, but it is not a "web service" because it is not using web protocols (generally HTTP and XML).

reference

.net core

 Sure, here are 50 .NET Core architect interview questions along with answers: 1. **What is .NET Core, and how does it differ from the tradi...