Monday, 24 June 2013

How to create a simple WPF application

In Visual Studio 2008 OR any 


  • Open Visual Studio 2008 and choose "File", "New", "Project..." in the main menu. Choose "WPF Application" as project type.
  • Choose a folder for your project and give it a name. Then press "OK"


  • Visual Studio creates the project and automatically adds some files to the solution. A Window1.xaml and an App.xaml. The structure looks quite similar to WinForms, except that the Window1.designer.cs file is no longer code but it's now declared in XAML as Window1.xaml


  • Select the Button and switch to the event view in the properties window (click on the little yellow lightning icon). Doubleclick on the "Click" event to create a method in the codebehind that is called, when the user clicks on the button.

Note: If you do not find a yellow lightning icon, you need to install the Service Pack 1 for VisualStudio on your machine. Alternatively you can doubleclick on the button in the designer to achieve the same result.

  • Visual Studio automatically creates a method in the code-behind file that gets called when the button is clicked.
private void button1_Click(object sender, RoutedEventArgs e)
{
    textBox1.Text = "Hello WPF!";
}


  • The textbox has automatically become assigned the name textBox1 by the WPF designer. Set text Text to "Hello WPF!" when the button gets clicked and we are done! Start the application by hit [F5] on your keyboard.





Saturday, 8 June 2013

difference between margin and padding in css

padding is the space between the content and the border, whereas margin is the space outside the border. Here's an image I found from a quick Google search, that illustrates this idea.



Monday, 8 April 2013

Set the startup page in an ASP.NET MVC 4


Go to your project's properties and set the start page property.

1) Go to the project's Properties
2) Go to the Web tab
3) Select the Specific Page radio button
4) Type in the desired url in the Specific Page text box

Thursday, 28 March 2013

How To Shown Selected menu in MVC 4

This article explaining for how to create menu's in mvc and how to set selected menu shown .


First add this styles in your css style sheet


ul#menu
{
    font-size: 1.3em;
    font-weight: 600;
    margin: 0 0 5px;
    padding: 0;
    text-align:left;
    position:absolute;
}

ul#menu li
{
    display: inline;
    list-style: none;
    margin-left: 22px;
    float:left;
}


ul#menu li a
{
    background: none;
    color: Black;
    text-decoration: none;
    font-family: Arial;
}
.select,#menu li a:hover
{   
    
    color:White ;
    text-decoration: underline;
    cursor:pointer;
}

.select
{       
    color:White ;
    background-color:#F41818 !important;
    text-decoration: underline;
    cursor:pointer;
    padding-left:0px;
}

Then add this razor code  in your page and must call your css file in this page head tag  inside .
for(Please style.css is mine .But you must  provide your css file only)

<head>

    <link href="~/Content/style.css" rel="stylesheet" />

</head>




 <div style="width: 100%; padding-bottom: 20px; margin-left: -7%; margin-top: 14%">
                    <br />
                    <ul id="menu">
                        <li id="home">@Html.ActionLink("Home", "Index", "Home")</li>
                        <li id="About">@Html.ActionLink("Discussions", "About", "Home")</li>
                        <li id="Compliance">@Html.ActionLink("Compliance", "ManageCompliance", "Compliance")</li>
                        <li>@Html.ActionLink("Reports", "About", "Home")</li>
                        <li>@Html.ActionLink("Documents", "Contact", "Home")</li>
                        <li id="FinancialCompliance" >@Html.ActionLink("Compliance", "ViewFinancialCompliances", "FinancialCompliance")</li>
                        <li id="Team">@Html.ActionLink("Team", "Contact", "Home")</li>
                        <li id="Admin">@Html.ActionLink("Admin", "Admin", "Admin")
                        </li>
                    </ul>
                </div>

Now the above  menu is showing like when ordinary showing menu and shown  hover menu


okay .that finished .

