My reportviewer returns blank when deployed. I have tried setting AsyncRendering="false" and ShowParameterPrompts="true".

While setting AsyncRendering the report is loading but not properly,the control lost its width and no scroll appears, even the menu can't be seen.

I want to get Video using Custom action filter Below is the code which i find working but not able to pass strvideoFilePath as variable.This is my VideoCustomDataResult.cs Code

public override void ExecuteResult(ControllerContext context)
        {

            var strVideoFilePath = HostingEnvironment.MapPath("~/VideoFiles/Test2.mp4");

            context.HttpContext.Response.AddHeader("Content-Disposition", "attachment; filename=Test2.mp4");

            var objFile = new FileInfo(strVideoFilePath);

            var stream = objFile.OpenRead();
            var objBytes = new byte[stream.Length];
            stream.Read(objBytes, 0, (int)objFile.Length);
            context.HttpContext.Response.BinaryWrite(objBytes);

        } 

Here i am calling it as

public ActionResult Index()
        {
            return new VideoDataResult(FileUrl);
        }

Can Anyone tell me how to pass that video source as variable from razor view.

I try to get the value of entity that stored in DbSet before it was changed by code and before it was saved. However, when I try to get it with LINQ Single statement I get the changed value. I'm using EF7.

Here's the code:

DbSet<Entity> dbSet = Context.dbSet;
Entity ent = dbSet.Single(x => x.Id == id);
ent.FirstName = "New name";
Entity entityBeforeChange = dbSet.Single(x => x.Id == id);  //here I want to get entity with old values, if that's important I just need to read it without modifying this instance

Context.SaveChanges();

Hope I was clear enough and can get some help

I am having 3 dropdown list on my page. It works like:

User must select from first dropdown to see list in second dropdown. Second and third work the same.

Index method fill first dropdownlist:

    [HttpGet]
    public ActionResult Index()
    {
        ViewBag.ClientDropdownList = GetClientsDropDown();
        return View();
    }

After user select any item from first dropdown:

$(function () {
    $('#clientDropdown').change(function () {
        var val = $(this).val();
        $.ajax({
            type: "POST",
            url: '/Home/GetClientsProjectsDropDown',
            data: { 'data': val },
            success: function (data) {
            },
            error: function (data) {
            }
        });
    });
});

Which forward to

[HttpPost]
        public ActionResult GetClientsProjectsDropDown(string data)
        {
            if (!String.IsNullOrEmpty(data))
            {
                var result = new List<SelectListItem>();
                var clientProjects = _clientService.GetClientsProjects(Int32.Parse(data));
                foreach (var proj in clientProjects)
                {
                    var item = new SelectListItem()
                    {
                        Value = proj.ProjectID.ToString(),
                        Text = proj.ProjectName
                    };
                    result.Add(item);
                }
                TempData["ProjectDropdownList"] = result;
                return RedirectToAction("Index");
            }
            return PartialView();
        }

There is index.cshtml

<div style="display: inline-flex; text-align: center;">
                <div class="dropdown">
                    @Html.DropDownListFor(m => m.Client, ViewBag.ClientDropdownList as List<SelectListItem>, "Clients", new { @id = "clientDropdown", @class = "form-control" })
                </div>
                <div id="projectDropdown" class="dropdown" style="margin-left: 10px;">
                    @if (TempData["ProjectDropdownList"] != null)
                    {
                        @Html.DropDownListFor(m => m.Project, TempData["ProjectDropdownList"] as List<SelectListItem>, "Projects", new { @id = "projectDropdown", @class = "form-control" })
                    }
                    else
                    {
                        @Html.DropDownListFor(m => m.Project, new List<SelectListItem>(), "Projects", new { @id = "projectDropdown", @class = "form-control" })
                    }
                </div>
                <div class="dropdown" style="margin-left: 10px;">
                    @Html.DropDownListFor(m => m.Task, new List<SelectListItem>(), "Tasks", new { @id = "taskDropdown", @class = "form-control" })
                </div>
            </div>

Why second dropdown is not beign updated?

I'm trying to return a dynamic object deserialized from a json string. At runtime I don't know what the object looks like so I can't type it.

I've tried this:

