I need to create a page type facebook, where the parts are not loaded all at once.

For example in facebook, the chat is loaded apart, in another the notifications and thus, everything is separated.

That is to say that it does not have to wait q all the information is loaded so that the page is shown

What technologies the frameworks recommend using

Trying to save a record so that this table (proposal) saves it under another table's ID (client). So the create link is on the "details" view template because when I click on the detail of that table (client), has a link to create a new record (proposal) under it.

I did exactly how I've done this on another table where the client belongs to another table and has a link for creating a record so that when it creates should just open the create view template and shows the associated ID and saves it when submitted (rather than the scaffolded drop down select option).

HTML (conceptual)

CREATE link (which creates a proposal record under the client, see VIEW below)

Controller:

    public ActionResult Create(int? clientId)
    {
        ViewBag.Title = "Create a Proposal";
        ViewBag.PanelColor = "success";

        ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName");
        var client = new Client();
        client.ClientId = (int)clientId;
        return View(client);
    }


    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Create([Bind(Include = "ProposalId,BenefitAmount,Carrier,Product,DateCreated,DateCompleted,ClientId")] Proposal proposal)
    {
        ViewBag.Title = "Create a Proposal";
        ViewBag.PanelColor = "success";

        if (ModelState.IsValid)
        {
            var client = db.Clients.Single(c => c.ClientId == proposal.ClientId);
            client.Proposals.Add(proposal);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName", proposal.ClientId);
        return View(proposal);
    }

VIEW (Create view template)

@model AppName.Models.Client
...
<a href="/proposal/create?ClientId=@Model.ClientId">CREATE</a> // yes I could use the helper as well, but that's not the point

ERROR

The model item passed into the dictionary is of type 'AppName.Models.Client', but this dictionary requires a model item of type 'AppName.Models.Proposal'.

Not really very good at this obviously but was checking to see if you come across this particular issue; although there are other ways to do this, I was just going along what I learned. Thanks.

I have a Kendo grid, and every row in that grid has its own "Review" button. The review button calls this ajax request on click:

function GetReviewForm(submissionId) {
    $.ajax({
        url: "/PSATracking/PSATracking/GetReviewData?subId=" + submissionId,
        type: "GET",
        dataType: 'json',
        cache: false,
        success: function (data) {
            $("#RequestStatus").val(data.Data[0].RequestStatus);
            $("#OrganizationName").val(data.Data[0].OrganizationName);
            $("#TeamMemberContributesAsBoardMember").val(data.Data[0].TeamMemberContributesAsBoardMember);
            $("#ContactName").val(data.Data[0].ContactName);
            $("#ApproveBtn").click(function () {
                var confirmation = confirm("Are you sure you want to save and approve this request?");
                if (confirmation === true) {
                    $.post("/PSATracking/PSATracking/ApproveRequest?sponsorId=" + data.Data[0].SponsorshipRequestId);
                    $("#ApproveRequestWindow").data("kendoWindow").close();
                    window.location.reload();
                }
            });
        }
    });
}

This ajax request will open up a window on the page that has a couple text boxes and an approve button. It will populate the text boxes based on the submissionId that is sent to this function. Each row in the Kendo grid has its own submissionId.

The problem that I am experiencing is that if I click on one review button, then close the window that pops up, and then click a different review button, I now have 2 ajax requests that are running at the same time. So if I were to click the approve button on one window, it will run the approve button click function for every window I had open previously.

Sorry if this is really confusing.

Basically, all I need to know is how to end the ajax request when I close the window so that I don't have multiple ajax requests running at the same time.

I am loading up an external webpage (i.e. www.duckduckgo.com in this example) within a div on my webpage. I want to get my mouse X and Y position while within and outside the div, but when I am inside the div, it seems that the webpage blocks the onmousemove event from firing. However, the onmouseover event fires only once when entering the div.

Here is example code that illustrates my problem:

function mouseEvent(event) {
      var x = event.clientX;
      var y = event.clientY;

      document.getElementById('label').innerHTML = 'X=' + x + ' Y=' + y;
}
html {
    height: 100%;
    width: 100%;
}
body {
    height: 100%;
    width: 100%;        
    overflow: hidden;
    margin-left: 0px;
    margin-top: 0px;
    margin-bottom: 0px;
    margin-right: 0px;
}
#form1 {
    height: 100%;
    width: 100%;
}
#pageDiv {
    height: 100%;
    width: 100%;
}
#page {
    height: 100%;
    width: 100%; 
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div id="pageDiv"> 
            <label id="label">hello</label>
            <object id="page" type="text/html" data="https://duckduckgo.com/" onmousemove="mouseEvent(event)" onmouseover="mouseEvent(event)">
            </object>
        </div>
    </form>
