Hi I am using a reportviewer control in visual studio 2012 and I want to reset the datasource of the report viewer, but I can't figure out the right name value combination: The Datasource in my .rdlc is "RF" and the Dataset in the .rdlc is "dsTotalOrderCalls" I have an Objectdatasource ID: "odsSales" and a type name: "RapidFire.RFTableAdapters.USP_TOTAL_ORDERCALLSTableAdapter" that is referring to a table adeapter in an .xsd (dataset) that is calling a stored procedure called "USP_TOTAL_ORDERCALLS" and returning a data table called: "USP_TOTAL_ORDERCALLSDataTable"

When I try to open a new instance of the reportdatasource ie, rv_SalesSC.LocalReport.DataSources.Add(new ReportDataSource("dsTotalOrdersCalls", odsSalesSC));

I receive an error message saying: Cannot create a connection to data source 'RF'

Can someone help me understand what values go into instantiating a new reportdatasource object? Thank you!!!

I have done a small Web Application by using .NET Framework 4.5. A chat room.
And I have published the App in my local IIS 7.0 server.
It works good.

But when I uploaded the published files into remote server via FTP.


enter image description here


I got an Error. http://www.it-zhai.com/liao8/zhu.aspx


enter image description here


The File Web.config was created by VS2013 during publish.

<?xml version="1.0" encoding="utf-8"?>
<!--
  Weitere Informationen zum Konfigurieren der ASP.NET-Anwendung finden Sie unter
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
    <system.web>
      <compilation targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
      <customErrors mode="Off" />
    </system.web>
</configuration>

And: I have configured the remote server for .Net Framework 4.5. enter image description here


How can I solve this problem. Thank you!

I have a panel with its visibility set to false. What I'm trying to do is dynamically create a LinkButton when my page is generated and have it so when I click the LinkButton, the panels' visibility gets set to true and it appears on my page.

I'm creating my LinkButton like so:

LinkButton _lb = new LinkButton();
_lb.Text = "Details";
_lb.Click += _lb_Click;

Here is the code for my LinkButton's Click event handlers:

protected void _lb_Click(object sender, EventArgs e)
{
      Panel1.Visible = true;
}

Whenever I render the page and click on the LinkButton, the event never fires. I can put a break point inside the event handler and it never gets reached. What am I missing?

EDIT:

I am adding the LinkButton to the page in a placeholder like so:

PlaceHolder1.Controls.Add(_lb);

EDIT2:

Thank you all for the replies so far. It seems like the problem is definitely to do with the lifecycle. To add details, the LinkButton is being created inside of a Timer_Tick event that is controlling the updating of an UpdatePanel. I don't know how to create the LinkButton in Page_Load and pass it to the Timer_Tick event. Any help?

I have an IIS 6.1 application in which I am attempting to maintain a socket server but I can't free the port:

In Global.asax.cs Application_Start I start a thread ProgramConnectionServerThread in which I've got:

int programPort = ServerConfiguration.Instance.ProgramConnectionPort;
ServerConfiguration.Instance.ProgramConnectionSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Socket listener = ServerConfiguration.Instance.ProgramConnectionSocket;
IPEndPoint localEndPoint = new IPEndPoint(Dns.Resolve(Dns.GetHostName()).AddressList[0], programPort);

listener.Bind(localEndPoint);
listener.Listen(10);
while (true)
{
    Socket handler = listener.Accept();
    // action
}

and in Global.asax.cs Dispose

try
{
    if (ServerConfiguration.Instance.ProgramConnectionServerThread != null)
    {
        ServerConfiguration.Instance.ProgramConnectionServerThread.Abort();
    }
}
catch (Exception eeg2)
{
// Log
}
try
{
    LingerOption lo = new LingerOption(false, 0);
    ServerConfiguration.Instance.ProgramConnectionSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, lo);
    ServerConfiguration.Instance.ProgramConnectionSocket.Shutdown(SocketShutdown.Both);
    ServerConfiguration.Instance.ProgramConnectionSocket.Close(); // this is Line 133
}
catch (Exception eeg2)
{
// Log
}

This approach does not seem to be working. In my logging I get the following error message on the Close() invocation:

A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
   at System.Net.Sockets.Socket.Shutdown(SocketShutdown how)
   at Contoso.Global.Dispose() in E:\Contoso\Global.asax.cs:line 133