var json = @"[{""clientNumber"":""3052394"",""accountStatus"":""Active""},{""clientNumber"":""1700630"",""accountStatus"":""Active""}]";
dynamic result = JsonConvert.DeserializeObject(json);
return Json(result, JsonRequestBehavior.AllowGet);

But the result comes out like this:

[[[[]],[[]]],[[[]],[[]]]]

I know I can do this:

var result = new{...};

But this won't work an I don't know what the object is looking like at runtime.

I am working on some image processing scripts in .net and came across the following article outlining how to crop, resize, compress, etc.

In the first comment, someone states that the methods used in the article for imaging are notorious for memory leaks:

A quick warning to everybody thinking about using System.Drawing (or GDI+) in an ASP.NET environment. It's not supported by Microsoft and MSDN (as of recently) clearly states that you may experience memory leaks.

Then, in the second comment, the article author effectively says "i've handled that problem":

Just to make clear the code above isn't thrown together. It evolved with time because as you suggested it is too easy to mistakenly create performance issues when using GDI+. Just see how many times I've written 'using' above!

I am wondering how (or if) the use of using effectively handles (or improves) the memory leak problems referenced in the first comment.

I have a textbox that I would to disable so users can't enter in any text they want. To choose a driver they must click on the magnify glass image and a list of drivers appears.

enter image description here

When they select a driver from the list, it populates the driver into the textbox. But when I go to save it, it value comes in as blank so no driver gets saved. The problem is setting the textbox to Enabled = false.

txtDriverName.Enabled = false;

If I remove this line the driver will save. But disabling the textbox saves a blank value. How do I stop users entering text in the textbox but still save the value that gets populated from the list?

i'm trying to open launch Excel specifing an existing file to open. This is my code:

Protected Sub fileManager_SelectedFileOpened(source As Object, e As FileManagerFileOpenedEventArgs)

    Try
        Dim FullName As String = e.File.FullName
        System.Diagnostics.Process.Start(FullName)
        dvFileError.Visible = False
    Catch ex As Exception
        dvFileError.Visible = True
        lblFileError.Text = ex.Message
    End Try

End Sub

In the e.File.FullName i can found the file's name with its path, so when i launch it as process it should open the Excel's file. So this code works on local, but when i upload it on a web server it not works. It say "An error occurred in sending the command to the application".

I've created a .txt file to test if my application can access to the folder an i take this the "Access is denied" error.

It is strange because if i open the same Excel's file using a ASPxSpreadSheet Control of DevExpress, the file is opened.

Any solutions?

I am attempting to use the new Class Library (Package) project in VS 2015.

I would like to target dnx451, so my package.json looks like this:

{
  "version": "1.0.0-beta-1",
  "description": "Foo",
  "authors": [ "Foo" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "Newtonsoft.Json": "8.0.1",
    "Microsoft.AspNet.Razor": "4.0.0-rc1-final",
    "Microsoft.Extensions.Configuration": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc1-final",
    "System.Net.Http": "4.0.1-beta-23516"
  },

  "frameworks": {
    "dnx451": { }
  }
}

Build is fine, and I get:

Recaptcha-dnxcore -> C:\Users\Epic\Documents\artifacts\bin\Foo\Release\Foo.1.0.0-beta-1.nupkg

Now I create a web project and edit its project.json file so that it targets only the dnx451 framework:

"frameworks": {
    "dnx451": { }
 },

When I add a reference to my Foo package, I get an error:

The dependency Foo 1.0.0-beta-1 in project WebApplication7 does not support framework DNX,Version=v4.5.1.

How can I create a Nuget package from a Class Library (Package) project that supports dnx451?


Per the comment below, here is the full project.json of the web app:

{
  "userSecretsId": "aspnet5-WebApplication7-0b4c05f0-6435-486b-9738-1b6aa3daee2c",
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
    "System.Net.Http": "4.0.1-beta-23516",
    "Foo": "1.0.0-beta-1"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "ef": "EntityFramework.Commands"
  },

  "frameworks": {
    "dnx451": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }
}

What I'm Trying To Do

Develop a C# WPF Windows application that can send and receive data to other WPF applications using a central web server running CentOS 6 Linux with MySQL. The WPF client must be able to send a message to the server, and must be able to listen to the server in real-time for messages and display them as soon as they're posted. The server-side program should be capable of parsing some of these messages into .NET data objects, and should be capable of broadcasting messages to all clients or just a specific one. If a client receives a certain message, it executes a method on the local application.

