an Error "Servername "TestingAzure73737DB" cannot be empty or null." appears by creating new ASP.NET MVC web site (named "TestingAzure73737DB") with Azure. I have just started to using Azure. First 3 websites were created without any errors. But 2 sites, that I have created later gives me errors. I don't understand sence of this error. This is name of new SQL Server, that I want to create for new web site in Azure. (Am I doing right, that I create separate SQL servers for each site, or it's better to create 1 server for all sites?) What is problem with this server name?

My configuration:

  1. Visual Stufio 2013 Community
  2. Visual Studio Online with TFVC
  3. Azure - free trial

What I'm doing:

  1. In VS create new ASP.NET MVC project with Azure publishing and TFVC
  2. Azure settings: new SQL server (TestingAzure73737DB), admin name and password.

Project created, but no new DB in Azure and error in Azure app service acitity window.

Thank you! Best regards, Dmitry

I want to know whether my ASP.NET MVC app

  • was built in 32-bit mode
  • is running in an IIS worker process which is in 32-bit mode (i.e. it's on a 32bit machine, or it's running in Wow32 on a 64bit machine)

I'm on shared hosting, so I have to check programmatically.

I can check Environment.Is64BitProcess, but I'm not sure if that's for my app or the worker process.

I have created a server control for a login panel. On this panel I have a textbox for the username and a textbox for the password. Below that there is the button for login.

I want the button to be disabled if either or both textboxes are empty.

For that I created a function that checks the length of the contents of the textboxes.

    function doCheck() 
{ 
    var lngth1 = document.getElementById('pnLogin_txtUserName').value.length; 
    var lngth2 = document.getElementById('pnLogin_txtPassword').value.length; 
    if (lngth1 > 0 && lngth2 > 0) 
      { 
        $('#pnLogin_btLogin').removeAttr('disabled'); 
      } else { 
        $('#pnLogin_btLogin').attr('disabled','disabled'); 
      } 
}

I run this function at the start and on every keyup event. That works great.

The problem is when the browser starts with the page. It fills in the username and password if they are stored. When the function is then run, it still disables the button even though there is information in the textboxes.

I tried this:

    setTimeout( function() 
{ 
  doCheck(); 
}, 2000); 

But after 2 seconds I see the button disabling while seeing my credentials filled in.

If I inspect the element in Chrome, I don't see my credentials in the html code. So where is it stored? How can I detect this?

My question is about the most list view. How can the different formats we list view record. For example, a record that should be golden background and record my own photographs, which were normal silver and have his own background?

I'm trying to add auto-complete to input field in MVC5 project. The form located in Layout.cshtml, and i want to use autocomplete for "School" input field. so as I understand, I have made to following steps: 1. I installed jQuery UI widget via NuGet packages manager. 2. In the bottom of the layout.cshtml, I added:

