Subscribe: Web Forms
Added By: Feedage Forager Feedage Grade B rated
Language: English
button  code  css  data  ext  jquery  lib ext  lib  list  module  new  rel stylesheet  rel  script script  script  web 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Web Forms

All Forums

All Forums

Last Build Date: Tue, 22 Aug 2017 18:09:46 -0700


Edit/Insert data in WebGrid bind to List


Hello,     In my ViewModel, I have a List list. I retrieve data dynamically and display in WebGrid. In a toolbar, I have buttons for Edit/Insert/Del. I don't get a way of how can I make that dynamic data editable. User can edit it or insert it or delete a selected row.  Here's my code : public class MemberIndexViewModel { public List DataToDisplay { get; set; } public List Columns { get; private set; } public void GetData(string sql, int skipRecords) { // OTHER CODE to Operate SQL // Get the Columns RetrieveColumns(dt); // Convert to List ConvertDataTableToList(dt); return; } private void RetrieveColumns(DataTable dt) { Columns = new List(); //WebGrid wc = new WebGrid() foreach(DataColumn dc in dt.Columns) { WebGridColumn wc = new WebGridColumn(); wc.ColumnName = dc.ColumnName; wc.Header = dc.ColumnName; wc.CanSort = true; Columns.Add(wc); } return; } /// /// Converts DataTable into List type /// /// DataTable to be converted. private void ConvertDataTableToList(DataTable dt) { DataToDisplay = new List(); foreach (DataRow row in dt.AsEnumerable()) { IDictionary dn = new ExpandoObject(); foreach (DataColumn col in dt.Columns) dn[col.ColumnName] = row[col]; DataToDisplay.Add(dn); } return; } View Code : @model DataStudio.Models.MemberIndexViewModel @{ ViewBag.Title = "Member's Main Page"; Layout = "~/Views/Shared/_MemberLayout.cshtml"; var grid = new WebGrid(canPage: true, rowsPerPage: Model.RowsPerPage, canSort: true); grid.Bind(source: Model.DataToDisplay, rowCount: Model.TotalRecords, autoSortAndPage: false); }
@grid.Table( tableStyle: "table table-responsive table-bordered", rowStyle: "table-tr-odd", alternatingRowStyle: "altRow", displayHeader: true, headerStyle: "Header" )
@grid.Pager(mode: WebGridPagerModes.All)

Script positioning in _layout file


@ViewData["Title"] - ArtCore

© 2017 - ArtCore

There are some jQuery tools, which I only use in one special user defined control,, e. g. the jQuery-Terminal.

I would like to avoid loading such js and css on every request. Instead of this, I'd like to include it directly in the user defined control (ascx).

Well, there is some advice here, which states that you can simply put the includes in the ascx file.
But when I do this with the jQuery.Terminal, I get a JS exception telling that the function "terminal" is not available.

This is my user defined control:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Terminal.ascx.cs" Inherits="Governix.lib.web.frm.Terminal" %>




If I move the link and script includes into the head section of the master file, it works...

Any ideas?


No matter what I try I get The resource you are looking for has been removed...



I see this post everywhere with various solutions. I am attempting the simplest of simplest here. I have a controlled called HomeController and here is the code: 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace myHinkleyWebApp.Controllers
    public class HomeController : Controller
        // GET: Home
        public ActionResult Index()
            return View();

I have a view inside this structure: 

/Views/Home/Index.cshtml with this code: 

    Layout = null;



And i cannot get it to go. I cannot get the code to even enter the home controller to debug it to see what is happening. 


Simply put I updated an existing ASP.NET web forms website to an ASP.NET web application to be able to begin working with MVC. All I am doing is trying to get to this address: 

http://localhost:60380/Home or http://localhost:60380/Home/index 

Any help would be hugely appreciated! 

Service Layer with WebApi


I am starting to work on a new project so working on laying on the architecture at this moment. So basically we want to keep a service oriented architecture using MVC web api. So I had the following structure in mind:

Project.Core (All Poco classes)
Project.Data (All entity framework)
Project.Service (All Web API ??)

We would be working for the first time on webapi here. So wanted to know how do we intergrate webapi here.

Most of the articles we read had created a mvc web application and had selected webapi in that. But we were looking to create separate service layer just for webapi. Is this the correct practice to do that or I am missing something here. We basically wanted not to have a tight coupling b.w MVC web and web api here. If we create web api as part of mvc then how can we separately access our web api. Any articles or sample project with MVC accessing separate web api ?

WOuld appreciate inputs.

How to modify login url when using identity


Can we modify the default  /account/login url to some custom url while redirecting the user to login page in case of unauthorized access ?

Let's say client name need to be appended to url which will look like /ClientABC/account/login

 which will redirect to login page and after login will redirect to respective url which is present in return url parameter. I am using core.

I am trying this in below way. Setting the login Url, here I want to append the client name

services.Configure(opt =>
                opt.Cookies.ApplicationCookie.LoginPath = new PathString("/account/login");

and then making sure all urls requires authentication

services.AddMvc(o =>
                   o.Filters.Add(new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()));


I am trying this from many days, not able to figure out the solution !

Thanks !

Angular Template Webpack is broken


I am trying to set up a project using the new Angular Template inside ASP.NET Core. However, when I try to run the Development or Production tasks in Task Runner, they always terminate with an error in @ngtools/webpack/src/plugin at line 8. 

The error is as follows:

const { __NGTOOLS_PRIVATE_API_2 } = require('@angular/compiler-cli');
SyntaxError: Unexpected token {
    at exports.runInThisContext (vm:53:16)
    at Module._compile (module:373:25)
    at Object.Module._extensions. (module:404:10)
    at Module.load (module:343:32)
    at Function.Module._load (module:300:12)
    at Module.require (module:353:17)
    at require (internal/module:12:17)
    at Object. (C:\\AngularTest\node_modules\@ngtools\webpack\src\index:30:10)
    at Module._compile (module:397:26)
    at Object.Module._extensions. (module:404:10)

What do I need to do to fix this? I suspect it is why I am getting a lot of other errors as I try to add new components.

return value in oracle transaction C#


I am using oracle transaction to insert into multi-tables at the same time.

i need to return value 1 if the operation success in all tables, if error occurs i will return 0 

i need to do this in c#, here is my code

public void RunOracleTransaction(string connectionString)
    using (OracleConnection connection = new OracleConnection(connectionString))

        OracleCommand command = connection.CreateCommand();
        OracleTransaction transaction;

        // Start a local transaction
        transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted);
        // Assign transaction object for a pending local transaction
        command.Transaction = transaction;

            command.CommandText = 
                "INSERT INTO Dept (DeptNo, Dname, Loc) values (50, 'TECHNOLOGY', 'DENVER')";
            command.CommandText = 
                "INSERT INTO Dept (DeptNo, Dname, Loc) values (60, 'ENGINEERING', 'KANSAS CITY')";
            Console.WriteLine("Both records are written to database.");
        catch (Exception e)
            Console.WriteLine("Neither record was written to database.");

How to Combine Google ( or other) Authentication & Windows Authentication


Suppose our front end app allows users to login with a Google credential,  & but the web API also requires access to server resources or web services that need Windows Authentication to access them.  Is there a way to make the call to those other resources temporarily run with the App Pool Id ,  like impersonation in reverse?  

Adding fields


I was wondering if anyone could help me.  I know this is a simple thing but I am stuck. 

I cannot edit the SQL statement in my report. I know you can't do this directly, but the report is old and I don't know how to add in a field. The SQL statement has these resources hard coded in.

In the select expert it says 

 but I can't find it.

In the database expert I see the links, but it's hard coded in the SQL statement like this OR "Resource"."label"='Skittles' and I need to add in two more. So M&M's and Starburst if you will.

I know this is a simple thing to do but I cannot for the life of me figure it out. I just cannot find where it says Resource = Skittles.

The Select Expert - Record says ({@Resource} = 'TEST' I have no idea why. TEST is not a Resource. There is no formula for Resource. In the formula fields again it says 'TEST'

It is grouped buy Resource. Does that have anything to do with it?

I would really appreciate any help. Thank you.

visual Studio 2015 Enterprise Update 3 will not install


Hi folks;

We've been using VS 2012 for about 4 years now.  Recently however, the enterprise placed a Host Intrusion Protection System onto the machines we use.  This HIPS causes use to get a HIPS error each time we try to install any Visual Studio 2012 updates on any of these machines.  They recently applied for an exception for Visual Studio 2015 so we are able to install Visual Studio 2015 Enterprise version D14REL. 

Seeing the updates which were available for VS 2015 we attempted to install Visual Studio 2015 Update 3.  We first tried it on my old machine where we first had success installing VS 2015 Ent. D14REL.  We were able to do this by going into Add/Remove Programs selecting VS 2015 Ent, selecting "change" and Selecting modify.  Upon doing so we were given the option for selecting Update 3 in the install wizard.  This worked fine and my old machine has VS 2015 Ent Update 3.  Then another user got a download from the Microsoft site for Update 3.  When He tried to install using an install disk created by the downloaded iso, at first his VS2015 was corrupted.  Then he did a repair (again selecting update 3 from the components to be installed list.)  This resulted in him having Update 3 installed.  I tried to use the same disk on my new machine.  However, the machine reported it did not see any disk in the DVD-RW disk drive. So we copied it onto a folder in the C:\ drive .  We ran the installer Wizard.  The wizard went through the acquiring all the necessary files quite rapidly.  The it started doing Visual Studio 2015 preparation.  As soon as this step completed it reported "Set up complete", and went to the end of the set up process.  However, the about dialog on VS 2015 reported it was still at D14 REL.  I tried doing a repair like the other guy.  It just went to "Setup complete" in a short period of time after running "VS 2015 preparations"  I tried doing a repair from Add/Remove Programs.  Same behavior.  I tried logging onto the machine with an administrator user, and running the install "as administrator".  No difference.  There are no HIPS errors, There are no logged errors reported.  It just refuses to install.

It is mandated that I switch to this new machine in as short of time possible, but I can not do so until I can put the current Update of Visual  Studio on the machine because it is a violation to operate any software that doesn't meet the security standards that were implemented in Update 3.

It is not clear to me why this update won't install on this one machine.  Has anyone else seen this kind of behavior? 

Binding existing database table with existing Code First model in MVC 5



I am developing an application in MVC 5 Code First approach. Around 20 models have been incorporated within the application already. Now, I need to bind some of my existing models to some existing database tables which are already running on other application application. I cannot delete/recreate these existing models because they are playing a vital role in my application. I just need to change the data source for these models.

Could anyone guide me how can I achieve these?

Thanks in advance.