Now you want  selecting  menu is showing  static .So put the below code in your header tag inside

 <script type="text/javascript">

        $(document).ready(function () {

            var url = window.location.pathname;
            var home = "Home/Index";
            var About = "Home/About";
            var Compliance = "Compliance/ManageCompliance";//Put your page url 
            var Admin = "Admin/Admin";
            var EditCompliance = "Compliance/EditCompliance";//Put your page url 
            var AddCompliance = "Compliance/AddCompliance";//Put your page url 
            var Team = "/Home/Contact";
            var AddSchool = "Admin/AddSchool";//Put your page url 
            var AddDistrict = "Admin/AddDistrict";//Put your page url 
            var EditSchool = "Admin/EditSchool";//Put your page url 
            var EditDistrict = "Admin/EditDistrict";//Put your page url 
            var ViewFinancialCompliance = "FinancialCompliance/ViewFinancialCompliances"//Put your page url 
            var AddFinancialCompliance = "FinancialCompliance/AddFinancialCompliance"//Put your page url 
         
            if (url.indexOf(home) > -1) {
                $("#home").addClass("select");
                $(".select a:hover").addClass("select").show();
            }
            else if (url.indexOf(ViewFinancialCompliance) > -1) {
                $("#FinancialCompliance").addClass("select").show();
            }
            else if (url.indexOf(AddFinancialCompliance) > -1) {
                $("#FinancialCompliance").addClass("select").show();
            }
            else if (url.indexOf(About) > -1) {
                $("#About").addClass("select").show();
            }
            else if (url.indexOf(Compliance) > -1) {
                $("#Compliance").addClass("select").show();
            }
            else if (url.indexOf(AddCompliance) > -1) {
                $("#Compliance").addClass("select").show();
            }
            else if (url.indexOf(EditCompliance) > -1) {
                $("#Compliance").addClass("select").show();
            }
            else if (url.indexOf(Admin) > -1) {
                $("#Admin").addClass("select").show();
            }
            else if (url.indexOf(AddSchool) > -1) {
                $("#Admin").addClass("select").show();
            }
            else if (url.indexOf(AddDistrict) > -1) {
                $("#Admin").addClass("select").show();
            }
            else if (url.indexOf(EditSchool) > -1) {
                $("#Admin").addClass("select").show();
            }
            else if (url.indexOf(EditDistrict) > -1) {
                $("#Admin").addClass("select").show();
            }
            else if (url.indexOf(Team) > -1) {
                $("#Team").addClass("select").show();
            }
            else {
                $("#home").addClass("select").show();
            }

        });
        
    </script>


Now you can see selecting  menu is selected.

for see below image .Its shown as  selecting menu is selected


But you like ,you  can  change your font color and etc  in css



Tuesday, 26 March 2013

Increase Session Time Out(Automatic Log off problem )in asp.net

Add this code in your webconfig


<system.web>
    <authentication mode="Forms">
          <forms timeout="50"/>
    </authentication>

    <sessionState timeout="60"  />
</system.web>
And please check this same issue with best answers

Sunday, 24 March 2013

Types of SQL Keys




  • Super Key

    Super key is a set of one or more than one keys that can be used to identify a record uniquely in a table.Example : Primary key, Unique key, Alternate key are subset of Super Keys.
  • Candidate Key

    A Candidate Key is a set of one or more fields/columns that can identify a record uniquely in a table. There can be multiple Candidate Keys in one table. Each Candidate Key can work as Primary Key.
    Example: In below diagram ID, RollNo and EnrollNo are Candidate Keys since all these three fields can be work as Primary Key.
  • Primary Key

    Primary key is a set of one or more fields/columns of a table that uniquely identify a record in database table. It can not accept null, duplicate values. Only one Candidate Key can be Primary Key.
  • Alternate key

    A Alternate key is a key that can be work as a primary key. Basically it is a candidate key that currently is not primary key.
    Example: In below diagram RollNo and EnrollNo becomes Alternate Keys when we define ID as Primary Key.
  • Composite/Compound Key

    Composite Key is a combination of more than one fields/columns of a table. It can be a Candidate key, Primary key.
  • Unique Key

    Uniquekey is a set of one or more fields/columns of a table that uniquely identify a record in database table. It is like Primary key but it can accept only one null value and it can not have duplicate values. For more help refer the article Difference between primary key and unique key.
  • Foreign Key

    Foreign Key is a field in database table that is Primary key in another table. It can accept multiple null, duplicate values. For more help refer the article Difference between primary key and foreign key.
    Example : We can have a DeptID column in the Employee table which is pointing to DeptID column in a department table where it a primary key.
  • Wednesday, 20 March 2013

    Create FaceBook Like button in my application

    This article give highly proper code
    1: Include the JavaScript SDK on your page once, ideally right after the opening <body> tag.


    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>


    2: Place the code for your plugin wherever you want the plugin to appear on your page.

    <div class="fb-like" data-send="true" data-width="450" data-show-faces="true"></div>


    How to reduce angular CLI build time

     Index: ----- I am using angular cli - 7 and I am going to tell how to reduce the build time as per my knowledge. Problem: -------- Now the ...