If I restart the web site in IIS the port is not free! I get this message when I do the bind:

System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted

How do I free this port so on subsequent restarts of the application I can bind a new listener?

I have a 3rd party Asp.net (.NET 4.0) web application for which I'm responsible for developing additional content. I need to be able to use MVC and WebApi and so I need to be able to map routes.

Is there a way I can do this without having access to Application_Start (I don't have their source code)?

I will be starting my final year project for my degree soon and am aiming to create a web application with an ASP.NET C# front-end and a SOAP (or REST, haven't fully decided yet) web service back-end. I will be developing on my MacBook, which poses the problem with ASP.NET being a Microsoft framework and Visual Studio not being available for Mac OS, so I have turned to the Mono framework and its IDE, Xamarin Studio.

I have created a very, very basic SOAP web service which can be found here, deployed it to glassfish and can navigate to the wsdl. The problems start when I try and consume the web service from Xamarin Studio, I can get the proxy set up fine and I have created a very simple page that should display the result of calling the add web method. The markup:

<%@ Page Language="C#" Inherits="TryItOutNetApplication.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head runat="server">
    <title>Default</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:Button id="button1" runat="server" Text="Click me!" OnClick="button1Clicked" />
        Hey, the result of 1 + 2 is: 
        <asp:Label id="label1" runat="server" />
    </form>
</body>
</html>

The code-behind:

namespace TryItOutNetApplication
{
    using System;
    using System.Web;
    using System.Web.UI;
    using localhost;

    public partial class Default : System.Web.UI.Page
    {
        private FYPTestWebService ws;

        protected void Page_Init(object sender, EventArgs e)
        {
            ws = new localhost.FYPTestWebService();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            int i = ws.add(1,2);
            label1.Text = i.ToString();
        }

        public void button1Clicked (object sender, EventArgs args)
        {
            button1.Text = "You clicked me";
        }
    }
}

I then get the following error when I try and run the application:

Application Exception
System.Net.Sockets.SocketException
Connection reset by peer

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.
Exception stack trace: 
at System.Net.Sockets.Socket.EndReceive (IAsyncResult result) [0x0002d] in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:1816 
at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x0002f] in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/System/System.Net.Sockets/NetworkStream.cs:32

I have not been able to find any help for Xamarin Studio and it generally seems pretty awful compared to Visual Studio.

My question is

a) am I just doing something stupid with my above code/setup?

b) should I scrap Mono/Xamarin Studio and use something like VirtualBox to install Visual Studio and use that instead?

i have the following data structure:

enter image description here

my edmx relationships looks like this:

enter image description here

but i am having a hard time having data saved into the jSweep-Type table

here is what i'm doing right now:

public void SaveSweep()
        {
            tSweep ts = new tSweep();
           ts.stitle = this.stitle;
            ts.sURL=this.sURL;
            ts.dStar=this.dStar;
            ts.dEnd = this.dEnd;
            ts.dEntered=DateTime.Now;            


            using (sweepsEntities ctx = new sweepsEntities())
            {
                ts.lSweepFrequency = ctx.lSweepFrequencies.SingleOrDefault(t => t.fid == this.sFreq);
                ts.tUser = ctx.tUsers.SingleOrDefault(t => t.uid == 3);

                 foreach (int i in sType)
                 {
                     lSweepType st = new lSweepType();
                     st.tid = i;
                     ts.lSweepTypes.Add(st);
                 }
                 ctx.tSweeps.AddObject(ts);
                 ctx.SaveChanges();
            }
    }

sType is a list of type IDs selected on the form. i get no errors, but the data isn't there either.... what am i doing wrong?

this is the example i've been following: http://www.entityframeworktutorial.net/EntityFramework4.3/add-many-to-many-entity-using-dbcontext.aspx

Thank you!

This question already has an answer here:

am developing a javafx project in that i have one TABPANE with four tabs. I want for each tab one controller that controller should be communicate three other controllers.

i have created four fxml files and included in main fxml

like:

                  Tabpane -> MainController
                    /\

HomeController<-Home.fxml Connect.fxml ->ConnectController ...

Im building a MVC-application and one of the pages is updated with javascript. Need help figuring out how to link me to a specifik url with a HTML button.

Ill show you what i mean:

Im trying to do like i did here with the java value:

<img src="{2}" alt="blog image"/>

But it dont work here