Also, if the server program could handle requests from a mobile app (Android app to server - server to WPF client & vice-versa) as well as WPF clients, that would be highly preferable, but not necessary.


Example

Server (Linux VM in Texas)

Admin Client (user in California)

Client 2 (user in Florida)

Client 3 (user in New York)

  1. I send a "hello" broadcast from my computer, Admin Client, to Server.

  2. Server receives message and broadcasts "hello" to all listening clients.

  3. Client 2 and Client 3 show "hello" on their clients and respond "hey!"

  4. Server receives "hey!" messages and sends both to Admin Client.

  5. I send a message "open sesame" that executes RunOnMagicWord() method only on Client 2's application, and does nothing to Client 3.

  6. Client2 runs RunOnMagicWord() and sends "done!" message to server after method executes.

  7. Server receives "done!" message and sends to Admin Client.


What I've Looked Into

  • REST/JSON
  • WCF Service
  • ASP.NET MVC
  • PHP Scripts
  • SignalR

I'd strongly prefer to keep everything in C# .NET including the server-side program, so that data sent between clients and to the server can be serialized easily (and so I don't have to learn any new languages for this project). SignalR seems to be closest to what I'm looking for, but it seems to me it only plays nicely with IIS and not Apache/Linux.


My Question

I don't have the option of changing the current Linux server to IIS, so am I headed down the right path looking at using something like SignalR? If so, how do I get it to run on my CentOS server? Or is there a better way altogether of a Linux/MySQL server providing this kind of real-time messaging functionality to WPF clients?

Thank you very, very much for your input!

the user clicks the Save button in the form , i have to do some server side validation if server side validation false i want disable the javascript confirm box other wise enable javascript confirm box . my aspx code like this :

   <asp:Button ID="btnSubmit" Text="Submit" CssClass="blue-button" runat="server" ValidationGroup="AddM" OnClick="btnSubmit_Click" />
                                                        <Ajax:ConfirmButtonExtender ID="ConfirmButtonExtender8" runat="server" TargetControlID="btnSubmit" ConfirmText="Please Confirm">
    </Ajax:ConfirmButtonExtender>

enter image description here

What are the possible data we can get it from Linux system or windows OS through the website. Here the case is

1)I login into example.com as a user or creating the account in example.com .. it's all just form submit and they can get the OS name, browser details, IP address, Computer resolution.

Can we get the serial number of the computer or Can we get the MAC ID of the computer or what are the possible data that any website can collect about the user .. it may be in ANY PROGRAMMING Language like JSP, Java servlet or Ruby on Rail or ASP .NET . Please let me know

I have a task to write an Bar-code reader. Which will connect directly to an MS SQL Server to find an product.

Basically, I can write a ASP.net website and write Javascript code to call it from Cordova (Android) app. Or write an native code and call it from Cordova.

But my task it "Directly connect" to Ms SQL server by using Javascript code. Does any way to do this ?

I want to convert Matlab *.m file to .NET assembly . Is there any online tool to convert these files to .NET assembly or .exe file ?

I have a very simple gridview with a select button in each row that is bind to a EntityDataSource. And also I have a FormView. When I select a row I want the FormView to get information from GridView and display them.

enter image description here

This is my code to loop thru gridview row when exporting gridview to excel using closedxml

for (int i = 0; i < gvPOlist.Rows.Count; i++)
{
  foreach (GridViewRow gvr in gvPOlist.Rows)
  {
    worksheet.Cell(i + 23, 3).Value = gvPOlist.Rows[i].Cells[1].Text;
    worksheet.Cell(i + 23, 4).Value = gvPOlist.Rows[i].Cells[2].Text;
    worksheet.Cell(i + 23, 8).Value = ((TextBox)gvr.FindControl("txtReqDelDate")).Text;
   }
}

My ouput is

  Item Code         Description     Delivery Date
  code001         Item One            01/28/2016
  code004         Item Four           01/28/2016    

The problem is the value of all my delivery date column captured the last row value of gridview. How can i get the correct value of my delivery date column based on its gridview row cell value? Note: Delivery Date column is template field.

I'm new in UCM I trying to invoke webservices in UCM using .net I got this error message

The remote server returned an error: (401) Unauthorized.