</body>
</html>

How can I get the mouse X and Y position anywhere on this webpage (i.e. not just on top of the div holding the external source)? I tried adding event.preventDefault(); to the beginning of the mouseEvent function, but that did nothing in the realms of helping.

I am guessing the external webpage is steal my focus away. Is this the case? Is there anyway I can achieve constant X and Y coordinate updating?

Please see the code below:

Protected Sub gvPhysicalDisposals_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvPhysicalDisposals.RowUpdating
        Try
            Dim HyperlinkEventID As HyperLink = CType(gvPhysicalDisposals.Rows(e.RowIndex).FindControl("HyperlinkEventID"), HyperLink)
            Dim chkDestroyed As CheckBox = CType(gvPhysicalDisposals.Rows(e.RowIndex).FindControl("chkDestroyed"), CheckBox)
            Dim chkStopped As CheckBox = CType(gvPhysicalDisposals.Rows(e.RowIndex).FindControl("chkStopped"), CheckBox)

            If (chkDestroyed.Checked = True And chkStopped.Checked = True) Then
                LabUpdateResult.ForeColor = Drawing.Color.Red
                LabUpdateResult.Text = "A Physical Disposal must not be stopped and destroyed"
                LabUpdateResult.Visible = True
            ElseIf (chkDestroyed.Checked = True And chkStopped.Checked = True) Then
                LabUpdateResult.ForeColor = Drawing.Color.Red
                LabUpdateResult.Text = "No changes were made"
                LabUpdateResult.Visible = True
            Else

                If chkStopped.Checked Then
                    SqlPhysicalDisposals.UpdateParameters("Stopped").DefaultValue = "1"
                Else
                    SqlPhysicalDisposals.UpdateParameters("Stopped").DefaultValue = "0"
                End If

                If chkDestroyed.Checked Then
                    SqlPhysicalDisposals.UpdateParameters("Destroyed").DefaultValue = "1"
                Else
                    SqlPhysicalDisposals.UpdateParameters("Destroyed").DefaultValue = "0"
                End If

                SqlPhysicalDisposals.UpdateParameters("EventID").DefaultValue = HyperlinkEventID.Text


                SqlPhysicalDisposals.UpdateParameters("Usercode").DefaultValue = strUserName
                SqlPhysicalDisposals.UpdateParameters("LastUpdated").DefaultValue = CStr(Now)
                LabUpdateResult.ForeColor = Drawing.Color.Green
                LabUpdateResult.Text = "Saved successfully."
                LabUpdateResult.Visible = True
            End If

        Catch ex As Exception
            Throw
        End Try
End Sub

and the .aspx below:

<asp:SqlDataSource ID="SqlPhysicalDisposals" runat="server" UpdateCommand ="UPDATE dbphysicaldisposal SET Destroyed=@Destroyed, Stopped=@Stopped, Usercode=@Usercode, LastUpdated=@LastUpdated WHERE EventID=@EventID" >      
      <SelectParameters>
      <asp:Parameter Name="FromDate" Type="DateTime" />
      <asp:Parameter Name="ToDate" Type="DateTime" />
   </SelectParameters>   

    <UpdateParameters>
      <asp:Parameter Name="Destroyed" Type="Boolean" />
      <asp:Parameter Name="Stopped" Type="Boolean" />
      <asp:Parameter Name="Usercode" Type="string" />
        <asp:Parameter Name="LastUpdated" Type="DateTime"/>
     <asp:Parameter Name="EventID" Type="String" />
   </UpdateParameters>


    </asp:SqlDataSource>

The UpdateCommand does not appear to run. There is no exception. I have typed garbage into the UPDATE COMMAND and it still does not cause an exception. I have spent two hours looking at this. What am I doing wrong?

i have stored the image file in a database as a varbinary(max) data farmate,

my problem is,

data from database is displaying properly in gridview,but while in a update if i not choose any new file than the image column will be updated as null, instead of that i want update that column with the existing bytes. how can i achieve please help me out

my aspx page is:

  <html>
    <body>
        <form id="form1" runat="server">
          <div>
           <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="id" OnRowEditing="OnRowEditing" 
            OnRowDataBound="RowDataBound" OnRowUpdating="OnRowUpdating">
              <Columns>
                   </asp:TemplateField>
                        <asp:TemplateField HeaderText="Image">
                            <ItemTemplate>
                                <asp:Image ID="Image1" runat="server" Height="100px" 
                                   Width="100px" 
     ImageUrl='<%#"data:Image/jpg;base64,"+Convert.ToBase64String((byte[])Eval("Profile")) %>' />
     <asp:HiddenField ID="imgurl" runat="server" Value='<%# Eval("Profile") %>' />
         </ItemTemplate>
               <EditItemTemplate>
                   <asp:HiddenField ID="hdProductPhoto" runat="server" 
  Value='<%#"data:Image/jpg;base64,"+Convert.ToBase64String((byte[])Eval("Profile")) %>' />  
                     <asp:FileUpload ID="imgUpload" runat="server" /></td>
              </EditItemTemplate>
        </asp:TemplateField>
     </Columns>
    </asp:GridView>
    </div>
        </form>
    </body>
    </html>

    **my c sharp code is:**

     protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
     {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["studentReg"].ConnectionString);
            SqlCommand cmd = new SqlCommand("[studUpdate]", con);
       if (fuPhoto.FileName == "")
           {
              // i want this section to be proper 
              HiddenField hdProductPhoto = 
             (HiddenField)GridView1.Rows[e.RowIndex].FindControl("hdProductPhoto");
             string imgvalue = hdProductPhoto.Value;
             Response.Write("<script>alert('" + hdProductPhoto.Value + "')</script>");

          }
          else
          {
             int length = fuPhoto.PostedFile.ContentLength;
             ImageContent = new byte[length];
             HttpPostedFile img = fuPhoto.PostedFile;
             img.InputStream.Read(ImageContent, 0, length);
           }
           string drpList = ddl.SelectedValue.ToString();
           string rdbTemp = rbl.SelectedValue.ToString();
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.Parameters.AddWithValue("@id", sid);
                  cmd.Parameters.AddWithValue("@Profile", (byte[])ImageContent);
           cmd.Parameters.AddWithValue("@Action", "UPDATE");
           con.Open();
           cmd.ExecuteNonQuery();
           con.Close();
    }

I'm building a web app using visual studio 2015 and angular 4.x I have followed this tutorial

But i keep getting the error Unexpected token <

enter image description here

my main .ts

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app.module';



platformBrowserDynamic().bootstrapModule(AppModule);

wwwroot structure

wwwroot structure

_Layout.cshtml looks like this

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

    <script src="/node_modules/core-js/client/shim.min.js"></script>
    <script src="/node_modules/zone.js/dist/zone.js"></script>
    <script src="/node_modules/systemjs/dist/system.src.js"></script>
    <script src="/systemjs.config.js"></script>
    <script>
        System.import('wwwroot').catch(function(err){ console.error(err); });
    </script>
</head>
<body>

    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p>
        </footer>
    </div>

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>

systemjs.config.js

(function (global) {
    System.config({
        map: {
            'rxjs': 'node_modules/rxjs',
            '@angular': 'node_modules/@angular',
            'app': './app',
            'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api'
        },
        packages: {
            'app': {
                main: 'main.js',
                defaultExtension: 'js'
            },

            '@angular/platform-browser': {
                main: 'bundles/platform-browser.umd.js'
            },

            '@angular/core': {
                main: 'bundles/core.umd.js'
            },

            '@angular/http': {
                main: 'bundles/http.umd.js'
            },

            '@angular/compiler': {
                main: 'bundles/compiler.umd.js'
            },

            '@angular/compiler-cli': {
                main: 'index.js'
            },

            '@angular/router': {
                main: 'bundles/router.umd.js'
            },

            '@angular/upgrade': {
                main: 'bundles/upgrade.umd.js'
            },

            '@angular/forms': {
                main: 'bundles/forms.umd.js'
            },

            '@angular/common': {
                main: 'bundles/common.umd.js',
                defaultExtension: 'js'
            },

            '@angular/platform-browser-dynamic': {
                main: 'bundles/platform-browser-dynamic.umd.js'
            },

            '@angular/platform-server': {
                main: 'bundles/platform-server.umd.js'
            },

            'rxjs': {
                defaultExtension: 'js'
            },

            'angular2-in-memory-web-api': {
                main: './index.js',
                defaultExtension: 'js'
            }
        }
    });
})(this);

index.html

<app-root></app-root>

I'm not able to go any further. Can anybody guide me?

Thanks!

strong texthow i can upload the documents with different format like word pdf etc. and after adding it should display all list of documents. after that when i click on particular link the content of that file should display on the browser only .

Here i have done file uploading and displaying the list along with downloading and deleting the link. i want to implement display option in it.

C# CODE

protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string[] filePaths = Directory.GetFiles(Server.MapPath("~/Uploads/")); List files = new List(); foreach (string filePath in filePaths) { files.Add(new ListItem(Path.GetFileName(filePath), filePath)); } GridView1.DataSource = files; GridView1.DataBind(); } }

    protected void UploadFile(object sender, EventArgs e)
    {
        string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
        FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Uploads/") + fileName);
        Response.Redirect(Request.Url.AbsoluteUri);
    }
    protected void DownloadFile(object sender, EventArgs e)
    {
        string filePath = (sender as LinkButton).CommandArgument;
        Response.ContentType = ContentType;
        Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath));
        Response.WriteFile(filePath);
        Response.End();
    }

    protected void DeleteFile(object sender, EventArgs e)
    {
        string filePath = (sender as LinkButton).CommandArgument;
        File.Delete(filePath);
        Response.Redirect(Request.Url.AbsoluteUri);
    }

ASPX

Name ' runat="server" OnClick="DownloadFile"> ' runat="server" OnClick="DeleteFile" />

If I put code it will go to the view below

(Please click link to view picture)

Response.Redirect(Report.aspx);

Report.aspx

I want to redirect to the tab called "number of booking" how do i do that?

I have a simple reverse proxy to avoid CORS in the browser. In essence, it works like this:

string url = Request.QueryString["url"];
using (var webClient = new System.Net.WebClient())
{
    byte[] buffer = webClient.DownloadData(url);
    Response.Clear();
    Response.BinaryWrite(buffer);
}

Usage:

/reverseproxy.aspx?url=http%3A%2F%2Fexample.com%2F

However, this has a vulnerability. The following request will return the logs of my IIS server.

/reverseproxy.aspx?url=c%3A%2Finetpub%2Flogs%2FLogFiles%2FW3SVC1%2Fu_ex170712.log

Is there a way to tell WebClient to not serve local files? Without setting permissions and without using File.Exists(url)

When I try to run it with query6 --> that [religion] = @religionVar it returns me into the data table only the titles of the table but when i do it to the query5 it return me to the table well

    string query5 = "SELECT * FROM[PhoneTableSql] WHERE[district] = '5' AND([religion] = @religionVar OR[religion] = '4')";
        string query6 = "SELECT * FROM[PhoneTableSql] WHERE[district] = '6' AND([religion] = @religionVar OR[religion] = '4')";

and if i do it like here query6 returns the table good

    string query5 = "SELECT * FROM[PhoneTableSql] WHERE[district] = '5' AND([religion] = @religionVar OR[religion] = '4')";
        string query6 = "SELECT * FROM[PhoneTableSql] WHERE[district] = '6' AND([religion] = '1' OR[religion] = '4')";

I tried to run it mssql and its work fine but i cant Explain why it works first and does not work on the other

string query5 = "SELECT * FROM[PhoneTableSql] WHERE[district] = '5' AND([religion] = @religionVar OR[religion] = '4')";
        string query6 = "SELECT * FROM[PhoneTableSql] WHERE[district] = '6' AND([religion] = '1' OR[religion] = '4')";

        using (SqlConnection con = new SqlConnection(@"Data Source=CATISERVER1\SQLEXPRESS;Initial Catalog=dsa;Persist Security Info=True;User ID=mcsager;Password=*******"))
        {
            try
            {                    
                SqlCommand cmd5 = new SqlCommand(query5, con);
                cmd5.Parameters.AddWithValue("@religionVar", 1);
                SqlCommand cmd6 = new SqlCommand(query6, con);
                cmd6.Parameters.AddWithValue("@religionVar", 1);

                SqlDataAdapter adpter5 = new SqlDataAdapter(cmd5);
                adpter5.Fill(MyAppManager.ChangeFactorWeightsInstance.DtDistrict_5);
                SqlDataAdapter adpter6 = new SqlDataAdapter(cmd6);
                adpter6.Fill(MyAppManager.ChangeFactorWeightsInstance.DtDistrict_6);
            }
            catch{}
        }

I'm trying to set some data at client side before I send it to server, but it give me no changes

The div contains data:

<div id="chanelValues" data-value="0" runat="server"></div>

The Checkbox which will give chanelValues div it's values

<input type="checkbox" onclick="dropdownClick(1, 'chanelValues')" />

dropdownClick func set chanelValues data-value to 1 success by js

But Server side give me chanelValues = 0

string chanelValues = this.chanelValues.Attributes["data-value"];

How Can I get updated data?

Thanks!

Well I have a model named Question like

[Table("Questions")]
    public class QuestionModel
    {
        [Key]
        public long Id { get; set; }
        [Required]
        public string QuestionTitle { get; set; }

        public virtual ICollection<OptionTextModel> Options { get; set; }
    }

And also I have another model named OptionsModel like here

public class OptionTextModel
    {
        [Key]
        public long Id { get; set; }

        [Required]
        public long QuestionId { get; set; }
        [Required]
        public string Text { get; set; }
        [Required]
        public bool IsRightAnswer { get; set; }
        [ForeignKey("QuestionId")]
        public virtual QuestionModel Question { get; set; }
    }

So here look, you can see QuestionModel is capable to hold enumerable OptionTextModel. So if I want to create a new Question then How do I take it's Options ? As a question may have multiple options or don't hold a single option too.

SO my question is how can I write int the Razor format which will take single option or multiple options or sometimes even not a option.

I have tried using those following code to render the options. But it does not working, It's not even going to the partial view to render. Moreover when in create mode it will create 4 option by default even if the Options are null. What shall I do? Do you have a better suggestion regarding this instead of my code practice? If you do have please give me a suggestion with an example. Thank you.

@Html.Partial("_Option" , @Model.Options.ToList())

Here _Option is a partial view where code is

@model IList<e_Learning.Models.OptionTextModel>
@if (Model.Any())
{
    for (int i = 0; i < Model.Count; i++)
    {
        <div class="form-group">
            <div class="col-sm-offset-1 col-sm-9">
                @Html.TextBoxFor(m=>m[i].Text, new {@class = "form-control", @placeholder = "Opotion"})
                @Html.CheckBoxFor(m=>m[i].IsRightAnswer, new {@class = "form-control"})
            </div>
        </div>
    }
}

I developed a page with a datatable, where I customized lengthMenu property and changed "Show [10] entries" to "Display [10] per page" by using below code.

But I want to replace Dropdown arrow by a popup arrow. Please help me if anybody knows the solution. Please look into the image.

$('#MyDataTable').DataTable({
"language": {
            "lengthMenu": "Display _MENU_ Per Page"            
            }
 });

Please Click Here to See Existing drop-down menu

Please Click Here to See what I Want, a popup menu