"<input EntryId={0} type="button" value="Edit" onclick="location.href='@Url.Action("UpdateEntry/{*IDFROMJAVASCRIPTHERE*}","Competition")'" />    

Pretty sure i cant use the @Url.Action with java values. Whats the simplest way to solve this?

thanks

http://tinyurl.com/nozuogj

First image: Google Chrome Second image: Mozilla Firefox Third image: Internet Explorer

I would need all my browsers to show like in Chrome.

Thank's in advance!

I have a performance issue with a method call on a dll I have written. The following line gets called

lineManage.GetEnquiryLines(ident,null);

When calling it from a unit test project the code executes in {00:00:00.5339113}, however when I call the same method from my MVC application it seems to add another two seconds to the time to execute. Both are being run on the same machine.

Does anyone know of any way of identifying what's causing the bottle neck. I've tried using the profiler in visual studio, but that hasn't helped.

Thanks for your help

i am using entity framework database. But when i run my application, i got an exception named "An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code. The entity type User is not part of the model for the current context".

I got errror in context.Users.Add(df); part which is in LoginController.

My entity database code is as shown below: Model:User.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated from a template.
//
//     Manual changes to this file may cause unexpected behavior in your application.
//     Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MVCRegistrationAndLogin.Models
{
    using System;
    using System.Collections.Generic;
    
    public partial class User
    {
        public int Id { get; set; }
        public string LastName { get; set; }
        public string FirstName { get; set; }
        public string UserName { get; set; }
        public string Password { get; set; }
        public string Email { get; set; }
        public string abc { get; set; }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVCRegistrationAndLogin.Models;
using System.Security.Cryptography;
using System.Web.Security;

namespace MVCRegistrationAndLogin.Controllers
{
    public class LoginController : Controller
    {
        // GET: Login
        public ActionResult Index()
        {
            using (var db = new MyDbModelEntities())
            {
                return View(db.Users.ToList());
            }
        }

        public ActionResult UserLogin()
        {
            return View();
        }

        [HttpPost]
        public ActionResult UserLogin(string username, string password)
        {
            using (MyDbModelEntities context = new MyDbModelEntities())
            {
                var user = from u in context.Users
                           where u.UserName == username
                           select u;

                if (user.ToList().Count == 1)
                {
                    if (user.First().Password == CreatePasswordHash(password, user.First().abc))
                    {
                        Session["logged"] = user.First().UserName;
                        return RedirectToAction("ShowProducts", "Products");
                    }
                }
            }
            ModelState.AddModelError("_loginError", "Error in username and password");
            if (!ModelState.IsValid)
                return View();

            return RedirectToAction("UserLogin", "Login");
        }

        private static string CreateSalt()
        {
            RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
            byte[] byteArr = new byte[64];
            rng.GetBytes(byteArr);

            return Convert.ToBase64String(byteArr);
        }

        private static string CreatePasswordHash(string password, string aa)
        {
            string passwrodSalt = String.Concat(password, aa);
            string hashedPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(passwrodSalt, "sha1");
            return hashedPwd;
        }

        public ActionResult Register()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Register(User df)
        {
            try
            {
                using (var context = new MyDbModelEntities())
                {
                    df.abc = CreateSalt();
                    df.Password = CreatePasswordHash(df.Password, df.abc);
                    **context.Users.Add(df);**
                    context.SaveChanges();

                    return RedirectToAction("Index", "Home");
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                var outputLines = new List<string>();
                foreach (var eve in e.EntityValidationErrors)
                {
                    outputLines.Add(string.Format(
                        "{0}: Entity of type \"{1}\" in state \"{2}\" has the following validation errors:",
                        DateTime.Now, eve.Entry.Entity.GetType().Name, eve.Entry.State));
                    foreach (var ve in eve.ValidationErrors)
                    {
                        outputLines.Add(string.Format(
                            "- Property: \"{0}\", Error: \"{1}\"",
                            ve.PropertyName, ve.ErrorMessage));
                    }
                }
                //Write to file
                System.IO.File.AppendAllLines(@"c:\temp\tulsi_errors.txt", outputLines);

                // Showing it on screen
                throw new Exception(string.Join(",", outputLines.ToArray()));

            }
        }
    }
}

view:

Register.cshtml

@model MVCRegistrationAndLogin.Models.User

@{
    ViewBag.Title = "Register";
}

<h2>Register</h2>


@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    @Html.AntiForgeryToken()


    <div class="editor-label">
        @Html.LabelFor(model => model.LastName)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.LastName)
        @Html.ValidationMessageFor(model => model.LastName)
    </div>


    <div class="editor-label">
        @Html.LabelFor(model => model.FirstName)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.FirstName)
        @Html.ValidationMessageFor(model => model.FirstName)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.UserName)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.UserName)
        @Html.ValidationMessageFor(model => model.UserName)
    </div>


    <div class="editor-label">
        @Html.LabelFor(model => model.Password)
    </div>
    <div class="editor-field">
        @Html.PasswordFor(model => model.Password)
        @Html.ValidationMessageFor(model => model.Password)
    </div>


    <div class="editor-label">
        @Html.LabelFor(model => model.Email)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.Email)
        @Html.ValidationMessageFor(model => model.Email)
    </div>


    <div>
        <p>
            <input type="submit" value="Create" />
        </p>
    </div>
    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>
}