@Scripts.Render("~/bundles/jqueryui") 
@Scripts.Render("~/bundles/jquery")`

3. In bundleConfig.cshtml I added:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));

And also:

bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",             
"~/Content/themes/base/jquery.ui.autocomplete.css",             
"~/Content/themes/base/jquery.ui.theme.css"));
  1. Then, i wrote the following jQuery function:

    <script type="text/javascript">
    $(function () {
        $("#search").autocomplete({
            source: '@Url.Action("GetSchool")'
        });
    });
    </script>
    
  2. And the GetSchool function in the HomeController:

    public JsonResult GetSchool(string term)
    {
        ReviewDBContext db = new ReviewDBContext();
        List<string> schoolsList;
        schoolsList = db.Schools.Where(x => x.Name.StartsWith(term)).Select(y => y.Name).ToList();
        return Json(schoolsList, JsonRequestBehavior.AllowGet);
    }
    
  3. finally, i added the id of the query to the layout.cshtml page:

    <li class="searchLi"> <input type="text" class="form-control" id="search" autocomplete="on"> </li>
    

When I'm running the project, i got this error:

JavaScript runtime error: '$' is undefined

As I understood, to fix this error i need to add reference to jQuery library, so in the tags i added the following link:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

And then, I got this Error:

 Unhandled exception at line 18, column 13 in http://localhost:*****
 0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'autocomplete' 

But the autocomplete function is from the jQuery UI package that i installed before.

Note 1: i got the error in internet explorer. in chrome there is not error, but the autocomplete isn't working, so i think the problem relevant for both browsers. Note 2: I'm trying to use this tutorial http://blog.falafel.com/three-steps-use-jquery-ui-asp-net-mvc-5/

Maybe anyone know who to fix this problem? Thanks!

I am using a list to create tabs which have the list item as id. I am creating multiple tabs on the same page. However, the javascript code does not work for me...It only shows first tab and it fails to change to other tabs. I cannot use the minitabs plugin correctly, I do not know where to put the correct id/class name or if I am calling the minitabs correctly for each div id created by razor

cshtml:

@{ foreach (string id in Model.ids)
    { 
string idtimh = id;
<div class="matchBody">
  <div class="tabs" id=@idtimh>
        <ul class="tab-links">
                            <li class="current"><a href="#tab1">1 </a></li>
                            <li><a href="#tab2">Home</a></li>
                            <li><a href="#tab3">Over</a></li>

                        </ul>

                        <div class="tab-content">
                            <div id="tab-1"  class="tab active">

                                <p>AAA</p>
                            </div>

                            <div id="tab-2" class="tab">
                                <p>Tab #2 content goes here!</p>

                            </div>

                            <div id="tab-3" class="tab">
                                <p>Tab #3 content goes here!</p>

                            </div>                               
                        </div>
                    </div>
                </div>
            </div>           
}

jQuery:

<script>
jQuery.fn.minitabs = function (speed, effect) {
    var id = "#" + this.attr('id')
    $(id + ">div:gt(0)").hide();
    $(id + ">ul>li>a:first").addClass("current");
    $(id + ">ul>li>a").click(
      function () {
          $(id + ">ul>li>a").removeClass("current");
          $(this).addClass("current");
          $(this).blur();
          var re = /([_\-\w]+$)/i;
          var target = $('#' + re.exec(this.href)[1]);
          var old = $(id + ">div");
          switch (effect) {
              case 'fade':
                  old.fadeOut(speed).fadeOut(speed);
                  target.fadeIn(speed);
                  break;
              case 'slide':
                  old.slideUp(speed);
                  target.fadeOut(speed).fadeIn(speed);
                  break;
              default:
                  old.hide(speed);
                  target.show(speed)
          }
          return false;
      }
   );
}
</script>
<script>
    $('.tabs').each(function () {
        var idValue = this.id;
        var allIdValue = '#';
        allIdValue += idValue;

        $(allIdValue).minitabs(1);
    })
</script>

This question already has an answer here:

If an HTML form contains an input text field and it is declared like this:

<input type="email" id="loginEmail" placeholder="Email address" required>

Then the if this field is empty and user clicks on submit button then an error appears that "Please fill out this field"(Stackoverflow wont let me upload images because my reputation is too low :( )

But if the click on submit button of this form is handled via Javascript or JQuery and if false is returned from the function, no notification appears and no checking happens. How to resolve it? I want to handle the onClick event of submit button but still want this feature of checking empty fields. Any help?

i want design a web form,its have to control one Text Box and one Drop Down list when type a number between 5 and 10 in Text Box, Drop Down list is include 1,2,3,4,5 and when type a number between 11 and 20 in Text Box, Drop Down list is include 6,7,8,9,10. how to do it without page refreshing? please explain with code :) thank you

how to convert rupees to alphabets asp.net ? I have tried the below code but didn't work. var formatted = d.ToString();

    if (formatted.Contains("."))
    {
        //If it contains a decimal point, split it into both sides of the decimal
        string[] sides = formatted.Split(".");

        //Process each side and append them with "and", "dot" or "point" etc.
        return NumberToWords(Int32.Parse(sides[0])) + " and " + NumberToWords(Int32.Parse(sides[1]));
    }
    else
    {
        //Else process as normal
        return NumberToWords(Convert.ToInt32(d));
    }

Note :I need in the below format

eg :23,234.50 - twenty three thousand two thirty four rupees and 50 paise.

Show Discount Sticker or Tag on Product Image asp.net.

I am working on asp.net e-commarce . so i want to show discount percentage on product page. discount sticker should be show top left corner on product image.

As currently there is luck of documentation on DI topic - Dependency Injection. Can someone help me to understand following:

  1. What is the difference between these registrations?

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddTransient<IService, Service>();
        services.AddScoped<IService, Service>();
        services.AddSingleton<IService, Service>();
        services.AddInstance(service);
    }
    
  2. What are pros/cons of using built-in DI over existing solutions like (NInject, Autofac, Structure Map)?
  3. What are current limitations of default dependency injection (if any)?

I've been trying to get my sidebar to the bottom of the page, I dont want it to be position fixed because then the buttons would do a scroll along and I don't want that. I just want the background to extend to the bottom of the scrollable page. I've tried multiple "Solutions" and the only two outcomes I've had are that the background extends to the bottom of the visible page or just around the buttons... so yeah. I also ont want it to be like height:3000px, because of different screen resolutions.

This is in a Master Page

How it is: http://prntscr.com/7dpa8j

ASP of masterpage:

<body>

<form id="form1" runat="server">
    <asp:ScriptManager ID="mainSM" runat="server" />

        <div id="header">
            <asp:ContentPlaceHolder ID="ContentHolderDD" runat="server">

            </asp:ContentPlaceHolder>
            <div>
                <p id="teamNames" class="regularTextWhite">Tom, Rutger & Mike</p>
            </div>

            <img id="logo" src="../../Images/top2000.gif" />
            <div>
                <p id="welcomeMessage" class="regularTextWhite" runat="server">Welkom FIRST_NAME</p>
            </div>
            <asp:Button ID="btnLogout" text="Uitloggen" runat="server" CssClass="btnRed"  Visible="false" OnClick="btnLogout_Click"/>
            <asp:Button ID="btnLogin" text="Inloggen" runat="server" CssClass="btnRed" OnClick="btnLogin_Click" />     
        </div>
        <div id="sidebar">
            <div id="sideMenu" runat="server">
                <asp:Button ID="btnList" text="Lijst" runat="server" CssClass="btnClean" PostBackUrl="~/Pages/Pages/List.aspx"/>
                <asp:Button ID="btnArtists" text="Artiesten" runat="server" CssClass="btnClean" PostBackUrl="~/Pages/Pages/Artists.aspx"/>
                <asp:Button ID="btnSongs" text="Lietjes" runat="server" CssClass="btnClean" PostBackUrl="~/Pages/Pages/Song.aspx"/>
            </div>
        </div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
</form>
</body>

CSS:

#sidebar {
background-color: white;
border-right: 1px solid rgb(100, 100, 100);
width: 250px;
height:1000px;
float:left;
overflow-y:auto;
position:relative;

}

#sidemenu {
height:100%;
}

This my IDE solution explorer==>https://app.box.com/files/0/f/0/1/f_31320382634 This is the link to download the zip file==>http://glyphicons.com/files/glyphicons_free.zip This is folder structure of that extracted zip file.==>

http://i.imgur.com/CeR6Q0h.png

How to remove all the special charters from design page after binding the Data from .aspx design page

Help?

I tried this format, got output as 1,234,567,890.00

but I need in this format

1,23,567   
decimal unitPrice = 1234567890.00m; 
TextBox1.Text = Convert.ToDecimal(unitPrice).ToString("##,#0.00");

first sorry for my english. I'm noob in WCF. I have a WCF aplication mounted in IIS 7 with only Anonymous Authentication enabled. In the browser the credential works fine. But in de the test client response me "The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic Realm'"

I have tried a lot of configs for server and client without good results.

The web.config of server

<configuration>
  <connectionStrings>

        <add name="DefaultConnection" connectionString="Data Source=XXXX;Initial Catalog=MybMembership;User ID=XXXX;Password=XXXX"

          providerName="System.Data.SqlClient" />

      </connectionStrings>

        <system.web>

            <compilation debug="true" strict="false" explicit="true">

          <customErrors mode="Off">        
          </customErrors>

          <authentication mode="Forms" />      

          <membership defaultProvider="DefaultMembershipProvider">
            <providers>
              <clear />
              <add name="DefaultMembershipProvider"
                   type="System.Web.Security.SqlMembershipProvider"
                   connectionStringName="DefaultConnection"
                   enablePasswordRetrieval="false"
                   enablePasswordReset="true"
                   requiresQuestionAndAnswer="false"
                   requiresUniqueEmail="false"
                   maxInvalidPasswordAttempts="5"
                   minRequiredPasswordLength="6"
                   minRequiredNonalphanumericCharacters="0"
                   passwordAttemptWindow="10"
                   applicationName="/" />
            </providers>
          </membership>

          <roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">
            <providers>
              <clear />
              <add connectionStringName="DefaultConnection"
                   applicationName="/" name="AspNetSqlRoleProvider"
                   type="System.Web.Security.SqlRoleProvider" />
            </providers>
          </roleManager>
        </system.web>

        <system.webServer>
          <validation validateIntegratedModeConfiguration="false"/>

          <modules runAllManagedModulesForAllRequests="true">
            <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="BasicAuthenticationModuleHTTP" type="Module.UserNameAuthenticator,UserAuthenticator" />
          </modules>
          <handlers>
            <remove name="WebServiceHandlerFactory-Integrated"/>
            <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
                 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
                 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          </handlers>
        </system.webServer>

      <system.serviceModel>
      <bindings>
        <wsHttpBinding>
          <binding name="MywsHttpBinding">

            <security mode="Message" >

              <message clientCredentialType="UserName" algorithmSuite="Default" />

            </security>
          </binding>
        </wsHttpBinding>

        </bindings>

        <services>
          <service behaviorConfiguration="ServiceBehavior" name="MyService.Service1">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="MywsHttpBinding"
              contract="MyService.IService1" />

            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://wcfservice.domain.com/Service1.svc" />
              </baseAddresses>
            </host>
          </service>
        </services>

        <behaviors>
          <serviceBehaviors>
            <behavior name="ServiceBehavior">
              <serviceAuthorization principalPermissionMode="UseAspNetRoles"
                roleProviderName="AspNetSqlRoleProvider">
                <authorizationPolicies>
                  <add policyType="AuthorizationPolicy.HttpContextPrincipalPolicy, AuthorizationPolicy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
                </authorizationPolicies>
              </serviceAuthorization>
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceCredentials>
                <!--
                <userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
                  membershipProviderName="DefaultMembershipProvider" />
                -->
                <serviceCertificate findValue="02BCEC4AAFA8A0E176F569AA94659CBB84BA2B6A" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>

              </serviceCredentials>

            </behavior>
          </serviceBehaviors>
        </behaviors>

        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
      </system.serviceModel>
    </configuration>

Now the client app.config

<configuration>

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                allowCookies="false">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"
                    enabled="false" />
                <security mode="Message">

                    <message clientCredentialType="UserName" negotiateServiceCredential="true"
                        algorithmSuite="Default" establishSecurityContext="true" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://wcfservice.domain.com/Service1.svc"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
            contract="WCFService.IService1" name="WSHttpBinding_IService1">
            <identity>
                <certificate encodedValue="AwAAAAEAAAAUAAAAArzsSq+ooOF29WmqlGWcu4S6K2ogAAAAAQAAAN4EAAAwggTaMIICwqADAgECAhBqa2EHdh6OtEcORJjTfHWQMA0GCSqGSIb3DQEBBQUAMCkxJzAlBgoJkiaJk/IsZAEZFhd3Y2ZzZXJ2aWNlLmpvc2VndW1hLmNvbTAeFw0xNTA1MjgwMzAwMDBaFw0yNTA2MDQwMzAwMDBaMCkxJzAlBgoJkiaJk/IsZAEZFhd3Y2ZzZXJ2aWNlLmpvc2VndW1hLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALR6cdxfO+cbUmEf1yBXGPVq2ORZAfC94ErM9+pnQwjN6FlWgxLSOzguP4bdf5+RlE85Hzuuh30vKakGan0U/qAd+yOMuTd2U0JNM4kR/GxTFMp6ty9qXWWMEGWY8r832kF8clz+GgKMVUTa+aqRJcUgum3zHlvhIwwQP8yHc/AgYLIpwPLzKADslK622WAufcVt7xFlcZONPd8xYPF8dZWa8Are8blCH3OrVAjCiHOw/IFhDviZ0lpEXE9aoJ/AyJUTHtXAKxLAJX30mWFC+HZapkMhDZ5zfWHhTeel4XdDThsDLse/B9NMBDqlhlAH4DtPQGkxb6f681j/J84XsqvVGGi+y/PBSanba4YPHnTRAte8gZ/JA0zuwCHhJZWv/c0cIyP6OYhQqys02BNIMhZ/XgTv3abWt42QMhgK1uvBBQQhlzX6MB8bbZg3oe1YRq/Un7lLj8PEbeuVyoKFZYJAMFMry48zdcAZb7MYiek3LEs1u7jkQvEF6Rn8t9UlUSHLpGKUoWziB21Hr+6I4qvfkRwbbHWmUK4PRdhC4/oyE9T9O5/uFkkqx43oxEattg5BLHFBaHoIfYxTiP3PubxQkti5YWXFAcTCt74RVjw0QUW3RBMeV1Fj5oQ4yR9u6YxSR9w+8Q0BUnxvh1ZSIYaDbzAZaKQ9odIug9YerpgjAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBADcsLNOZ0DT0ikGHcHxjQGgagLaCpOA5UXZh9eUTojRZVMx3w4+2nl7CKQjXEmUMQdKJKMm6D677r5eugI+hzC8rq7ZkhhSVoZgAXRDsK0OvzgmP4gCinsDlqiFvKgQm/AsQtFuDHYnz4r+fVkwKQu+53qWLa1ST5IViPH9Pvm5mvNAtSTUOf0bkLLob5nKKvGAW/hDAEtvSpwWyoGQTs9Jer2/5D4YcYa/z5s9FfFS2WmqKlcbT5kRddxI6DiYQeBf4ohRW9QhNXHbAMW5Zn7l17PxcvQHTTkv36y0x6btHTClxy9UgURkkNnLKhBP5PFPoFx5vT3xXHcJIOPiUMLETZ04v7Bs7Kp4huyt8JO2B45uEDtiUu5NcZIAgdw050BAwVjN9aNMU39O6LEhJ58iAwQBfuy1ODjvdLcKGpUrJaYfvJHmWs8VtZq8z3a3DPz6hoASleJoKykrn3zq90AdNAn0PtDfu+8OsLA+SzcVsj0y8puzat2xJWj3YA7hwqAwEbMOWb6Fgqwm1wkToNYxsPh0jYH9u+pNE711+Mi53zyMKSSdLw81Zq+zWqrleUSbc0s1R/2yG8TUWE4DnL1pypL6fjekGg+FMPJGk9wK6nvkJxYuxdGXl/Lx7i4Cr5+AZn3VYO8yc8Y7kOUkZFxLLoQDaibLYUCqBEAFVZOS5" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>

The code client

Service1Client c = new Service1Client();
        c.ClientCredentials.UserName.UserName = "admin";
        c.ClientCredentials.UserName.Password = "admin123";
        c.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;          
        result= c.GetData(123);          
        MessageBox.Show(result);

I get different result when uncomment in to the server

<!--
        <userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
          membershipProviderName="DefaultMembershipProvider" />
        -->

and comment in Modules (this is a class for custom authentication with membership provider)

<add name="BasicAuthenticationModuleHTTP" type="Module.UserNameAuthenticator,UserAuthenticator" />

the difference is at I get Acces Denid :'( Any help is appreciated!

I am trying to show year and month where users can select year and month as dropdown from the date-picker but my issue is that the year drop down is not showing all the years when you select it first. For example, when i select the year drop-down, it shows me the years from 2005 to 2025 in the selection. Is there a way to show the scroll-bar when users can use the scroll-bar to go all the way back to 1950 or 1960 when i select the year dropdown?

 <script type="text/javascript">
        $(document).ready(function () {
            $('.datepicker').datepicker({
                changeMonth: true,
                changeYear: true
            });
        });
    </script>

This is more a question regarding understanding how and when Nancy might cancel an async request handler via the provided cancellationToken instance.

Basically what I am wondering about is in what conditions is the token's .IsCancellationRequested set to true - is this documented or explained somewhere?

How does Nancy handle async handlers that 'never' return / in 'time'? And regarding 'in time': is there a timeout / limit after which handlers do get cancelled?

I am receiving an email as an HTTP POST to my URL. The controller code is as follows:

public void Post(System.Net.Http.Formatting.FormDataCollection formData)
{
    ...
}

When sending a simple text email to the URL, everything works fine: the entire email is in formData, broken out into its parts.

However, when I send an email with embedded images and attachments, I get a "415 Unsupported Media Type" error.

The messages are as follows:

"Message": "The request entity's media type 'multipart/form-data' is not supported for this resource.", "ExceptionMessage": "No MediaTypeFormatter is available to read an object of type 'FormDataCollection' from content with media type 'multipart/form-data'.

How do I receive this message in the Post function?

(the format of messages it can receive is x-www-form-urlencoded as versus form-data)

I am having issues correctly aligning buttons within with my razor markup.

In a form-horizontal:

<div class="row">
  <div class="col-md-6">
    <div class="form-group">
      @html.labelfor
      @html.editorfor
      @html.validationmessagefor
    </div>
  </div>
  <div class="col-md-4">
     <button class="btn btn-default" type="button" id="buttonId">
         <span>Button Label</span>
     </button>
  </div>
</div>

The button aligns with the <label> element, and I am really looking for it to align with the <input>. I have tried using margins and padding but it has not produced the results I am looking for.

EDIT: I have included a Fiddle Link here

I'm learning ASP.NET MVC 4. I'm finding documents to learn about Razor and MVC. I google and read Razor tutorial at w3schools, codeproject but I don't find full document to learn all about Razor controls and its syntax.

Can someone know where I can find it ?

Thank you