Wednesday, February 25, 2015

General information of asp.net mvc

http://www.aubrett.com/AboutUs.aspx

Date picker MVC 5

http://stackoverflow.com/questions/21104633/how-to-add-date-picker-bootstrap-3-on-mvc-5-project-using-the-razor-engine

https://www.nuget.org/packages/Bootstrap.Datepicker

Install-Package Bootstrap.Datepicker




http://www.asp.net/mvc/overview/older-versions/using-the-html5-and-jquery-ui-datepicker-popup-calendar-with-aspnet-mvc/using-the-html5-and-jquery-ui-datepicker-popup-calendar-with-aspnet-mvc-part-4

In Solution Explorer, expand the Views folder, expand the Shared folder, and then right-click the Views\Shared\EditorTemplates folder.
Click Add, and then click View. The Add View dialog box is displayed.
In the View name box, type "Date".  (http://www.aubrett.com/InformationTechnology/WebDevelopment/MVC/DatePickerMVC5.aspx, the view name part is not clear)
Select the Create as a partial view check box. Make sure that the Use a layout or master page and Create a strongly-typed view check boxes are not selected.

Click Add. The Views\Shared\EditorTemplates\Date.cshtml template is created.

below is copied from the reference web pages in case the website not available.

@model Nullable<DateTime>

@{

    DateTime dt = DateTime.Now;

    if (Model != null)

    {

       dt  = (System.DateTime) Model;

    }

    @Html.TextBox("", String.Format("{0:d}", dt.ToShortDateString()), new { @class = "form-control datecontrol", type = "date"  })

}
move to our data model. In the case of a user registration form, this is likely going to be found in the "RegisterViewModel" class of "~/Models/AccountViewModels". We want to be sure that the data annotation is set to a type of DateTime as follows:
[Display(Name="Birth Date")]

 [Required]

[DataType(DataType.DateTime)]

public DateTime BirthDate { get; set; }
we move to the "Register.cshtml" view located under "~/Views/Account". The Birthdate field may or may not contain a textbox control. Let's change that just a bit to look like this:
<div class="form-group">

 @Html.LabelFor(m => m.BirthDate, new { @class = "col-md-2 control-label" })

   <div class="col-md-10"> @Html.EditorFor(m => m.BirthDate)

  </div>

  </div>
Now, we will add a script to our "~/Scripts" directory and name it "DatePickerReady.js". Inside this script file, place the following code:
 if (!Modernizr.inputtypes.date) {

    $(function () {

        $(".datecontrol").datepicker();

    });

}
Finally, we will add these javascript files to our "BundleConfig.cs" file located in "~/App_Start". Note that this is how we are getting these scripts loaded in this example. This method will make them global to the project. If only rarely using a datepicker component, you may want to load them only for individual views.
Change the default bootstrap and css bundles to look like this:
 bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(

                      "~/Scripts/bootstrap.js",

                      "~/Scripts/respond.js",

                      "~/Scripts/bootstrap-datepicker.js",

                      "~/Scripts/DatePickerReady.js"

                      ));



 bundles.Add(new StyleBundle("~/Content/css").Include(

                      "~/Content/bootstrap.css",

                      "~/Content/bootstrap-datepicker3.css",

                      "~/Content/site.css"

                      ));


Friday, February 20, 2015

ASP.NET - Date Picker Server Contro

http://www.codeproject.com/Articles/42810/ASP-NET-Date-Picker-Server-Control

Tuesday, February 17, 2015

Sunday, February 15, 2015

Date picker with sample code

http://www.codesprouts.com/post/Creating-A-DatePicker-Extension-In-ASPNet-MVC.aspx

Date picker

http://www.codeproject.com/Articles/62031/JQueryUI-Datepicker-in-ASP-NET-MVC.aspx

Html helper custom date picker

http://stackoverflow.com/questions/3700253/how-do-i-create-a-custom-date-picker-html-helper

html helper for date

http://stackoverflow.com/questions/133671/format-date-on-binding-asp-net-mvc

http://www.spaprogrammer.com/2014/01/mvc-datepicker-easiest-way.html?m=1

http://forums.asp.net/t/2012744.aspx?HTML+Helper+for+JQuery+DatePicker+using+ViewModel

Thursday, February 12, 2015

Asp.net Mvc profile

https://ashuthinks.wordpress.com/2012/01/08/asp-net-mvc-profile-provider/

http://www.codeproject.com/Articles/420052/Implementing-User-Profiles-in-ASP-NET-A-Beginners

Sunday, February 8, 2015

Add user script

mongo = new Mongo("localhost");
db = mongo.getDB("admin");
db.addUser( { user: "dbadmin",
              pwd: "test",
              roles: [ "readWriteAnyDatabase",
                       "dbAdminAnyDatabase",
                       "clusterAdmin" ] } );
db.addUser( { user: "useradmin",
              pwd: "test",
              roles: [ "userAdminAnyDatabase" ] } )

save above in add_user.js file

mongo add_user.js
db.auth("mswregUser","xxxxx")

Saturday, February 7, 2015

Remote desktop through router

http://www.msfn.org/board/topic/16211-remote-desktop-connection-through-netgear-router/

Friday, February 6, 2015

Coded activity

Add a reference to System.Activities

using System.Activities;
using System.Activities.Statements;

using System.Activities.Expressions;

Thursday, February 5, 2015

Wednesday, February 4, 2015

search string in javascript

if (mystring.search("target") > 0){

user control

x.ascx
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="x.ascx.vb" Inherits="xxx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<script language="javascript" type="text/javascript">  

x.ascx.vb
Public Class xxx
    Inherits System.Web.UI.UserControl

in ascx the control grid view when bind to data source, then in ascx Javascript has access to the data source

ex id is part of the data field in the data souce
then you can  have javascript in ascx file

if (id !=null)
{
}
else
{
}


VS 2010 search in files

control shift F

Monday, February 2, 2015

ASP.NET MVC logged in user




http://stackoverflow.com/questions/263486/how-to-get-current-user-in-asp-net-mvc

@user.identity.Name is the logged in user.