How to display google map with location marker where i can pass city from code. if anyone can give example using Or HTML code that will be good.

I have an existing ASP.NET website with a login. The login procedure is not trivial, because of routing to different front ends on different servers based on which user logs in. There is also some communication/login going on to a classic ASP website.

Now I want to start to decouple the first step of the login procedure using a tiny Angular2 app. Basically this should just collect the user and password and leave the login validation etc. to the existing ASP.NET logic. So from my naive point of view, this is the same as filling out user and password on my existing ASP.NET page and clicking the submit button.

I know that I can make http requests using angular2 and have successfully done so calling SOAP based web services which are part of the login validation process.

I have the idea that I can somehow fake the http request which is executed when submitting the login form in the existing ASP.NET page. But as far as I understand it right now, even if I could make an http request to my login.aspx site the response I would get would sit in my Angular2 obervable as text whereas I would like to leave my Angular2 app and "simply use" that response.

I am not even sure what questions to ask ... but how do I do that?
What have I not considered?

Some options I have:

  • It would be possible to change parts of the existing ASP.NET page(s).
  • I think it would be OK to open a new browser tab in which the existing ASP.NET app would be displayed.

I send parameters for WebMethod with Ajax and receive um object. But, paramters lost zeros in WebMethod, i send "00001234", in backend paramenters is "1234"

Ajax Code:

 var content = {valueS: "00001234" };
            type: "GET",
            dataType: 'json',
            data: content,
            async: false,
            url: "myPage.aspx/GetData",
            contentType: "application/json; charset=utf-8",
            success: function (data) { OnSucess(data); },
            error:   function(data) { OnError(data); }

Webmethod Code:

    [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json, XmlSerializeString = false)]
    public static string GetData(string valueS)

I am trying to build a custom server composite control in ASP.NET. This control will be composed of two Telerik controls and a simple HTML button. I also implement the IScriptControl interface in order to add client side interaction.

I have successfully added event listener for the simple HTML button 'click' event. The problem is that I want to add an event listener for the Telerik controls events, for example:


This is the simple click event listener inside the client component class:

