Thursday, March 24, 2016

Maxlength in textbox

 

@Html.TextBoxFor(model => model.MobileNo1, new { id = "MobileNo1", @class = "form-control",MaxLength="11" })

Tuesday, March 22, 2016

Short question answer ASP.NET MVC Version 1

1. To prevent public controller from being implicitly bound to action name which attribute we used?

Ans: To prevent public controller from being implicitly bound to action name we use NonAction attribute like below:

[NonAction]

public ActionResult ContactUs()
{

}

2. A class has field with value initialized and this value has also been set into constructor. Which value is set first, initialized value or constructor value?

Ans: Initialized

3. How to get the default value of the C# variables?
Ans: default keyword can be used

4. What is main objective of ASP.NET MVC 4 or What is new in MVC4 ?
Ans: 
  • Easy Mobile web applications (ASP.NET MVC 4 complete focus on Mobile application development)
  •  Full HTML5 support
  •  ASP.NET MVC web application with cloud support
  •  Working with different mobile and desktop web browsers
5. What is Web API's in Asp.Net MVC 4 ?
Ans: 
  • Web API is a new framework for consuming & building HTTP Services.
  • Web API supports wide range of clients including different browsers and mobile devices.
  • It is very good platform for developing RESTful services since it talk’s about HTTP.
6. What are the new enhancements done in default project template of ASP.NET MVC 4?
Ans:    1. Adaptive rendering for nice look and feel
            2. Modern looking for Mobile and Desktop browser

7. Why we need a separate mobile project template, while we can render our web application in mobile (What’s new in MVC 4 Mobile template) ?
Ans: Smart Phones & tablets touch got smart by using new jQuery.Mobile.MVC NuGet pacage.
8.  What are the main features of ASP.NET MVC 4 used by ASP.NET Web API?
Ans: Routing Changes:  ASP.NET Web API uses same convention for config mapping that ASP.NET MVC provides.
Model Binding and Validations: ASP.NET Web API uses same model binding functionality, but HTTP specific context related operations only.
Filters: The ASP.NET Web API uses most of built-in filters from MVC
Unit Testing: Now Unit testing based on MVC, strongly unit testable.

9. Which assembly is used to define the MVC Framework and why?
Ans: The MVC Framework is defined through System.Web.MVC assembly. This is because this is the only assembly which contains classes and interfaces that support the asp.net Model View Controller framework for creating web application.

10. What are anonymous types?
Ans: Anonymous types are Data types that are declared by the compiler, rather than through the explicit class definition.

example: var n= {number=10, message="hi"};
Console.WriteLine(n.number+n.message);


Vocabulary



1. Extant => still in existence(Usually refers to a documents) (Adjective)
Despite many bookstores closing, experts predict that some form of book dealing will still be extant generations from now.

2. Frugal=> not spending much money (but spending wisely) (Adjective)
Monte wasn't miser, but was simply frugal, wisely spending the little that he earned. 

3. Amalgam => a mixture of multiple things (noun)

The band's music was an amalgam of hip-hop, flamenco and jazz, blending the three styles with surprising results.

4. Equivocal => confusing or ambiguous (Adjective)

The findings of the study were equivocal- the two researchers had different opinions on what the results signified.


Sum by LINQ with Clause


decimal sum_amount = Convert.ToDecimal((from n in db.TestDbSet
                                                        where n.COMPID == compid && n.BILLID == billid && n.CHARGEID == chargeid  select n.AMOUNT).Sum());

Sunday, March 20, 2016

Surat Al-Fatihah Meaning English Version

 In the Name of Allah, Most Gracious, Most Merciful
1.1 Praise be to Allah, the lord of the worlds
1.2 Most Gracious, Most Merciful
1.3 Master of the Day of Judgment
1.4 You do we worship, and Your aid do we seek
1.5 Show us the straight path
1.6 The path of those on whom You have bestowed Your Grace
1.7 Not the path of those who earned Your wrath, nor of those who went astray

Saturday, March 19, 2016

Vowel or Not By C programming using switch case

//Determine a character vowel or consonant ...This is Documentation Section
#include<stdio.h>//Link section
#include<conio.h>//Link section

int main()//main function starts
{

    char ch;//local declaration
    printf("Enter a character: ");//show a message to user
    ch=getche();//input for character
    switch(ch)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
        {
            printf(" is vowel");
        break;
        }
        default:
        {
            printf(" is consonant");
            break;
        }


    }

    return 0;
}//main function ends

Monday, March 14, 2016

how to convert var to number in javascript



<script type="text/javascript">
        $(document).ready(function () {

var total = $('#TOTAMT').val();
var scharge = $('#SCHARGE').val();
var vat = $('#VATAMT').val();

var gross = Number(total) + Number(scharge) + Number(vat);

 $('#GROSSAMT').val(gross);


});

Max id find by LINQ