UserLogin.cshtml

@model MVCRegistrationAndLogin.Models.User

@{
    ViewBag.Title = "UserLogin";
}

<h2>UserLogin</h2>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true, "Login failed due to wrong credentials!!!")
    @Html.AntiForgeryToken()

    <div class="editor-label">
        @Html.LabelFor(model => model.UserName)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.UserName)
        @Html.ValidationMessageFor(model => model.UserName)
    </div>


    <div class="editor-label">
        @Html.LabelFor(model => model.Password)
    </div>
    <div class="editor-field">
        @Html.PasswordFor(model => model.Password)
        @Html.ValidationMessageFor(model => model.Password)
    </div>


    <div>
        <p>
            <input type="submit" value="Login" />
        </p>
    </div>
    <div>
        @Html.ActionLink("New Registration", "Register")
    </div>
}

Please do reply that how can i resolve this. Thanking you.

When a certain link gets clicked on my _Layout.cshtml page a prompt asks for a value. I store this value in a hidden field in the same view. Now before I finish loading Recommended.cshtml I want to see if the hidden field value matches a constant value I created. Everything works, except I can't figure out how to get the hidden value into the view about to be loaded. Could I maybe use a [HttpPost] ActionResult on _Layout.cshtml? What would be best practice in this situation?

Model:

[Bind]
public class RecommendedModel
{
    [StringLength(50), Required(ErrorMessage = "This field is required.")]
    public string Password { get; set; }

    private const string _TOKEN = "pass";
    public string Token { get { return _TOKEN; } }
}

Controller:

public ActionResult Recommended(RecommendedModel _recommendedModel)
{
    if (_recommendedModel.Password == _recommendedModel.Token)
    {
        ViewBag.Message = "Recommended.";
        return View();
    }
    else
    {
        return View("Error");
    }
}

View (The hidden field is actually on my shared _Layout page):

@Html.HiddenFor(m=>m.Password)

JavaScript:

var password = prompt("What is the password?", "");
document.getElementById("Password").value = password;

EDIT: All of this code works except _recommendedModel.Password is null. It should have the string the user entered into the prompt, unless I did not map it correctly.

I Have the following code that drag and drop list items, and then connect between them by a line using Jsplumb library, i am saving the connected elements in a JSON, but there is a problem in Loading . I need to load the saved diagram with exact elements and connections and positions. please any help?

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title></title>
<script src="//code.jquery.com/jquery-1.8.3.js"></script> 
<script src="//code.jquery.com/ui/1.9.2/jquery-ui.js"></script> 
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="http://stage-preview.gage.com/Creative/Microsoft/EZCourseDemo/scripts/jquery.jsPlumb-1.3.16-all-min.js"></script>
<script>

    $(function() {

        //Make element draggable
        $(".dragItem").draggable({
            helper: 'clone',
            cursor: 'move',
            tolerance: 'fit',
            revert: true
        });
        $("#DropArea").droppable({
            accept: '.dragItem',
            activeClass: "drop-area",
            drop: function(e, ui) {

                x = ui.helper.clone();
                ui.helper.remove();
                $(x).removeAttr("class");

                $(x).addClass("dropItem");
                x.addClass('jsPlumbItem');
                x.appendTo('#DropArea');

                AddLine();

            }
        });
        $('#saveButton').click(function() {
            saveFlowchart();
            return false;
        });
        $('#loadButton').click(function() {
            loadFlowchart();
            return false;
        });
    })

    function AddLine()
    {
        jsPlumb.removeAllEndpoints();
        var j = 1;
        var previous; 

        $("#DropArea").find(".jsPlumbItem").each(function () {

            if (j > 1)
            {
                var e0 = jsPlumb.addEndpoint(previous);
                var e1 = jsPlumb.addEndpoint($(this)); 
                 //add line
                jsPlumb.connect({ source: e0, target: e1 });
            }
            else
            {
                j++;
            }
            previous = $(this);

        }); 

        jsPlumb.draggable($(".jsPlumbItem"));

    }
    function saveFlowchart() {
        var nodes = []
        $(".dragItem").each(function(idx, elem) {
            var $elem = $(elem);
            var endpoints = jsPlumb.getEndpoints($elem.attr('id'));
            console.log('endpoints of ' + $elem.attr('id'));
            console.log(endpoints);
            nodes.push({
                blockId: $elem.attr('id'),
                nodetype: $elem.attr('data-nodetype'),
                positionX: parseInt($elem.css("left"), 10),
                positionY: parseInt($elem.css("top"), 10)
            });
        });
        var connections = [];
        $.each(jsPlumb.getConnections(), function(idx, connection) {
            connections.push({
                connectionId: connection.id,
                pageSourceId: connection.sourceId,
                pageTargetId: connection.targetId
            });
        });

        var flowChart = {};
        flowChart.nodes = nodes;
        flowChart.connections = connections;


        var flowChartJson = JSON.stringify(flowChart);
        //console.log(flowChartJson);

        $('#jsonOutput').val(flowChartJson);

    }
    function loadFlowchart() {
        var flowChartJson = $('#jsonOutput').val();
        var flowChart = JSON.parse(flowChartJson);
        var nodes = flowChart.nodes;
        $.each(nodes, function(index, elem) {

        var id = addTask(elem.blockId);
                repositionElement(id, elem.positionX, elem.positionY);

        });

        var connections = flowChart.connections;
        $.each(connections, function(index, elem) {
            var connection1 = jsPlumb.connect({
                source: elem.pageSourceId,
                target: elem.pageTargetId,
                anchors: ["BottomCenter", [0.75, 0, 0, -1]]

            });
        });

        numberOfElements = flowChart.numberOfElements;
    }
    function repositionElement(id, posX, posY) {
        debugger;
        $('#' + id).css('left', posX);
        $('#' + id).css('top', posY);

        jsPlumb.repaint(id);
    }
    function addTask(id) {
        debugger;
        if (typeof id === "undefined") {
            debugger;
            numberOfElements++;
            id = "taskcontainer" + numberOfElements;
        }

        //$('<div class="dragItem" id="' + id + '" data-nodetype="task" style="left:30px; top:30px;">').appendTo('#DropArea').html($(("#DropArea"))[0].innerHTML);
        x = $('<div class="dragItem" id="' + id + '">').text('im a new div').appendTo($('#DropArea').addClass('jsPlumbItem'));

        $(x.appendTo('#DropArea')).click(function() {

            $(this).remove();

            var conns = jsPlumb.getConnections({ source: $(this), target: $(this) });
            for (var i = 0; i < conns.length; i++)
                jsPlumb.detach(conns[i]);

            jsPlumb.detachAllConnections($(this), $(this));
            jsPlumb.removeAllEndpoints($(this));

        });

        var taskSourceConnectorEndpoint = {
            isSource: true,
            isTarget: false,
            maxConnections: 1,
            anchor: [0.5, 1, 0, 1, 0, 0, "task_end endpoint"]
        };




        jsPlumb.addEndpoint(
    $('#' + id),
    taskSourceConnectorEndpoint
);



        jsPlumb.draggable($('#' + id));
        return id;
    }

</script>
</head>
<body>
<form id="form1" runat="server">
    <style>
        .dragItem 
        {
            width:50px;
            height:50px;
            background-color:blue;
            float:left; 
        }
        .dropItem 
        {
            width:50px;
            height:50px;
            background-color:red;
            float:left;  
            position:relative;
        }
    </style>