CustomControls.GreenButton.prototype = {

    initialize: function () {

        CustomControls.GreenButton.callBaseMethod(this, 'initialize');

        this._onButtonClickHandler = Function.createDelegate($get(this._buttonID), this._onButtonClick);

        // Successfully listening to click event               
        $addHandler($get(this._buttonID), 'click', this._onButtonClick);

        // What event do I have to listen for?? ( e.g. onClientDropDownOpening --> does not work )
        $addHandler($get(this._telerikControlID), 'unknown_event_name', this._onClientDropDownOpening);

    _onButtonClick: function (e) {
        // Event handling

    _onClientDropDownOpening: function(e) {
        // Event handling

In conclusion

How can I add an event listener for the event raised by Telerik's OnClientDropDownOpening RadDropDownTree control method? Whith what name should I replace unknown_event_name ??

$addHandler($get(this._telerikControlID), 'unknown_event_name', this._onClientDropDownOpening);

I am attempting to SET CURRENT PACKAGESET before executing a DB2 Stored Procedure on a mainframe through

I found the following link

which gives the property Keyword: CurrentPackageSet, Description: Issues the SET CURRENT PACKAGESET statement after every connection.

however I can not seem to access this property.

Dim myConnectionString As String Implements _ IDbConnection.ConnectionString
                myConnectionString = DB2Conn.ConnectionString
            Dim myConnection As New DB2Connection(myConnectionString)

            DB2StoredProc = New DB2Command(SchemaOwner & ".XXXX_WEB2OBJ", myConnection)
            DB2StoredProc.CommandType = Data.CommandType.StoredProcedure

I have attempted




but these don't appear to exist.

I have a project A that uses Razor rendering based on Sitecore 8. Meanwhile, there is a project B that uses XSLT rendering based on Sitecore 6.6.

Recently, project B is going to revamp but still keeping use of Sitecore 6.6 I am thinking should I take this chance to change the rendering method from XSLT to Razor?

I did some research and found there are two sites that do the comparision.

Yet, I could not understand which is better? Is it actually better to use Razor?

Hi Can I call a function into my view to get the description of ids in the foreach

My view

   @if (Model != null)
                int i = 1;
                foreach (var item in Model)
                <tr class="">
                    <td class="left">@{ new Fullname().getfullname(item.student_id.value).ToString(); }</td>
                    <td class="left"></td>
                    <td class="left">@CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(item.paid_month.Value).ToUpper()</td>
                    <td class="left">@item.monthly</td>
                    <td class="left">@item.transport</td>
                    <td class="left">@item.discount_details</td>
                    <td class="left"></td>

in Fullname class

public class Fullname
    private dbEntities db = new dbEntities();
    public string getfullname(int? id)
        var StudentSelect = db.student.Where(s => s.student_id == id)
            .Select(s => new
                FullName = s.lastname + " " + s.firstname

        return StudentSelect.FirstOrDefault().FullName;

I'm trying to get the student fullname from the @item.student_id in the Model

but nothing displayed


I have an Ajax.ActionLink which sends a request to server and gets a result from server. So in AjaxOption I just write name of success function.

OnSuccess = "SuccessDeleteFunction"

but based on result I want to change DOM element.To pass current DOM element in success function I used this code:

OnSuccess = "SuccessDeleteFunction(this)"

But How can I have Both at the same time.

function SuccessDeleteFunction(result, tag) {

        if (result.Success) {
            //    do sth

Here is my code:

@foreach (var item in Model)
                            <tr class="ContentRow">
                                    @Html.DisplayFor(modelItem => item.Name)
                                    @Html.DisplayFor(modelItem => item.Email)
                                    @Ajax.ActionLink(" ", "Delete", "Product", new { id = @item.Id }, new AjaxOptions() { Confirm = "Are you sure?", HttpMethod = "get", OnSuccess = "SuccessDeleteFunction" }, new { @class = "btn fa fa-trash text-danger fa-2x " })


I have menus and submenus in it respectively and I would like the submenus to remain open unless an another menu is clicked

Below is my code which copies files from one folder to another folder but what i need is while copying the files from TempFiles to TempFiles1 if there is a file with that name in TempFiles1 it should ask the user that does he wants to replace,if yes it should get copied else it should not get copied.How can i do this.

protected void Page_Load(object sender, EventArgs e)
            btn1_Click(btn1, null);
        protected void btn1_Click(object sender, EventArgs e)
            string sourcePath = Server.MapPath(".") + "\\TempFiles\\";
            string targetPath = Server.MapPath(".") + "\\TempFiles1\\";
            if (!Directory.Exists(targetPath))
            foreach (var srcPath in Directory.GetFiles(sourcePath))
                //Copy the file from sourcepath and place into mentioned target path, 
                //Overwrite the file if same file is exist in target path
                File.Copy(srcPath, srcPath.Replace(sourcePath, targetPath), true);

I'm using dotnet ef migrations add [abc] command add migration but it gives following error: No executable found matching command "dotnet-ef"

I have tried from command prompt as well as package manager console but gives same error. I have checked the path as well, i'm running command where my project.json sits.

Microsoft.EntityFrameworkCore.SqlServer is already installed.

project.json code is as follows:

  "version": "1.0.0-*",
  "dependencies": {
    "Bloomerang.Domain": "1.0.0-*",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1"
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
  "Microsoft.EntityFrameworkCore.Tools": {
    "version": "1.0.0-preview1-final",
    "imports": [

Can any one Guide me I ma newer how we Implement site Map in MVC website Thanks in advance

I have creating pdf using itextsharp c#, for unicode hindi font used 'ARIALUNI.TTF', but when i create pdf, hindi font is not properly showing as input. So, how to get Hindi font in pdf properly. Can any other unicode font used for it? or any other resolution? Here is my code & html...

 private void fillgridview()
        DataTable dt = new DataTable();
        dt.Columns.AddRange(new DataColumn[2] { new DataColumn("Name"), new DataColumn("HindiName") });
        dt.Rows.Add("India", "भारत");
        dt.Rows.Add("China", "चीन");
        dt.Rows.Add("Australia", "ऑस्ट्रेलिया");
        dt.Rows.Add("United States", "अमेरिका");
        dt.Rows.Add("Canada", "कनाडा");
        dt.Rows.Add("Russia", "रूस");
        dt.Rows.Add("Itli", "इटली");
        dt.Rows.Add("France", "फ्रांस");
        GridView1.DataSource = dt;
    protected void btnExportPDF_Click(object sender, EventArgs e)
        GridView1.AllowPaging = false;
        BaseFont bf = BaseFont.CreateFont(Environment.GetEnvironmentVariable("windir") + @"\fonts\ARIALUNI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
        iTextSharp.text.pdf.PdfPTable table = new iTextSharp.text.pdf.PdfPTable(GridView1.Columns.Count);
        int[] widths = new int[GridView1.Columns.Count];
        for (int x = 0; x < GridView1.Columns.Count; x++)
            widths[x] = (int)GridView1.Columns[x].ItemStyle.Width.Value;
            string cellText = Server.HtmlDecode(GridView1.HeaderRow.Cells[x].Text);
            //Set Font and Font Color
            iTextSharp.text.Font font = new iTextSharp.text.Font(bf, 10, iTextSharp.text.Font.NORMAL);
            font.Color = BaseColor.WHITE;
            iTextSharp.text.pdf.PdfPCell cell = new iTextSharp.text.pdf.PdfPCell(new Phrase(12, cellText, font));
            //Set Header Row BackGround Color
            cell.BackgroundColor = BaseColor.BLUE;
        for (int i = 0; i < GridView1.Rows.Count; i++)
            if (GridView1.Rows[i].RowType == DataControlRowType.DataRow)
                for (int j = 0; j < GridView1.Columns.Count; j++)
                    string cellText = Server.HtmlDecode(GridView1.Rows[i].Cells[j].Text);
                    //Set Font and Font Color
                    iTextSharp.text.Font font = new iTextSharp.text.Font(bf, 10, iTextSharp.text.Font.NORMAL);
                    font.Color = BaseColor.BLACK;
                    iTextSharp.text.pdf.PdfPCell cell = new iTextSharp.text.pdf.PdfPCell(new Phrase(12, cellText, font));
                    //Set Color of row
                    if (i % 2 == 0)
                        //Set Row BackGround Color
                        cell.BackgroundColor = BaseColor.YELLOW;
        //Create the PDF Document
        Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
        using (MemoryStream memoryStream = new MemoryStream())
        PdfWriter.GetInstance(pdfDoc, memoryStream);
        byte[] bytes = memoryStream.ToArray();        
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf");

<asp:GridView ID="GridView1" runat="server" Width="300" HeaderStyle-BackColor="Blue"
    HeaderStyle-ForeColor="White" RowStyle-BackColor="Yellow" AlternatingRowStyle-BackColor="White"
    RowStyle-ForeColor="Black" AutoGenerateColumns="false" Font-Names="Arial" Font-Size="12">
        <asp:BoundField ItemStyle-Width="200px" DataField="Name" HeaderText="Name" />
        <asp:BoundField ItemStyle-Width="200px" DataField="HindiName" HeaderText="Hindi Name" />
<br />
<asp:Button ID="btnExportPDF" runat="server" Text="ExportToPDF" OnClick="btnExportPDF_Click" />

[<img src="~/AAA.jpg" width="300" height="100">][1]


I'm developing a website that requires to get and show user's location. However, I get this error message every time I run the project: enter image description here

this is my code:

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
       <script type="text/javascript" src=""></script>
<script type="text/javascript">
if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function (p) {
        var LatLng = new google.maps.LatLng(p.coords.latitude, p.coords.longitude);
        var mapOptions = {
            center: LatLng,
            zoom: 13,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
        var marker = new google.maps.Marker({
            position: LatLng,
            map: map,
            title: "<div style = 'height:60px;width:200px'><b>Your location:</b><br />Latitude: " + p.coords.latitude + "<br />Longitude: " + p.coords.longitude
        google.maps.event.addListener(marker, "click", function (e) {
            var infoWindow = new google.maps.InfoWindow();
  , marker);
} else {
    alert('Geo Location feature is not supported in this browser.');
<div id="dvMap" style="width: 500px; height: 500px">

What's I'm doing wrong??? can anyone help please??

To make it simpler for a user to select an image if they have forgotten to select it i required that the file upload dialogue automatically open if the file, is it possible to achieve this from code behind, if it is please share the code for launching the dialogue. am Using c#

In my design there are three buttons. I want to open new windows on each button click. I have done upto open a new window. But when I click on the second button it opens in the same popup window. How can I avoid this and open three windows when click on these three buttons?

c# code

protected void btnApprove_Click(object sender, EventArgs e)
    string ddlVal = ddlComp.SelectedValue.ToString();
    if (ddlVal != "--Select The Competition--")
        Session["ddlVal"] = ddlComp.SelectedValue.ToString();
        ScriptManager.RegisterStartupScript(this, typeof(string), "APPROVE_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2); 'approved.aspx', null, 'resizable=yes, status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true);
        WebMsgBox.Show("Select a competition");

This is the code I have used for all the three buttons with different page names

I am new in especially the template part.

I have the below code which I can't fathom how on earth the menu names will appear even though the text of the menu is not being reflected in the code. <%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="Sample.aspx.cs" Inherits="eDeviationShutdown.WebForms.Sample" %> <%#Container.DataItemIndex+1 %>

                                            <asp:TemplateField HeaderText="Attachment of Evidence">
                                                    <asp:LinkButton ID="lnkCAAttachment" runat="server" ></asp:LinkButton>

                                        <EmptyDataRowStyle ForeColor="Red"></EmptyDataRowStyle>
                                        <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
                                        <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
                                        <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
                                        <SortedAscendingCellStyle BackColor="#F7F7F7" />
                                        <SortedAscendingHeaderStyle BackColor="#4B4B4B" />
                                        <SortedDescendingCellStyle BackColor="#E5E5E5" />
                                        <SortedDescendingHeaderStyle BackColor="#242121" />
                <asp:Content ID="Content2" ContentPlaceHolderID="footercontent" runat="server">

is there a way to add logic in the _ViewStart.cshtml file to drive which _Layout file to use?

Conceptually, I want to do the code below (ViewBag.Context is determined in the Home controller). But I get a red squiggly under ViewBag (does not exist in current context). I guess this is a problem because this view page doesn't know which controller/method is calling it.

@{if (ViewBag.Context == "AA")
        Layout = "~/Views/Shared/_Layout_AA.cshtml";
        Layout = "~/Views/Shared/_Layout.cshtml";

I am setting ng-init

 <td ng-init="myInit='myInit='@deal.OriginText')'">

based on the foreach statement below

@foreach (var deal in @Model.Deals.Take(Model.NumberOfFaresToDisplay ?? 6))

Inside of my html everything looks fine.

@deal.OriginText // returns the city && correct for each td

Inside of my javascript I set myInit to a scope key value pair

 var currentFlight = scope.myInit; //exists inside of a ng-click function

CurrentFlight is set on

scope.openPriceChart = function (index) {
    currentFlight //always the value of last ng-init on td from foreach

Not sure how to get the correct one. Any insight would be greatly appreciated.

I would like some insight on how to design and develop an application that creates crystal reports in using only data that are sent through HTTP POST as JSON objects. The reports will generate pdf or other available files to the server and send as repsponse to the client the uri for the generated report (or the file itself not sure right now).

No need to create a view and use CrystalReportViewer tool. I just want the generated file to be available to the client.

I am not familiar with (i have a little experience in .net Desktop apps) so i would like any suggestions on how to design the solution.

From what i read about ASP application models, i understand that i don't need to use ASP WebForms (which is supposed to add a larger overhead, and is not inherently RESTful), and i can do it using the MVC app model or by creating a Web API.

So my first question is which ASP app model should i choose? MVC or Web API. Is there any important difference between those two, for example regarding the deployment requirements? Although it seems unnecessary, is there any scenario in which Web Forms should be considered?

Secondly, i would like any suggestions on how to oranize the JSON object data on the server side. I thought about creating DataSets that will be filled with the JSON data. Crystal Reports can bind to a DataSet quite easily, so that looks like the ideal approach.

But since my experience is limited i would like any any other suggestions that could perform better.

If i am correct, i will have to create a model for each type of object/class that i will have to process, and then a controller that serves the client requests. Since i don't want a view, that part would only be resposible to bind the incoming data to the Crystal Report and send the appropriate response to the client.

My main concerns are to provide a RESTful API, add as less as possible overhead to the server side, and maximize performance.

Any suggestions are welcome! Thank you in advance.

This question already has an answer here:

Here my code to send an email on my website (using 1and1 host). This code work in local but return false when it's online :

   public static bool Send_requete(string nom, string mail, string sujet, string msg)
            MailMessage Msg = new MailMessage();
            Msg.From = new MailAddress("");
            Msg.Subject = "CONTACT : De " + nom + " " + sujet;
            Msg.Body = "De : " + mail + Environment.NewLine + " Message : " + msg;
            SmtpClient smtp = new SmtpClient("", 587);
            smtp.Credentials = new NetworkCredential("", "mypass");
            smtp.EnableSsl = true;
            return true;
            return false;

Someone have an idea considering that i cant really know where it crash from the server side, Regards.