Source Error: return base.Channel.QuickSearch(request);

        IdcProperty extra = new IdcProperty();
        extra.name = "dID";
        extra.value = "210";
        IdcProperty[] array = { extra };
        IdcPropertyCollection _IdcPC = new IdcPropertyCollection();


        QuickSearchRequest search = new QuickSearchRequest(searchWord, _IdcPC);
        QuickSearchResult result = new QuickSearchResult();

        ((ClientBase<ISearchSoap>)(client)).ClientCredentials.Windows.ClientCredential = new NetworkCredential("?", "?"); 

        result = client.QuickSearch(searchWord, _IdcPC);

My model:

public class Company
{
    [BsonElement]
    [BsonRepresentation(MongoDB.Bson.BsonType.String)]
    public String PlaceId { get; set; }

    [BsonElement]
    [BsonRepresentation(MongoDB.Bson.BsonType.String)]
    public string Name { get; set; }

    [BsonElement]
    [BsonRepresentation(MongoDB.Bson.BsonType.String)]
    [BsonIgnoreIfNull]
    public string Email { get; set; }

    [BsonElement]
    [BsonRepresentation(MongoDB.Bson.BsonType.Double)]
    public Double Rating { get; set; }

    [BsonElement]
    [BsonIgnoreIfNull]
    public Department Department { get; set; }

    [BsonElement]
    [BsonIgnoreIfNull]
    public Product Product { get; set; }

    [BsonElement]        
    public Comment[] Comments { get; set; }       
}

public class Comment
{
    [BsonElement]
    public String Text { get; set; }
}

My controller method:

public JsonResult SavePlace(Company company)
{
    if (company != null)
    {
        var client = new MongoClient("mongodb://localhost");
        var database = client.GetDatabase("mongogoogleplace");
        var placeData = database.GetCollection<BsonDocument>("googledatanew");


        var department = company.Department.ToBsonDocument();
        var product = company.Product.ToBsonDocument();
        //var comments = company.Comments.ToBsonElement();

        var companyModel = company.ToBsonDocument();           

        var filter = Builders<BsonDocument>.Filter.Eq("PlaceId", company.PlaceId);
        var projection = Builders<BsonDocument>.Projection
                .Exclude("_id");
        //BsonDocument document = new BsonDocument();

        var document = placeData.Find(filter).Project(projection).FirstOrDefault();
        var documentJson = document.ToJson();

        return Json(documentJson);   
    }
    else
    {
        return Json(new { data = "error." });
    }
}

Javascript snippet:

var company = { "PlaceId": PlaceId, "Name": Name, "Rating": Rating, "Comments": [{ Comment: { Text: '' } }, { Comment: { Text: '' } }, { Comment: { Text: '' } }, { Comment: { Text: '' } }, { Comment: { Text: '' } } ] };

for (var i = 0; i < CommentsArray.length; i++) {
    company.Comments[i].Comment.Text = CommentsArray[i];
};