Int64 billserial = Convert.ToInt64((from n in db.BillDbSet
                                                    where n.COMPID == model.COMPID &&
n.BILLNO == model.BILLNO && n.BILLYY == model.BILLYY
                                                    select n.BILLSL).Max());

if(billserial==0)
{
.......................
}
else
{
.....................
}

Saturday, March 12, 2016

Clockpicker to a column

@*bootstrap -Clock Picker....Add this in the upper part of the form*@
<link href="~/Content/bootstrap-clock%20picker/src/clockpicker.css" rel="stylesheet" />
<script src="~/Content/bootstrap-clock%20picker/src/clockpicker.js"></script>
<link href="~/Content/bootstrap-clock%20picker/src/standalone.css" rel="stylesheet" />
                                       


<td class="col-md-2 clockpicker" data-align="top" data-autoclose="true">
                                            @Html.TextBoxFor(model => model.DISCHGTM, new { id = "DISCHGTM", @class = "form-control input-sm", @Value = "00:01" })
                                         
                                        </td>




add this in the lower part of the form

    //datatime picker script
    <script type="text/javascript">
        $('.clockpicker').clockpicker();
    </script>

Bootstrap datepicker


<link href="~/Content/bootstrap_datepicker_css/datepicker.css" rel="stylesheet" />
    <link href="~/Content/bootstrap_datepicker_css/datepicker3.css" rel="stylesheet" />



 $('#BILLDT').datepicker({
                format: "dd-M-yyyy",
                autoclose: true,
                todayHighlight: true,
                showOnFocus: true,
            }).on('show', function (e) {
                if (e.date) {
                    $(this).data('stickyDate', e.date);
                }
                else {
                    $(this).data('stickyDate', null);

                }
            }).on('hide', function () {
                //document.getElementById("BILLYY").focus();
            });


<script src="~/Scripts/bootstrap-datepicker.js"></script>

Tuesday, March 8, 2016

LINQ join query



 var patho_data = (from t1 in db.table1DbSet
                                      join t2 in db.table2DbSet on t1.COMPID equals t2.COMPID
                                      where t1.COMPID == compid && t1.TRANSNO == transno && t1.TESTID==t2.TESTID
                                    select new
                                    {
                                        Id = t1.ID,

                                        compid = t1.COMPID,
                                       transdt=t1.TRANSDT,
                                       transmy=t1.TRANSMY,
                                       transn=t1.TRANSNO,
                                       patientyear=t1.PATIENTYY,
                                       patientyearid=t1.PATIENTYYID,
                                       patientid=t1.PATIENTID,
                                       testsl=t1.TESTSL,
                                       testid=t1.TESTID,
                                       testname=t2.TESTNM,
                                       amount=t1.AMOUNT,
                                        childremarks = t1.REMARKS



                                    });
                    foreach (var item in patho_data)
                    {

                        yield return new TableDTO
                        {
                            ID = item.Id,
                            COMPID = item.compid,
                            TRANSDT = Convert.ToString(item.transdt),
                            TRANSMY = item.transmy,
                            TRANSNO = item.transn,
                            PATIENTID = item.patientid,
                            PATIENTYY = item.patientyear,
                            PATIENTYYID = item.patientyearid,

                            TESTSL = item.testsl,
                            TESTID = item.testid,
                            TESTNM = item.testname,
                            AMOUNT = item.amount,
                            PathologyRemarks = item.childremarks

                        };
                    }

change method by jquery



$('#textboxID').change(function() {
                alert("ha ha ha...change done");
            });

Text To Binary Converter

This is useful for converting a Text to Binary or Binary to Text. See this link.

Text To Binary Or Binary to Text


Provided By : SS Team

Sunday, March 6, 2016

Readonly a Textbox by jquery

just use this:
                     $('#textboxID').attr('readonly', true);

Wednesday, March 2, 2016

What is XAML

XAML, which stands for eXtensible Application Markup Language, is Microsoft's variant of XML for describing a GUI. In previous GUI frameworks, like WinForms, a GUI was created in the same language that you would use for interacting with the GUI, e.g. C# or VB.NET and usually maintained by the designer (e.g. Visual Studio), but with XAML, Microsoft is going another way. Much like with HTML, you are able to easily write and edit your GUI.
It's such an essential part of WPF. Whether you're creating a Window or a Page, it will consist of a XAML document and a CodeBehind file, which together creates the Window/Page. The XAML file describes the interface with all its elements, while the CodeBehind handles all the events and has access to manipulate with the XAML controls.

Tuesday, March 1, 2016

Even or odd define by C programming

You can easily test a number even or odd by C Program. See this:

#include<stdio.h>

int main()
{
    int num;
    printf("Enter a Number: ");
    scanf("%d",&num);
    if(num%2==0)
    {
        printf("This is a even number");
    }
    else
    {
        printf("This is a odd number");

    }
    return 0;
}

Export Webgrid to PDF by ASP.NET MVC

You can export webgrid to pdf easily by using iTextSharp. See this tutotial: