I have "Learning objects" table which contains (id, name, level, type). The type related to another databases which are: "Video" table that contains (id,path,size) and "Image" table(id,url,size). I implemented "Learning objects" as Gridview and I designed the type column as a Radio button (Video , Image). My question is: how can I implement Video and image tables with learning objects?

For example: if the user want to add new row in the learning object table, he will choose video radio button. what is your suggestion to complete adding in another table by gridview?

google.maps.event.addListener(map, 'idle', function (event) 
                            {
                                 var ne = map.getBounds().getNorthEast();
                                //northeast lat and long

                                var sw = map.getBounds().getSouthWest();
                               //southwest lat and long

                                 var x = document.getElementById('hdnControl').value;
                               // x contains all the markers retrived from database 


                              // code part to filter markers withing bounds

                            }

var x contains all the markers and I want to place markers that are within bounds.how can i filter the markers which are within bounds? any help will be appreciated

  x contains value as
[
 {"Latitude":19.2094000000,"Longitude":73.0939000000},
 {"Latitude":19.2244070000,"Longitude":73.1545760000},
 {"Latitude":19.1659242536,"Longitude":82.2436523438},
 {"Latitude":18.3336694458,"Longitude":80.4309082031}
]

//as it has been serialized with
//dt is datatable retrived from database
JavaScriptSerializer oSerializer = new JavaScriptSerializer();

        var Result = (from c in dt.AsEnumerable()
                      select new
                      {
                          Latitude = c.Field<Decimal>("Latitude"),
                          Longitude = c.Field<Decimal>("Longitude")
                      }).ToList();

        hdnControl.Value = oSerializer.Serialize(Result);

I want to implement a Windows 10 MDM. Followed the MDE2 pdf stating the different steps involved and also followed https://msdn.microsoft.com/en-us/library/windows/hardware/dn925031(v=vs.85).aspx#discovery_service

I was able to implement the Discovery Service to which I send the discover response as well. I'm present a form by the settings app in windows stating it could not connect to my server. I checked the event viewer logs and it stated "MDM Unenroll: Authentication failed. Failed to get token from STS. Result: (The system cannot locate the resource specified.)"

I also used Fiddler to have a look at the requests during the Enrollement process. I could only see the request to my discovery service and nothing after that.

I have three questions:

  1. Is there a detailed log to debug the failures in MDM enrollment phase
  2. Why the MDM client doesn't perform any request after the discovery response
  3. "The system cannot locate the resource specified." Which URL cannot be located? Better logs would be helpful.

Any help would be appreciated.

I have created a user control which actually creates an empty dialog box for application form. I wanted to render this user control on the click event of a button(like we render partial views). I have an .aspx page that contains a button. On clicking the button the user control that creates a dialog, opens up. Below is the jquery code written to open the dialog in a user control:

Jquery

createAliasPopUpForm: function (rowNumberId) {
    // debugger;
    var self = this;
    var dat = $("input[id*='hdnAliasRecordmetaData']").val();
    self.metaDataColumns = JSON.parse(dat);
    //debugger;   
    // now bind update data to pop up
    if (self.metaDataColumns.length > 0) {

        if (rowNumberId != 'undefined' && rowNumberId != null) {
            self.rowNumber = rowNumberId;
            // fill alias record to meta data
            var listdata = $("input[id*='hdnAliasRecordList']").val();
            var aliasList = JSON.parse(listdata);
            if (aliasList.Rows.length > 0) {
                $.each(aliasList.Rows, function (i, val) {
                    if (this.RowNumber == rowNumberId) {
                        self.fillAliasRecord(self.metaDataColumns, this.Columns);
                        return false;
                    }
                });
            }

        }
        else {
            // right now cloumn list has MDM record value so need to clear that value only
            $.each(self.metaDataColumns, function (i, val) {
                this.Value = '';
            });
        }



        // sort array
        //self.metaDataColumns.sort(common.dynamicSortMultiple("GroupOrder", "MetadataId"));
        self.metaDataColumns.sort(common.dynamicSortMultiple("GroupOrder", "ColumnNumber"));
        self.createPopupHtml(self.metaDataColumns, rowNumberId);
        self.init();

        $('#popUpHeader').find('h4').remove();
        $('#popUpHeader').append('  <h4 class="modal-title" >Alias Record</h4>');
        $("#updateConfirmPopUp").dialog({
            autoOpen: true,
            width: 600,
            resizable: false,
            draggable: false,
            modal: true,
            show: { effect: 'blind' }
        });
    }



},

userControl

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AddAlias.ascx.cs" Inherits="OCM.Phoenix.WebToolsFramework.Server.Modules.MDMAdmin.AddAlias" %>
<script language="javascript" type="text/javascript" src='<%= ResolveClientUrl("~/scripts/jquery-1.4.2.min.js") %>'></script>
<script language="javascript" src="../Scripts/jquery.js" type="text/javascript"></script>
<script language="javascript" src="../Scripts/jquery-ui.js" type="text/javascript"></script>
<script language="javascript" src="../Scripts/bootstrap.min.js" type="text/javascript"></script>
<script language="javascript" src="../Scripts/Common.js" type="text/javascript"></script>
<script language="javascript" src="../Scripts/AdminEdit.js" type="text/javascript"></script>

<asp:HiddenField ID="hdnAliasRecordmetaData" runat="server" />
<asp:HiddenField ID="hdnAliasRecordList" runat="server" />
<script>
$(function () {
    adminEditForm.createAliasPopUpForm();
});
</script>

code behind file just contains the load event

aspx page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddAliasPage.aspx.cs" Inherits="Modules_MDMDataHub_AddAliasPage" %>

<%@ Register Src="UserControls/AddAlias.ascx" TagPrefix="uc" TagName="alias" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<script src="Scripts/jquery.js"></script>
<script src="Scripts/jquery-ui.js"></script>
<script src="Scripts/AdminEdit.js"></script>

<body>
    <form id="form1" runat="server">
        <div>
            <uc:alias ID="alias" runat="server" />
            <br />

            <asp:button ID="btn1" OnClick="btn1_Click" runat="server">    </asp:button>

        </div>
    </form>
</body>
</html>

Although, I have created the click event of the button, that calls the below function to render the html of the user control. but its actuaaly not working as it keeps giving me an errer as the hdnmetadatavalue must be inside the form tag. I did it but still i get the error. Am i doing something wrong here? Please help

private string RenderControl()
{
    var sb = new System.Text.StringBuilder();
    using (var stWriter = new System.IO.StringWriter(sb))
    using (var htmlWriter = new HtmlTextWriter(stWriter))
    {
        var p = new Page();

        var ctrl = (AddAlias)p.LoadControl("~/Modules/MDMDataHub/UserControls/AddAlias.ascx");
        ctrl.Visible = true;

        // do your own init logic if needed

        p.Controls.Add(ctrl);
        ctrl.RenderControl(htmlWriter);
        return sb.ToString();
    }
}

I'm trying to figure out how Build/Project/Solution configurations and Publishing profiles are related in an ASP.NET project in Visual Studio 2012.

Example: We have two Projects in a Solution. The Projects are published via File Publishing.

  1. Both projects have several build configs.
  2. Each build config has an associated Web.config transformation file.
  3. The Solution has several configs, each with one build config selected per project.
  4. Publishing profiles are separated by Project; multiple profiles exist for each.

So far, so good. But:

  1. Although we publish a Project, in the profiles a Solution config needs to be selected.

What's the point of this? Maybe we're doing something wrong; it would seem much more logical to select a Build config for publishing. Can someone enlighten me? Thanks.

I have tried to read the msdn article on complex types. But it does not explain when to use it. Also there is not a comprehensive explanation on the web on complex types and when to use them.

This is string date dob = reader.GetValue(7).ToString(); return like "12/2/2012"

but I want to convert (before passing it) to this format "2012212", I have tried string newDate = dob.ToString("yyyMMdd")but it says : The best overloaded method match for 'string.ToString(System.IFormatProvider)has some invalid arguments

any idea ?

I'm very new to ASP.net MVC, I'm trying to build a very basic login form, everything worked fine, I have added the stored procedure for the login method and "added function import", the issue is that it always returns one value "-1" in all cases. let's take a look...

1- MovableAssetsDB.context.cs

public virtual int LoginToMovable(string userName, string password)
    {
        var userNameParameter = userName != null ?
            new ObjectParameter("UserName", userName) :
            new ObjectParameter("UserName", typeof(string));

        var passwordParameter = password != null ?
            new ObjectParameter("Password", password) :
            new ObjectParameter("Password", typeof(string));

        return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("LoginToMovable", userNameParameter, passwordParameter);
    }

2- I made a class called "Data" to handle the method and call the stored procedure

public int Login(string username, string password)
    {
        using (var DBcontext = new MovableAssetsEntities())
        {
             int userId = DBcontext.LoginToMovable(username, password);
            return userId;
        }

    }

3-In the "Home" view, here is the code of the form and razor code to handle the login process

    @{
    Layout = null;
}

@{
    ViewBag.Title = "Login";
}



@{ 
    if (IsPost)
    {
        string username = Request.Form["username"];
        string password = Request.Form["password"];

        int userId = new MovableAssets.Classes.Data().Login(username, password);

        if (userId > 0)
        {
            <script>alert("yes");</script>

        }
        else
        {
            <script>alert("No");</script>
        }
    }

}

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Movable Assets</title>
    <link rel="stylesheet" href="@Url.Content("~/Content/Custom/css/style.css")">
</head>

<body>
    <div class="container">
        <p id="home_title">Movable Assets</p>
        <section id="content">
            <form action="#" method="post">
                <h1>Login</h1>
                <div>
                    <input type="text" placeholder="Username" required="" id="username" name="username" />
                </div>
                <div>
                    <input type="password" placeholder="Password" required="" id="password" name="password" />
                </div>
                <div>
                    <input type="submit" value="Log in" />
                </div>
            </form><!-- form -->
        </section><!-- content -->
    </div><!-- container -->
</body>
</html>

4-The stored procedure

  ALTER PROCEDURE [dbo].[LoginToMovable]
    @UserName nvarchar(50),
    @Password nvarchar(50)
AS
BEGIN

    SET NOCOUNT ON;

    SELECT ID FROM Utilities.dbo.Users WHERE Utilities.dbo.Users.LogIn = @UserName AND Utilities.dbo.Users.Password = @Password
    AND AppCode = '9'
END

Whenever I write down any login credentials I get the value of userId to be -1 any suggestions?!

I'm getting

 var myArr = [];
 $.each(eval(MY_GLOBAL_VAR), function (key, val) {
      myArr .push(val);
 });

and inside razor view I'm accessing this array as part of model (MyCollection)

inside razor view I'm iterating trough collection

foreach (var item in Model.MyCollection)
{
    string.Join(",", @item);
}

If I'm getting values inside @item [string[]] {string[1]} how can iterate trough this {string[1]} inside above foreach loop?

I try to find some examples for overriding ext.net combobox. I need to do this, because I want to use default values for most properties. But I have a problem. I could not to find some examples for store, handler, proxy and my own listeners, which using in combobox. How can I override it? Can anybody give me some examples?

A C# class example for own combobox. My thanks.

Could you guys help me out in opening a outlook from ajax call and add mail to ,body ,subject from data got back from that ajax call

I tried Implementing the code for Edit and Update button for gridview but it doesn't seems working for me. Add button working well but delete and update do not working. During runtime error the error is "An exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll but was not handled in user code Additional information: Unknown column 'p001' in 'where clause'"

Note: type of P_Id in the database is varchar(10), name varch(100), level varchar, value varchar

public partial class ManagePractice : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        BindData();
    }
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
    TextBox txtID = (TextBox)GridView1.FooterRow.FindControl("txtID");
    TextBox txtSubject = (TextBox)GridView1.FooterRow.FindControl("txtSubject");
    RadioButtonList Level = (RadioButtonList)GridView1.FooterRow.FindControl("RadioButtonList2");
    RadioButtonList PType = (RadioButtonList)GridView1.FooterRow.FindControl("RadioButtonList1");
    AddPractice(txtID.Text.Trim(), txtSubject.Text.Trim(), Level.Text.Trim(), PType.Text.Trim());
    BindData();
}
private void AddPractice(string P_Id, string subject, string level, string type)
{
    string connStr = @"Data Source=localhost;Database=ahsschema;User Id=webuser;Password=webuser2014";

    using (MySqlConnection cn = new MySqlConnection(connStr))
    {
        string query = "insert into practice(P_Id,name,level,value) values ('" + P_Id + "','" + subject + "','" + level + "','" + type + "')";
        MySqlCommand cmd = new MySqlCommand(query, cn);
        cn.Open();
        cmd.ExecuteNonQuery();
        cn.Close();

    }
}
private void BindData()
{
    DataTable dt = new DataTable();
   string connStr = @"Data Source=localhost;Database=ahsschema;User Id=webuser;Password=webuser2014";
    using (MySqlConnection cn = new MySqlConnection(connStr))
    {
        MySqlDataAdapter adp = new MySqlDataAdapter("select P_Id,level,name,value from practice", cn);
        adp.Fill(dt);

    }
    if (dt.Rows.Count > 0)
    {
        GridView1.DataSource = dt;
        GridView1.DataBind();

    }
}

protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
    GridView1.EditIndex = -1;
    BindData();
}

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
    string id = (GridView1.DataKeys[e.RowIndex].Value.ToString ());
    DeletePractice(id);
    BindData();


}

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
    GridView1.EditIndex = e.NewEditIndex;
    BindData();
}

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
  //  int id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
    TextBox txtID = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtID");
    TextBox txtSubject = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtSubject");
   // TextBox Level1 = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtlevel");
   // TextBox PType1 = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPType1");
     RadioButtonList Level = (RadioButtonList)GridView1.Rows[e.RowIndex].FindControl("RadioButtonList2");
     RadioButtonList PType = (RadioButtonList)GridView1.Rows[e.RowIndex].FindControl("RadioButtonList1");

    UpdatePractice( txtID.Text , txtSubject.Text, Level.Text, PType.Text);
    GridView1.EditIndex = -1;
    BindData();

}
private void UpdatePractice( string P_Id, string name, string level, string value)
{
     string connStr = @"Data Source=localhost;Database=ahsschema;User Id=webuser;Password=webuser2014";
    using (MySqlConnection cn = new MySqlConnection(connStr))
    {
        string query = "UPDATE practice SET P_Id='" + P_Id + "',name='" + name + "',level='" + level + "',value='" + value + " WHERE P_Id=" + P_Id + "";
        MySqlCommand cmd = new MySqlCommand(query, cn);
        cn.Open();
        cmd.ExecuteNonQuery();
        cn.Close();
    }
}
private void DeletePractice(string id)
{
   string connStr = @"Data Source=localhost;Database=ahsschema;User Id=webuser;Password=webuser2014";
    using (MySqlConnection cn = new MySqlConnection(connStr))
    {
        string query = "DELETE FROM practice WHERE P_Id=" + id + "";
        MySqlCommand cmd = new MySqlCommand(query, cn);
        cn.Open();
        cmd.ExecuteNonQuery();
        cn.Close();
    }
}

I need to join few tables and display them in cshtml, but i got problem with model. I get error:

"The model item passed into the dictionary is of type 'System.Data.Entity.Infrastructure.DbQuery1[DziennikASPTest4.Controllers.PROJEKTYController+ProwadzacyProjekty]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable1[DziennikASPTest4.Models.ProwadzacyProjekty]'."

I have created query:

            var projekt = from p in db.PROJEKTY
                       join przedm in db.PRZEDMIOTY on p.id_przedmiotu equals przedm.id_przedmiotu
                       join prow in db.PROWADZACY on przedm.id_prowadzacego equals prow.id_prowadzacego
                       where prow.id_prowadzacego == 1
                       select new ProwadzacyProjekty
                       {
                           PROJEKTY = p,
                           PRZEDMIOTY = przedm,
                           PROWADZACY = prow

                       };
        return View(projekt);

and model:

    public class ProwadzacyProjekty
    {
        public PROJEKTY PROJEKTY { get; set; }
        public PRZEDMIOTY PRZEDMIOTY { get; set; }
        public PROWADZACY PROWADZACY { get; set; }
    }

and i try to display it in cshtml:

@model IEnumerable<DziennikASPTest4.Models.ProwadzacyProjekty>
@foreach (var item in Model)
{
     <div>@item.PROJEKTY.opis</div>
}

How should i suppose to do it?

I am attempting to keep count of total times my @helper is ran (to breakup the list items this @helper outputs into sets of 10).

For whatever reason, I cannot find/figure this out. I simply need a variable that I can increment from within a @helper.

@functions
{
    public int totalItems = 0;
}

@helper myHelper()
{
    @if (totalItems % 10 == 0)
    {
        </ul><ul>
    }

    <li>List Item #@totalItems</li>

    @{
        // Increment counter
        totalItems = (totalItems + 1);
    }
}

@{
    <ul>
        @for(var i = 0; i < 25; i++)
        {
            @myHelper();
        }
    </ul>

    // It would be great if I could do this after the loop!
    <p>Last list contains @totalItems list items!</p>
}

I just brain-dumped the code above, so sorry if there are syntax errors... But I think it gets my point across?

I want the above code to output:

<ul>
    <li>List Item #1</li>
    <li>List Item #2</li>
    <li>List Item #3</li>
    <li>List Item #4</li>
    <li>List Item #5</li>
    <li>List Item #6</li>
    <li>List Item #7</li>
    <li>List Item #8</li>
    <li>List Item #9</li>
    <li>List Item #10</li>
</ul>

<ul>
    <li>List Item #1</li>
    <li>List Item #2</li>
    <li>List Item #3</li>
    <li>List Item #4</li>
    <li>List Item #5</li>
    <li>List Item #6</li>
    <li>List Item #7</li>
    <li>List Item #8</li>
    <li>List Item #9</li>
    <li>List Item #10</li>
</ul>

<ul>
    <li>List Item #1</li>
    <li>List Item #2</li>
    <li>List Item #3</li>
    <li>List Item #4</li>
    <li>List Item #5</li>
</ul>

The aforementioned markup does not achieve this though. Instead, the page errors. I am not using an IDE like Visual Studio, so I do not know what error is being thrown, but the error occurs when I add the following to my View:

@{
    // Increment counter
    totalItems = (totalItems + 1);
}

Can anyone explain the right way to achieve this? Thank you very much for any help!

How can I declare Dim i = A like Dim i = 0?

I need to show in my for each table with indicator A until E. My code as below:

 @code
                                    Dim i = 0
                                    i = i + 1
                                    End Code
                                    @For Each item In Model.List_EvlFactor
                                        @<tr>
                                             <td class="col-md-2">@i</td>
                                            <td class="col-md-2">@Html.Raw(item.Evl_Factor)</td>
                                            @For Each items In Model.List_EvlScore.Where(Function(m) m.ID_Evl_Factor = item.ID_Evl_Factor).OrderByDescending(Function(m) m.Evl_Rating_Score)
                                                @<td style="text-align:center">
                                                    @items.Evl_Description
                                                </td>
                                            Next
                                        </tr>
                                    i += 1
                                    Next

I'm building a web application using ASP.NET MVC, and I'm building a few JavaScript libraries that I want to host on GitHub.

My current workflow for updating the JavaScript libraries are:

  • Make changes to the JavaScript libraries in my web app
  • Test the changes by launching the web app
  • Copy those changes to my GitHub repos

Is there a better way to automatically deploy the changes without having to copy/paste?