$.ajax({
    type: "POST",
    url: "../Home/SavePlace",
    data:  company,
    // dataType: "json",

    success: function (data){}

But every time I get the comments to be null.

I am using, <base href="http://localhost:80/"> in my master page for base url,

now when I am using dropdownlist control on content page (located in 'localhost:80/directory/directory') within update panel, selectedindexchanged event is not working.

I tried to figure out, but in network tab of firefox console I found that request is looking for event on content page at base url only that is at 'localhost:80/contenpage.aspx' instead of 'localhost:80/directory/directory/contenpage.aspx' and giving error The resource cannot be found.

I have a problem regarding clearing data in my Gridview. I followed all the example that was given in other questions regarding this problem but my Gridview is not being clear. When I search the second time, it will just add on to the current Gridview data. Am I using the method wrongly?

For example, I've already filled up my GridView by searching user with a button. It will add 6 data into the gridview. when I want to search another user, instead of clearing the data first and adding on, it will just stack over the current data in the current gridview giving me 12 data in total.

public partial class Update_User_Schedule : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            DataTable dt = new DataTable();
            dt.Columns.AddRange(new DataColumn[5] { new DataColumn("Test Name"), new DataColumn("Duration"), new DataColumn("Start Date"), new DataColumn("End Date"), new DataColumn("Limit") });
            ViewState["Patient"] = dt;
            this.BindGrid();
        }
    }

    protected void BindGrid()
    {
        GridView1.DataSource = (DataTable)ViewState["Patient"];
        GridView1.DataBind();
    }

    protected void btnUser_Click(object sender, EventArgs e)
    {
        GridView1.DataSource = null;
        GridView1.DataBind();

        int User_ID = 0, TS_IDstr = 0, Test_ID = 0, Duration = 0, Limit = 0;
        string Test_Name = "";
        string Name = cmbName.Text;
        string start = "", end = "";

        List<int> TS_ID = new List<int>();

        SqlConnection myConn = new SqlConnection("Data Source=localhost;" + "Initial Catalog=IBBTS_DB; Integrated Security =SSPI");
        SqlCommand retrieveUser_IDCmd = new SqlCommand("SELECT User_ID FROM Patient where Name ='" + Name + "' ;", myConn);
        myConn.Open();
        SqlDataReader reader = retrieveUser_IDCmd.ExecuteReader();
        while (reader.Read())
        {
            User_ID = (Convert.ToInt32(reader.GetValue(0).ToString()));
        }
        reader.Close();

        SqlCommand retrieveTS_IDCmd = new SqlCommand("SELECT TS_ID FROM testSet where User_ID ='" + User_ID + "' ;", myConn);
        SqlDataReader reader2 = retrieveTS_IDCmd.ExecuteReader();
        while (reader2.Read())
        {
            TS_ID.Add(Convert.ToInt32(reader2.GetValue(0).ToString()));
        }
        reader2.Close();

        foreach (int element in TS_ID)
        {
            TS_IDstr = element;

            SqlCommand retrieveTest_IDCmd = new SqlCommand("SELECT Test_ID FROM testSet where TS_ID ='" + TS_IDstr + "' ;", myConn);
            SqlDataReader reader3 = retrieveTest_IDCmd.ExecuteReader();
            while (reader3.Read())
            {
                Test_ID = (Convert.ToInt32(reader3.GetValue(0).ToString()));
            }
            reader3.Close();

            SqlCommand retrieveTest_NameCmd = new SqlCommand("SELECT Test_Name FROM Test where Test_ID ='" + Test_ID + "' ;", myConn);
            SqlDataReader reader4 = retrieveTest_NameCmd.ExecuteReader();
            while (reader4.Read())
            {
                Test_Name = (reader4.GetValue(0).ToString());
            }
            reader4.Close();

            SqlCommand retrieveDurationCmd = new SqlCommand("SELECT Duration FROM testSet where TS_ID ='" + TS_IDstr + "' ;", myConn);
            SqlDataReader reader5 = retrieveDurationCmd.ExecuteReader();
            while (reader5.Read())
            {
                Duration = (Convert.ToInt32(reader5.GetValue(0).ToString()));
            }
            reader5.Close();

            SqlCommand retrieveStart_DateCmd = new SqlCommand("SELECT startDate FROM testSet where TS_ID ='" + TS_IDstr + "' ;", myConn);
            SqlDataReader reader6 = retrieveStart_DateCmd.ExecuteReader();
            while (reader6.Read())
            {
                start = (reader6.GetValue(0).ToString());
            }
            reader6.Close();

            SqlCommand retrieveEnd_DateCmd = new SqlCommand("SELECT endDate FROM testSet where TS_ID ='" + TS_IDstr + "' ;", myConn);
            SqlDataReader reader7 = retrieveEnd_DateCmd.ExecuteReader();
            while (reader7.Read())
            {
                end = (reader7.GetValue(0).ToString());
            }
            reader7.Close();

            SqlCommand retrieveLimitCmd = new SqlCommand("SELECT Limit FROM testSet where TS_ID ='" + TS_IDstr + "' ;", myConn);
            SqlDataReader reader8 = retrieveLimitCmd.ExecuteReader();
            while (reader8.Read())
            {
                Limit = (Convert.ToInt32(reader8.GetValue(0).ToString()));
            }
            reader8.Close();


            DataTable dt = (DataTable)ViewState["Patient"];
            dt.Rows.Add(Test_Name, Duration,start, end, Limit);
            ViewState["Patient"] = dt;
            this.BindGrid();
        }
    }
}

enter image description here

As you can see here with the latest service pack from Visual Studio 2015, no more highlights and syntax colors for Razor code