<div>
 <div id="container" style="width:60px; height:400px;">
     <div id="Item1" class="dragItem">A</div>
     <div id="Item2" class="dragItem">B</div>
     <div id="Item3" class="dragItem">C</div>
 </div>
 <div>
   <button id="saveButton" class="button menu_button" > save</button>

    <button id="loadButton" class="button menu_button">
        Load</button>

</div>
<textarea id="jsonOutput" style="width: 100%; height: 100px;"></textarea>
    <div id="DropArea" style="width: 400px; height:400px; border:solid 1px gray; "></div>
</div>

</form>

Am working on asp.net mvc4. I got a razor list that is populated at client side with reference to button click(javascript) and to perform other operations on it i got to pass those to controller to perform other operations. I have my listbox populated via following code

  @Html.DevExpress().ListBox(
        settings =>
        {
            settings.Name = "SelectedRows";
            settings.Width = 150;
            settings.Height = 250;
            settings.Properties.EnableClientSideAPI = true;
        }).GetHtml()
        <div class="text">
            Selected count:&nbsp;<strong id="count">0</strong>
        </div>

i tried submitting the value

 <input type="submit" value="submit" /> 

and trying to catch it in controller in test

   public ActionResult Index(IList<RequestModel> test)

I have a post method in my mvc controller that saves (using ajax call) newly created task. Since task is a domain entity, while creating an entity I generate (on server side) unique id - GUID for it.

When task is successfully created I need to pass this GUID back to the client side to complete creation of new html element that will be shown on the page.

Of course I can return this GUID back from controller save method but I don't really like it since in my opinion it breaks SRP rule. Save task method should only be responsible for saving entity, not for returning value.

Another option is to perform one more ajax call after single task is saved, fetch all tasks with all needed info (including GUIDs) and render all of them once again on the page - not really good since I have all needed information on client side (except GUID) to create new task by using for instance jsrender.

Yet another option would be to create GUID on client side. As far as I know there are some scripts available that can do that. But I would prefer to create GUIDs on server side.

Is there any better approach available? Or I am trying to complicate things too much and I simply should return GUID value from save method?

Please let me know what do you think. Thanks!

I know that the source of my problem must be somewhere in my statement, but I just can't find it. Maybe you have a better eye than me right now.

I get the following error while trying to insert a row in my table:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

Here is my insert function:

private function _insert()
    {
        $sql = 'INSERT INTO shows (
            thetvdb_id,
            name,
            imdb_id,
            language,
            overview,
            genre,
            lastupdated,
            status
            )' .
            ' VALUES (
            :thetvdb_id,
            :name,
            :imdb_id,
            :language,
            :overview,
            :genre,
            :lastupdated,
            :status
            )';
            $abfrage = self::$db->prepare($sql);
            $abfrage->execute($this->toArray(false));
            //Setze die ID auf den von der DB generierten Wert
            $this->id = self::$db->lastInsertId();
    }

And here a sample object I'm passing:

object(Show)#201 (9) {
  ["id":"Show":private]=>
  int(0)
  ["thetvdb_id":"Show":private]=>
  string(5) "74875"
  ["name":"Show":private]=>
  string(10) "The Closer"
  ["imdb_id":"Show":private]=>
  string(9) "tt0458253"
  ["language":"Show":private]=>
  string(2) "en"
  ["overview":"Show":private]=>
  string(358) "Deputy Police Chief Brenda Leigh Johnson (Kyra Sedgwick) is a police detective who transfers from Atlanta to Los Angeles to head up a special unit of the LAPD that handles sensitive, high-profile murder cases. Despite a tendency to step on people\'s toes, Johnson manages to convert even her strongest adversaries with her unique ability to get to the truth."
  ["genre":"Show":private]=>
  string(21) "|Crime|Drama|Mystery|"
  ["lastupdated":"Show":private]=>
  string(10) "1410004625"
  ["status":"Show":private]=>
  string(5) "Ended"
}

I need to modify CSS in an existing MVC project. CSS it has is coming from multiple SASS files. I m just guessing correct way would be to do changes in SASS files and regenerate CSS from it. But I m not sure which extension or add in I should use for it. Can you please guide what tool/ or extension I should add in Visual Studio to do changes and regenerate .css file ?

I highly appropriate your guidance time and help.