I have a couple of simple models in my database structure:

public class Request {
    public int Id {get; set;}
    public DateTime VisitDate {get; set;}
    public virtual List<Visitor> Visitors {get; set;}
}

public class Visitor {
    public int Id {get; set;}
    public string Name {get; set;}
    public int RequestId {get; set;}
    public virtual Request Request {get; set;}
}

}

So, my request can have multiple Visitors. I created a view for editing Request, here is the part of it, where i put some input elements to the page with a list of Visitors from Request's navigation property:

@using (Html.BeginForm("Edit", "VisitRequest")) {
@for (int i = 0; i < Model.Visitors.Count; i++)
                {
                        @Html.HiddenFor(m => m.Visitors[i].Id)
                        @Html.HiddenFor(m => m.Visitors[i].RequestId)
                        @Html.TextBoxFor(m => m.Visitors[i].Name, new { @class = "form-control"})
                }
<input type="submit" value="Save" class="btn btn-success"/>
}

So now i can edit Visitors and save them to the database. My problem is that i want not to only edit existing Visitors, but be able to add or delete some of them by pressing some add/delete buttons. How do i achieve that? I tried to use some javascript functions found by google search, but i can't figure out how to modify the List<Visitor> so it can go back to my [HttpGet] controller method, not to just add textboxes by pressing a button. Can anyone please help me? Thanks a lot.

P.S. My controller name is "VisitRequestController", post method is:

[HttpPost]
        public ActionResult Edit(VisitRequest request)
        {


            if (ModelState.IsValid)
            {

                _databaseRepository.SaveVisitRequest(request);
                return RedirectToAction("List");

            }
            else
            {
                ViewBag.DepartmentList = _departmentsSelectList;
                return View(request);
            }
        }

In my view I have the following DropDownListFor:

@Html.DropDownListFor(m => item.BillingStatusID, (SelectList)ViewBag.BillingStatusID, "Select...")

And in the controller the ViewBag is defined as:

ViewBag.BillingStatusID = new SelectList(db.BillingStatus, "BillingStatusID", "Name", "BillingStatusID");

However, when the page renders it shows the selected value as "Select..." instead of the billing status for that item.

If I change the ViewBag to:

 ViewBag.BillingStatusID = new SelectList(db.BillingStatus, "BillingStatusID", "Name", 2);

for example, it works and the DropDownListfor is populated with the entry with BillingStatusID = 2, but obviously this isn't the desired behaviour. How can I ensure that the index is returned properly from the ViewBag?

I am doing a research of how to manage the multiple location database server connections dynamically in a ASP.net application.

i have 4 DB servers at different locations (North, East, West & Central, all 4 having different server IPs, there are not fully in charged by my team, so the server IPs or DB login credentials could be changed anytime, they just need to update the new IP or login via a system which stored in Central.)

And my team has more accessibility at the Central (Web & DB server) but we are not allowed to change any code on the system.

One scenario: Application user want to search some info based on the location. A search form will provide a Locations(pulling from Central database) drop down list. After selected the location and click on Search button, it will response the result that retrieved from the chosen location DB.

I can only think of the easiest way is to hard-code all the DB connections in web.config. But I tried to avoid hard-coded.

Or every time users trigger a search request, system will trigger a query to Central DB to get the DB server IPs & DB login details. Two queries for each search request.

Is there any other better way to handle this structure and scenario?

Thanks.

I would like to change a datagrid header to follow another cell value, in this case, the header must show the currency (example in image below).

The red bold text is the one that I want to display on header.

Please help.

Header show content of other cell's value

I am following onion architecture whose Bootstrapper part is build with Autofac.

Architecture is as follows:

1 - Core

2 - DependencyInjection (Autofac is here)

3 - Service

4 - Presentation (MVC 5)

5 - Test

I needed some WebForm.aspx pages to show my reports. so I am following the instructions given the the link for integration of WebForms with Autofac: http://docs.autofac.org/en/latest/integration/webforms.html

Here is the code from DependencyInjection:

[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(IocConfig), "RegisterDependencies")]
namespace DependencyInjection.App_Start
{
    public class IocConfig : IContainerProviderAccessor
    {
         // Provider that holds the application container.
        static IContainerProvider _containerProvider;

        // Instance property that will be used by Autofac HttpModules
        // to resolve and inject dependencies.
        public IContainerProvider ContainerProvider
        {
            get { return _containerProvider; }
        }

        public static void RegisterDependencies()
        {
            // Build up your application container and register your dependencies.
            var builder = new ContainerBuilder();

            // Register your MVC controllers. (MvcApplication is the name of
            // the class in Global.asax.)
            builder.RegisterControllers(typeof(MvcApplication).Assembly);

            // OPTIONAL: Register model binders that require DI.
            builder.RegisterModelBinders(typeof(MvcApplication).Assembly);
            builder.RegisterModelBinderProvider();

            // OPTIONAL: Register web abstractions like HttpContextBase.
            builder.RegisterModule<AutofacWebTypesModule>();

            // OPTIONAL: Enable property injection in view pages.
            builder.RegisterSource(new ViewRegistrationSource());



            // OPTIONAL: Enable property injection into action filters.
            builder.RegisterFilterProvider();

 builder.RegisterType<MyService().As<IMyService().InstancePerRequest();

            // Once you're done registering things, set the container
           // provider up with your registrations.
           _containerProvider = new ContainerProvider(container);
        }
    }
}

In App.Config of DependencyInjection, I have added:

<system.web>
    <httpModules>      
      <add name="ContainerDisposal" type="Autofac.Integration.Web.ContainerDisposalModule, Autofac.Integration.Web"/>
      <add name="PropertyInjection" type="Autofac.Integration.Web.Forms.PropertyInjectionModule, Autofac.Integration.Web"/>
    </httpModules>
  </system.web>
  <system.webServer>
    <modules>
      <add name="ContainerDisposal" type="Autofac.Integration.Web.ContainerDisposalModule, Autofac.Integration.Web" preCondition="managedHandler"/>
      <add name="PropertyInjection" type="Autofac.Integration.Web.Forms.PropertyInjectionModule, Autofac.Integration.Web" preCondition="managedHandler"/>
    </modules>    
  </system.webServer>

Still it is not working. MyService is still null. When I add the App.Config setting into Web.Config of my Presentation, I got the following error:

This module requires that the HttpApplication (Global Application Class) implements IContainerProviderAccessor

I have a little problem with Razor. It's possible a duplicate, but I didn't find answer.

I use UserIdentity role model and want to change Index depend on user's role. I found here the following solution (sorry for my spelling):

@if (User.IsInRole(UserRoles.Admin))
{
    Html.ActionLink("Добавить работника", "AddEmploee");
}

But when I log in as admin, the helper doesn't generated. The result of User.IsInRole(UserRoles.Admin) is true, it goes in if's body but nothing happen on view. I added additional check:

@if (Request.IsAuthenticated && User.IsInRole(UserRoles.Admin))

But result is the same.

I am getting the error "$(...).datepicker() is not a function as I try to set a bootstrap datepicker on a form field in my MVC/razor form. I've read similar posts and can't seem to get their solutions to work. It seems like the order of dependencies matters. Any advice would be appreciated. I've referenced this as one solution I've tried without success. How to add Date Picker Bootstrap 3 on MVC 5 project using the Razor engine?

Script Block

<script src="~/Scripts/jquery-3.1.1.js"></script>
<script src="~/Scripts/jquery-3.1.1.min.js"></script>
<script src="~/Scripts/moment.js"></script>
<script src="~/Scripts/bootstrap-datepicker.js"></script>
<link href="~/Content/bootstrap-datepicker.css" rel="stylesheet" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet"/>
<script type="text/javascript">
    $(function () {
        $('.datepicker').datepicker();

    });
</script>

Form Field

<div class="form-group">
            @Html.LabelFor(model => model.TrainingDate, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.TrainingDate, new { htmlAttributes = new { @class = "form-control datepicker" } })
                @Html.ValidationMessageFor(model => model.TrainingDate, "", new { @class = "text-danger" })
            </div>
        </div>