i have a mvc form with multiple fields that are calling custom edit views. I need to implement dropzone instead of the standard file import control. I cant figure out how to get the file names and pass them together with the dropzone. I am searching the internet for 2 days and no results.

The form looks like this:

@using (Html.BeginForm("contr", "action", new { themeid = ViewBag.ThemeId, @class = "dropzone"}, FormMethod.Post, new { @enctype = "multipart/form-data" }))

At the end i have an Edit view that contains the dropzone div:

<div id="fileInput" class="dropzone">
                <div class="fallback">
                    <input name="files" type="file" multiple />
                </div>
            </div>

Function for the dropzone:

function initDropzone() {
    new Dropzone('#fileInput', {
        url: '#',
        autoProcessQueue: false,
        uploadMultiple: true,
        addRemoveLinks: true,
        autoDiscover: false,
        parallelUploads: 100,
        dictDefaultMessage: "Click or drop files to upload",
        init: function () {
            var myDropzone = this;
            $('#submit-all').click(function (e) {
                $(".dz-progress").show();

                myDropzone.processQueue();
            });
            myDropzone.on('success', function () {
                myDropzone.removeAllFiles();
                //$('#name').val('');
            });
            myDropzone.on("sending", function (file, xhr, formData) {
                formData.append("file", file); // Append all the additional input data of your form here!
            });
            myDropzone.on("addedfile", function (event) {
                $(".dz-progress").hide();

            });
        }

    });

As most examples suggest i call processQueue when submit is clicked, but the problem is that the controller action is called twice, once with the files but without the other models, and the next time with the models but without the files.

I can't use stopPropagation on submit because i call different views based on the logic in the action method.

The basic question is how i can take the files from dropzone and append them to form data. Hidden fields does not work, i don't know why.

An y help would be appreciated.

I want to replace some instances of UrlHelper.Action with UrlHelper.RouteUrl in my code, because of its performance benefits. According to the documentation, both methods generate the fully qualified URL I'm looking for, I just need to make sure that both methods internally "do" the exact same thing.


For example, given the following route in RouteConfig:

routes.MapRoute(
    "RouteName",
    "Url",
    new { controller = "Controller", action = "Action" }
);

Is it safe to assume that

urlHelper.Action("Action", "Controller", routeValueDictionary);

is exactly equivalent to

urlHelper.RouteUrl("RouteName", routeValueDictionary);

EDIT: Assume that the routes in RouteConfig have unique controller, action combinations.

I know there are many solutions can be found in the web regarding my problem, but none of them are working for me. That's why I'm asking this question.

First let me explain what I'm looking to achieve -

-> I'm developing a multi-user Web application [ASP.Net] -> I'm using SignalR to get real-time database change notifications and SignalR instantly transmit the change notifications to all the users logged in the application. -> Now in addition what I want to do is to play a notification sound for all the logged in users so that they can understand a new notification need attention.

This is what I've done so far -

JavaScript

<script>
    function playSound(mysound) {
        //thisSound = document.getElementById(mysound);
        //thisSound.Play();
        var audio = new Audio(mysound);
        audio.play();
    }

</script>

Code Behind -

ScriptManager.RegisterClientScriptBlock(Me, [GetType](), "OpenWindow", "javascript: playSound('./audio/notification.wav')", True)

The problem with this solution is that the user need to reload the page to hear the notification sound, which I think is pointless if the user can't hear them instantly like the SignalR processing notifications.

Is it possible to push the sound to all the clients so that they don't need to reload the page?

Any help would be highly appreciated. If you need any further clarification please let me know.

I need to have an image repeat and be visible both on the screen and while printing. So far using

body {
    background:url(images/confidential.png) repeat;
}

@media Print {
    body:before { 
         content: url(images/confidential.png);
         position: absolute;
         z-index: -1;
    }
}

works with the exception of the repeat when printing. Suggestions? Thanks.

Is there a way to intercept a HttpPost request to a .asmx WebService using an Attribute?

I already have a SoapExtension that validates what I need for SOAP requests, but I need to do the same validation in POST requests.