Please help. Phone link not opening the dial pad. Please see the html below. I'm using JQuery Mobile with html5 and asp.net mvc 5. I used the tel protocol in the anchor tag but when I taps on the link, it is not opening the dial pad. It opens skype when i test it on emulator but not on actual device. I'm using Samsung Galaxy s5.

 <!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device width, initial-scale=1" />
        @*<meta name="format-detection" content="telephone=yes">*@

        <script src="~/Scripts/jquery-1.10.2.js"></script>
        <script src="~/Scripts/jquery-1.10.2.intellisense.js"></script>
        <script src="~/Scripts/jquery.mobile-1.4.2.js"></script>
        <title>Attorney Contacts</title>
        <link href="~/Content/jquery.mobile-1.4.2.css" rel="stylesheet" />
        <link href="~/Content/Contact.css" rel="stylesheet" />
    </head>
<body>
    <div data-role="page">
        <div data-role="header" data-theme="b">
            Mobile Site
        </div>
        <div data-role="content">
            <a href="tel://1-555-555-5555">+1 (555) 555-5555</a>
        </div>
        <div data-role="footer" data-position="fixed">
            footer content
        </div>
    </div>
</body>
</html> 

I get some information and idea in this tutorial (click here) to create my first N-Tier data application with asp.net, But the problem is when I tried to use update query in my DataAccessTier I get 1 error in DataService.

Error:

Error   1   Cannot implicitly convert type 'int' to 'DataEntityTier.GW_UTADataSet.ActiveDirectory2DataTable'    C:\Users\BA-OJT\documents\visual studio 2010\Projects\GoActiveDirectory\DataService\Service1.cs 59  20  DataService

How can I fix this?

My Source-code:

Project: DataAccessTier Query: UpdateBySAN

UPDATE [dbo].[ActiveDirectory2] 
SET [SamAccountName] = @SamAccountName, [Surname] = @Surname, [GivenName] = @GivenName, [EmailAddress] = @EmailAddress, [Enabled] = @Enabled, [Guid] = @Guid, [DateCreated] = @DateCreated, [DateModified] = @DateModified, [SID] = @SID, [EmployeeNumber] = @EmployeeNumber 
WHERE (SamAccountName = @SamAccountName);

SELECT ID, SamAccountName, Surname, GivenName, EmailAddress, Enabled, Guid, DateCreated, DateModified, SID, EmployeeNumber FROM ActiveDirectory2 
WHERE (SamAccountName = @SamAccountName)

Project: DataService Class: IService1.cs

[OperationContract]
DataEntityTier.GW_UTADataSet.ActiveDirectory2DataTable UpdateAccountBySAN(
        string SamAccountName, string Surname, string GivenName, string EmailAddress,
        bool Enabled, string Guid, string DateCreated, string DateModifide, string SID,
        string EmployeeNumber);

Project: DataService Class: Service1.cs

public DataEntityTier.GW_UTADataSet.ActiveDirectory2DataTable UpdateAccountBySAN(
        string SamAccountName, string Surname, string GivenName, string EmailAddress,
        bool Enabled, string Guid, string DateCreated, string DateModified, string SID,
        string EmployeeNumber)
    {
        DataAccessTier.GW_UTADataSetTableAdapters.ActiveDirectory2TableAdapter
            ActiveDirectory2TableAdapter1
                = new DataAccessTier.GW_UTADataSetTableAdapters.ActiveDirectory2TableAdapter();

        return ActiveDirectory2TableAdapter1.UpdateBySAN(
            SamAccountName, Surname, GivenName, EmailAddress, Enabled, Guid, DateCreated,
            DateModified, SID, EmployeeNumber); //ErrorRedLine@ ActiveDirectorr2TableAdapter1.UpdateBysan() Cannot implicitly convert type 'int' to 'DataEntityTier.GW_UTADataSet.ActiveDirectory2DataTable'
    }

There's an error message that I want to hide on some scenarios:

<div id="PickerPopupNoResultsMessage" style="color:red; font-weight: bold; " class="ui-helper-hidden">
    Please select Name first.
</div>

It renders when I do this in the view:

 $('#PickerPopupNoResultsMessage').removeClass('ui-helper-hidden');

so it becomes

<div id="PickerPopupNoResultsMessage" class="" style="color: red; font-weight: bold; display: none;">
    Please select Name first.
</div>

I am unable to remove display: none. I also tried removeClass and addClass. In addClass I am setting display: block and all it does is add the class, but display: none still stays.

Please help as this small thing has taken a lot of my time :(