I have been trying to get the last inserted id into my code but i get 11 or 12 as the returned id, if the parameter type is set to either int 32 or int64 respectively.

This is the procedure i am using

CREATE procedure [dbo].[Sophia_FND_SalesOrder_CREATE](
@contact int,
@deliveryAddress varchar(50), 
@Charge float, 
@GrossTotal float, 
@PaymentMode varchar(50), 
@organisationId int, 
@userid varchar(50),
@amtpaid float,
@SalesOrderId int OUTPUT
insert into Sophia_FND_SalesOrder(ContactId, deliveryAddress, Charge, GrossTotal, PaymentMode, organisationId,userid, AmountPaid)
values(@contact,@deliveryAddress, @Charge, @GrossTotal, @PaymentMode, @organisationId, @userid, @amtpaid)
RETURN  @SalesOrderId

This is the function i am using in my class

 Public Shared Function Create_salesOrder(ByVal contact As Integer, ByVal deliveryAddress As String, ByVal Charge As Double, ByVal GrossTotal As Double, ByVal PaymentMode As String, ByVal organisationId As Integer, ByVal userid As String, ByVal amtpaid As Double) As Integer

        Dim comm As DbCommand = CreateCommand17()
        comm.CommandText = "Sophia_FND_SalesOrder_CREATE"

        AddParameter(comm, "@contact", contact, DbType.Int64)
        AddParameter(comm, "@deliveryAddress", deliveryAddress, DbType.String)
        AddParameter(comm, "@Charge", Charge, DbType.Double)
        AddParameter(comm, "@GrossTotal", GrossTotal, DbType.Double)
        AddParameter(comm, "@PaymentMode", PaymentMode, DbType.String)
        AddParameter(comm, "@organisationId", organisationId, DbType.Int64)
        AddParameter(comm, "@userid", userid, DbType.String)
        AddParameter(comm, "@amtpaid", amtpaid, DbType.Double)
        AddParameter(comm, "@SalesOrderId", DbType.Int64, ParameterDirection.Output)

        Dim id As Integer
        Dim insertResult As Int32 = -1

            insertResult = ExecuteNonQuery6(comm)
            id = Convert.ToInt64(comm.Parameters("@SalesOrderId").Value)
        Catch ex As Exception

            Throw ex
        End Try
        'Return insertResult <> -1
        Return id
    End Function

This is how i call it in my code behind

 Dim sale_id As Integer
            If IsNothing(Session("soid")) Then
                sale_id = Create_salesOrder(CInt(drpcontact.SelectedValue), txtdelivery.Text, lblCharge_unformated.Text, total, drpPayMode.SelectedItem.Text, SessionWrapper.OrganisationId, SessionWrapper.LoggedInUserID, CDbl(txtpayment.Text))
                If Not IsNothing(sale_id) Then
                    Session("soid") = sale_id

                    Me.MessageBoard1.MessagePanel.CssClass = "errorMessage"
                    Me.MessageBoard1.MessagePanel.Visible = True
                    Me.MessageBoard1.MessageLabel.ForeColor = Drawing.Color.Green
                    Me.MessageBoard1.MessageLabel.Text = "done"
                    Me.MessageBoard1.MessagePanel.CssClass = "errorMessage"
                    Me.MessageBoard1.MessagePanel.Visible = True
                    Me.MessageBoard1.MessageLabel.ForeColor = Drawing.Color.Red
                    Me.MessageBoard1.MessageLabel.Text = "Error Occured on creating sales"
                End If
end if

I found a way that work but the syntax is entirely different and i would like to stick to my syntax. The problem should be in my class function but i cant seem to know where i did the mistake.

Whenever i run this, i either get 11 or 12 as the return id which is totally wrong


I am Trying to Apply Validation to my Login Page. Separate Javascript Function is Used for that.But That Function Is Not calling any way. My javacript Code is :

<script type="text/javascript">
        function myFunction() {
            var pass = document.getElementById("passwordsignup").value;
            var ConfirmPass = document.getElementById("passwordsignup_confirm").value;
            var email = document.getElementById("emailsignup").value;
            var uname = document.getElementById("usernamesignup").value;

            var PassExpr = "/^[a-zA-Z0-9!@#$%^&*]{6,16}$/";
            var emailExp = "/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([com\co\.\in])+$/";

            if (uname == "" && email == "" && pass == "" && ConfirmPass == "") {
                alert("All Feilds are Required");

                return false;
            if (uname == "")
                alert("Please Enter User Name !!");
                return false;

            if (email == "")
                alert("Please Enter Email !!")
                return false;
              else {
                    if (!email.match(emailExp)) {
                        alert("Please Enter Valid Email Id");
                        return false;
            if (pass == "")
                alert("Please Enter Password..!!");
                return false;
            else {
                if(pass.length>6 && pass.length<16)
                    if (!PassExpr.test(pass)) {
                    alert("password should contain atleast one number and one special character");
                    return false;

                else {
                    return false;

            if (ConfirmPass == "")
                alert("Please Re-Enter Password..!!");
                return false;
            else {
                if (pass != ConfirmPass) {
                    alert("Please Re-Enter Password to Match !!!!!");
                    return false;

and my Form is:

 <div id="register" class="animate form">
                            <form id="form2" runat="server" onsubmit="return myFunction();">
                                <h2> Sign up </h2> 
                                    <label for="usernamesignup" class="uname">UserName</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <input id="usernamesignup" name="usernamesignup" required="required" type="text"  placeholder="User Name" runat ="server" onchange="checkUserName();"/>
                                   <%--<asp:TextBox ID="usernamesignup1" runat="server" OnTextChanged="checkUserName()" ></asp:TextBox>--%>
                                    <asp:Label ID="LabelStatus" runat="server" Text="Label"></asp:Label><br />
                                    <label for="emailsignup" class="youmail" >Email&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <input id="emailsignup" name="emailsignup" required="required"  type="email" placeholder="Email" runat="server" />

                                    <label for="passwordsignup" class="youpasswd">password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; </label>
                                    <input id="passwordsignup" name="passwordsignup" required="required" type="password" placeholder="Password" runat="server"/>
                                    <label for="passwordsignup_confirm" class="youpasswd">Please confirm your password&nbsp; </label>
                                    <input id="passwordsignup_confirm" name="passwordsignup_confirm" required="required" title="Please enter the same Password as above." type="password" placeholder="Re-Enter Password" runat="server"/>

                                <p class="login button"> 
                                    <%--<asp:Button ID="btnSignup" runat="server" Text="Sign Up" OnClick="Button1_Click" Width="150px" CssClass="btnSignup" Height="46px" />&nbsp&nbsp&nbsp&nbsp&nbsp</p>--%>
                                    <asp:Button ID="btnSignup" runat="server" Text="Sign Up" onClientClick="return myFunction();" OnClick="btnSignup_Click" Width="150px" Height="40px"/>

Form is Submitted without Checking For validation. there is Any Other Way to Call Javascript Function.

I need to enable Cross Origins Resource Sharing in my Web Api .Net Core, but nothing happens, I never have the Allow-Control-Allow-Origin in the request header.

Here is Startup.cs config :

 public void ConfigureServices(IServiceCollection services)

        services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin()

        services.Configure<IISOptions>(options =>
            options.AutomaticAuthentication = true;

 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)

i want to develop web page builder system where on Run time are end user can click on create web page and also he can put control into it like ( text box,label,date,grid view,etc....) Any suggest if there is any open source package already Available in the market. Thanks in Advance.

Upload one image file using Jquery and store server site but without using Generic handler or Asp.net ASHX handler.

example this design page

I'm working on project using MVC3 + Razor.I want to let my text box allow only text. I tried to apply data annotation in my data model (First Code):

[DataType(DataType.Text ,ErrorMessage ="Error")]

but, it's not working.Could anyone help me ?

I want to pull the employee records who have joined three months back to the company, I'm using a accdb database and the coding would be asp.net c#, I always get stuck in the date and days for retirieving records.

thanks in advance.

I'm unable to output variable from code behind to aspx file. Please help me out, I'll be thankful. Here is code of aspx.cs and aspx files:

protected void Page_Load(object sender, EventArgs e)
             String Marks = (String) (Session["Marks"]);


Here is code of aspx file:

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <form id="form1" runat="server">

        <h1> <%=Marks%> </h1>


I'm looking at building support for multiple contributors like Google docs into my AngularJS 1.x application with a ASP.NET MVC backend. Is SignalR still the way to go? It is getting old and with Office Online supporting the same multiple user real-time collaboration is there a better framework available that gives me a better start within the Microsoft stack on Azure?

I have the following case where a user has selected a product, the product record has been retrieved and the backorder flag is set. I want to ask the user if the want to include it in the order anyway. I can't seem to find an exaample anywhere that demonstrates it in an IF statement.

My VB Code Snippet:

    Dim backorder = myDataTable.Rows(0)("backorder").ToString()
    If backorder = "True" And <somehow ask user it they want to order anyway> Then
       'do something
    End If

My Javascript in aspx file:

    <script type = "text/javascript">
     function Confirm() {
         var confirm_value = document.createElement("INPUT");
         confirm_value.type = "hidden";
         confirm_value.name = "confirm_value";
         if (confirm("Selected item is on temporary back order. Do yuou want to include it on this order?")) {
             confirm_value.value = "Yes";
         } else {
             confirm_value.value = "No";

I can read the variable being added, by javascript, to the page from VB, but can't figure how to call the javascript in order to prompt the user. For some reason I can't get my head around this. Please advise with example.

I am using the aspnetcore-spa template, creating a project with the command "dotnet new angular". See https://jonhilton.net/2017/02/21/create-a-vs2017-angular-2-and-net-core-site-using-the-command-line/. The current set of templates is version 1.0.3, which adds Angular 4.1.2 to the npm dependencies. This works great to get a project running quickly.

However, right out of the box, the "counter" page does not work with IE 11. If you navigate to the "counter" link, and look at IE's console, you will see the message: "Unable to get property 'apply' of undefined or null reference". And when you click the "Increment" button, nothing happens. (It works fine for Chrome and Firefox, but not IE.)

I did some digging, and it seems that the root of the problem is that the .assign method is not implemented in IE11. See Angular2 IE11 Unable to get property 'apply' of undefined or null reference

The fix, according to the link above, is to import the Object.assign polyfill by MDN. However, I don't know how to accomplish that in the project. What I have tried is:

1) Add to package.json: "mdn-polyfills": "^3.5.0"

2) Add ''mdn-polyfills' to webpack.config.vendors.js

3) Run "webpack --config webpack.config.vendor.js" from a command prompt at the root of the project folder, which results in an error:

Module not found: Error: Can't resolve 'mdn-polyfills'

I don't know what to do next. Steps 1 and 2 above do not resolve the problem. I tried adding to app.module.shared.ts the following:

import 'mdn-polyfills/Object.assign';

This compiled fine, but did not help anything. I am not planning to use the counter page anyway, of course, but I get the same error (in IE 11 only) on a form I have created in a component I actually do care about.

So, once again, I am left to struggle with how to set up an environment that works, rather than actually coding Angular components. Oh, how I miss the days when I could just add a package via NuGet and it would just work!

If anyone can help, it would be most appreciated.

How to enable SortExpression as the Text=' ' is not a normal <%# data %> but a <%#If condition, true, false %>. If coding is required I would appreciate it in vb.net thanks!

<asp:TemplateField HeaderText="Completion Date">
             <asp:Label runat="server"
            ID="lblPrjStatus" Font-Bold="True" Text='<%#If(IsDBNull(Eval("Overdue_Date")), CType(Eval("Completion_Date", "{0:M/d/yyyy}"), String), CType(Eval("Overdue_Date", "{0:M/d/yyyy}"), String))%>'
            ForeColor='<%#If(IsDBNull(Eval("Overdue_Date")), System.Drawing.ColorTranslator.FromHtml("#333333"), System.Drawing.Color.Red)%>'></asp:Label>

Please point me in the right direction if there is an answer to my question already.

I am new to c# and asp.net mvc. I am working on a project and in this particular project I have a model that reflects how the customer table will be structured when I run a migration. have a look at my Customer model:

using System;
using System.ComponentModel.DataAnnotations;

namespace Vidly.Models
    public class Customer
        public int Id { get; set; }

        public string Name { get; set; }

        public bool IsSubscribedToNewsletter { get; set; }

        public MembershipType MembershipType { get; set; }

        [Display(Name = "Membership Type")]
        public byte MembershipTypeId { get; set; }

        [Display(Name = "Date of Birth")]
        public DateTime? Birthdate { get; set; }

My question, I understand what it means to set string to the name property ex:

public string Name { get; set; }

but what does it mean when some properties are set to their own name and why do we do it? ex:

public MembershipType MembershipType { get; set; }

Please give a detailed response. Thanks.

When user comes on my site by url, controller generates _Layout + partialView inside.

Then when user walks by site, controller generates same partialView and sends by ajax.

Is there a good solution for this case?

P.S.: My workaround:

public class HomeController : Controller
    public ActionResult Index(int id, bool ajax = false)
        var model = GetModelById(id);

        return ajax ? (ActionResult) PartialView(model) : View(model);

Where /Home/Index/42 - for static page and /Home/Index/42?ajax=true - for ajax.

I started to get this error today all of a sudden. I left my project in working state, and when I reopened it I got this error:

Error: tsc.exe exited with code 2

I have searched throughout the internet for solution and it looks like something got wrong with my typescript installation apparently??

But I have no clue what it could be, so I installed newest version of typescript 2.3.4 ( I think ), and now I'm receiving this error:

Build: /location/location/jquery.autocomplete.d.ts not found
Build: /location/location/moment/moment.d.ts not found

I have checked the path for 2nd file moment.d.ts file and it's in my project.

What's going on, I'm loosing my mind over here?!

Can someone please help me out ?

I am experienced in desktop but new in web development. In my ASP.NET WebForms app, I have a Master page with Header, Menu, Footer & a ContentPlaceHolder. Header, Menu, Footer works well as expected.

All time, I want my contentplaceholder to have 100% width & height & place the actual form (asp:content) in the center of the page. So the footer is lying on the bottom of the screen only; and in center their may be some background color. When the content page is called, it displays in center or so.

Basically, screen should always be occupied fully. Not like content is shown just in half page and the footer is in middle of screen & rest all is blank.

I am trying to achieve this thing in web forms, but can't get a way for it. In my master page, I also tried this :

   <div class="container body-content">
     <div  style="width:90%;height:80%;">
            <asp:ContentPlaceHolder ID="MainContent" runat="server" >
        <hr />
        <footer>.... </footer>

But yet, no success. Currently, my default home page doesn't have any contents in it, so header is followed by footer. I don't like this. I want footer to be on the footer of the browser only and in middle some bgcolor to be shown up.

I googled, but couldn't find any solution for this issue. Can anyone please help me achieve the goal ! Any help is highly appreciated.

Thanks a lot

I have an existing MVC - C# application that creates several "popup" screens that display or input needed information. I wanted to reuse the methodology in the application to pop up a version history display (listing the Versions with the changes that were made to them.

When ever I click on the link that should bring up the list, the javascript function that is called displays the function's code rather than executing the code.

I have this defined in my .css file. (This style under different names is used throughout the application)

    position: fixed;
    width: 50%;
    height: 70%;
    top: 15%;
    left: 25%;
    padding: 1%;
    background-color: white;
    border: 1px solid #444;
    border-radius: 5px;
    z-index: 100;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
    color: #f5f1ef;
    background-image: url('../images/bg.jpg');

In my view, I have added the following code (Originally this view only displayed the current version number statically)

<div style="float: left; width: auto;">
    <span ><a style="color:White" href="javascript:toggleHistory">JPortal, version @ViewContext.Controller.GetType().Assembly.GetName().Version</a></span>
        <div id="VersionHistoryList" style="display: none;">
            <span style="font-size: larger;">Version History</span>
            <div style="height: calc(100% - 100px); overflow: auto;">
                <div class="SearchResults">
                    @foreach (JudicialPortal.Models.VersionHistory.V sr in @JudicialPortal.Models.VersionHistory.HistoryList)
                        <span style="display: block; font-weight: bold;">
                            Version @sr.Number
                        <span style="float: left; width: 10%;"> @sr.Date </span>
                        <span style="float: right; text-align: left; width: 90%;">@sr.Description</span>
            <button type="button" class="m-btn red-stripe" onclick="$('#VersionHistoryList').hide(0);" style="float: left;">
                Cancel<i class="icon-remove"></i></button>


I added this .cs files to my model files (partial display here

namespace <applicationname..Models
    public class VersionHistory

        public class V
            public string Title { get; set; }
            public string Number { get; set; }
            public string Description { get; set; }
            public DateTime Date { get; set; }

        public static List<V> HistoryList
                var data = new List<V>();
                data.Add(new V() { Number = "1.0.1", Title = "Registration Setup", Date = new DateTime(2014, 7, 11), Description = "Setup For Registration." });
                data.Add(new V() { Number = "1.0.2", Title = ...

I should note that I took the above concept for the code from an ASPX application that displays the history of its application.

The javascript function that is called by the link in the in the tag is:

    toggleHistory = function () {

When the JavaScript is called instead of displaying the 'popup', it displays the code of the javacript function.

Image of screen displaying code

Any help would be most appreciated.

I have a text area where users have to write a description. I was wondering how to set a text box so that it is on multiple lines, allowing the user to see what they are writing. What I am looking for is similar to the environment that I am writing this question in.

<div class="form-group">
    <div class="col-md-10">
        @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })

I'm working on small mvc application, and on my view there is tab control which has 3 tabs, and depending on ViewBag value I need to open my third tab, here is image of a how my view looks: enter image description here

So when View is loaded, I need to check for a value of my ViewBag and depending on that I need to open my TAB 3, so here is what I've tried:

<div class="" role="tabpanel" data-example-id="togglable-tabs">
    <ul id="myTab" class="nav nav-tabs bar_tabs" role="tablist">
            @if (ViewBag.SuccessBody == null)
                <li role="presentation" class="active">
                    <a href="#tab_content1" id="home-tab" role="tab" data-toggle="tab" aria-expanded="true">TAB 1</a>
                <li role="presentation" class="">
                    <a href="#tab_content2" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">TAB 2</a>
                <li role="presentation" class="">
                    <a href="#tab_content3" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">TAB 3</a>
                <li role="presentation" class="">
                    <a href="#tab_content1" id="home-tab" role="tab" data-toggle="tab" aria-expanded="true">TAB 1</a>
                <li role="presentation" class="">
                    <a href="#tab_content2" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">TAB 2</a>
                <li role="presentation" class="active" onload="RedirectToTab();">
                    <a href="#tab_content3" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">TAB 3</a>


As you can see guys depending on a value od ViewBag.SuccessBody I tried to load corresponding HTML, so if there is a value then I would load HTML which include TAB3 To own class="active" (please read code detailed).

But unfortunatelly with this approach, TAB3 becoming active but not also OPENED, so its content is not visible, it's being kept acctually on TAB1 while TAB3 looks like it's active, and that is bad :( .

So what I've done is :

I wrote javasscript method which should really open TAB3, but I couldn't know how to invoke it so I guess I could invoke it using onload method on my li element, so guys as you can see in code above I wrote on my li


but unfortunatelly nothing happens..

And here is definition of my RedirectToTab javascript method:

function RedirectToTab() {
            var customVal = $("#editViewBag").val();
            if (customVal == 'True') {
                $('#myTab a[href="#tab_content3"]').tab('show');

So guys one more time, how can I open TAB3 depending on a vaue of my ViewBag?

Thanks guys Cheers

I have an ASP:Timer control in an update panel.

The timer ticks every 1000ms. I have some hidden fields in my update panel that may get updated in order to modify behaviour running with client side JS. On each tick, things can change, hidden fields get updated and the client side JS responds accordingly.

All works as expected, But I have noticed that my DOM gets bigger and bigger. It seems the timer's tick event gets injected as Ajax JS each time a tick occurs. I don't like this happening. It is all fine for a couple of minutes, but My app will be running for hours, and I surely don't want thousands of ajax timer scripts in my dom? I can refresh the page every now and again to "dump" all the ajax code, but I would like to know if I am missing something, or am I going about this the wrong way?


            <div id="timingControls">

                <asp:Timer runat="server" ID="racechecker" Interval="1000" Enabled="true" OnTick="racechecker_Tick" />

                <%-- hiddeen fields--%>
                <asp:HiddenField ID="raceState" runat="server" />
                <asp:HiddenField ID="raceTimeRemaining" runat="server" />
                <asp:HiddenField ID="raceTime" runat="server" />
                <asp:HiddenField ID="HUDPanel" runat="server" />
                <asp:HiddenField ID="HUDbarcolor" runat="server" />
                <asp:HiddenField ID="HUDtimecolor" runat="server" />
                <asp:HiddenField ID="HUDtimebackcolor" runat="server" />
                <asp:HiddenField ID="HUDtimebordercolor" runat="server" />
                <asp:HiddenField ID="HUDclocksize" runat="server" />



Ajax Code enter image description here

I'm trying to search through folders that are publicly accessible on another server but my application keeps getting the following error:

Message :Unable to connect to the remote server
StackTrace : at System.Net.HttpWebRequest.GetResponse() at commissioners_decisions._Default.uiSearchTermButton_Click(Object sender, EventArgs e) in d:\websites92\MainSite92\commissioner_decisions\Default.aspx.cs:line 500 Date :6/19/2017 9:59:52 AM....061[2]R6180

I'm pretty sure it has to do with the IIS permissions but I'm not sure what to give permissions to on the folders.

Any help would be appreciated.