i'm have a web service with asp.net i'm need to send data to this service by ajax used this code

$.ajax({
    type : "POST", 
    contenttype: 'application/json; charset=utf-8',
    dataType: "json",
    url :  "myurl", 
    data: { 
        mydata
    },
  error: function (data) {
         console.log(data.responseText);
    },


     success: function () {
     }
    })

then i'm have this respons in my console

<?xml version="1.0" encoding="utf-8"?>
<JsonResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
  <Data xsi:type="xsd:string">{"reuslt":"-2"}</Data>
  <JsonRequestBehavior>AllowGet</JsonRequestBehavior>
  <MaxJsonLength xsi:nil="true" />
  <RecursionLimit xsi:nil="true" />
</JsonResult>

how can read this respons i'm need to the parameter result how can read this ?

can any one help me

thank you

I facing the issue that mention error for SSRS report. I'm currently using VS2015 for development.

Here is the error that i facing now. I have no idea how to solve this problem.

Should I install the report viewer?

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The base class includes the field 'ReportViewerSummary', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer).

Source Error:

Line 12:         <asp:Panel ID="Panel1" runat="server" ScrollBars="Horizontal">
Line 13:         <asp:Label ID="LableWarning" CssClass="LableWarning" runat="server" />
Line 14:         <rsweb:ReportViewer ID="ReportViewerSummary" runat="server" Width="100%">
Line 15:         </rsweb:ReportViewer>
Line 16:        </asp:Panel>

Source File: /DCBRequestLogSummary.aspx Line: 14 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1586.0

I realize this is a frequently asked question but none of the answered I located seemed to fix my issue.

I have an action in my controller that populates a drop down using info from a database.

Everything works fine until I try to reuse the drop down in another view.

From my Action

In my View I have

public ActionResult ImportAddresses1([Bind(Include = "ProjectID, ProjectName")] ProjectMaster projectName)
{
   ViewBag.ProjectName = new SelectList(db.ProjectMaster, "ProjectID", "ProjectName");

   return View();
}



@Html.DropDownList("ProjectName", null, "-- Please select a project --", htmlAttributes: new { id = "projectselect", title = "ProjectName", @class = "form-control", })

Again it works fine in one view butnot when I try to use itin another view.

What am I missing?

I have an existing project, which uses ASP.Net, System.Web.Security, and WebMatrix.WebData for the membership system. This application is where all the users are created, updated, etc, and stored to a database.

I also have a separate application, which is just a plain Azure worker role, which needs to read some of the membership information back from the database. For example, I need to view what roles a particular user is in. I expected the sample program below to show the different roles - "Administrator", "Account Manager", etc, and also for certain users to be associated with those roles. I have checked in the database, and the associations are all stored correctly in the 'webpages_Membership' tables etc.

Now the problem is, my second application can't see any of the roles created by the first one. I've tried to copy as much of the relevant configuration settings from the first project to the second. I realize WebMatrix.WebData as a package is deprecated, it's included in Microsoft.AspNet.WebPages.WebData, I've just been trying to keep everything exactly the same between the two projects.

public static void Main()
{
    if (!WebSecurity.Initialized)
    {
        Console.WriteLine("Initializing WebSecurity");
        WebSecurity.InitializeDatabaseConnection("CustomDbContext", "UserProfile", "Id", "Username", autoCreateTables: false);
    }

    using (var db = new CustomDbContext())
    {
        Console.WriteLine("All Roles : {0}", Roles.GetAllRoles().ToString());

        foreach (var user in db.UserProfiles)
        {
            Console.WriteLine("User      : {0}", user.UserName);
            Console.WriteLine("    Roles : {0}", Roles.GetRolesForUser(user.UserName).ToString());
        }
    }

    Console.Read();
}

Packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.1.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebPages.Data" version="2.0.20710.0" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebPages.WebData" version="2.0.20710.0" targetFramework="net461" />
  <package id="CustomDataModels" version="1.0.0" targetFramework="net461" />
  <package id="WebMatrix.WebData" version="2.0.30506.0" targetFramework="net461" />
</packages>

App.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
  </startup>
  <connectionStrings>
    <add name="CustomDbContext" connectionString="XXX" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <machineKey validationKey="XXX" decryptionKey="XXX" validation="SHA1" decryption="AES" />
    <roleManager enabled="true" defaultProvider="SimpleRoleProvider">
      <providers>
        <clear />
        <add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData" />
      </providers>
    </roleManager>
    <membership defaultProvider="SimpleMembershipProvider">
      <providers>
        <clear />
        <add name="SimpleMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData" />
      </providers>
    </membership>
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

We can't get SignalR to work when using ARR 3.0 as a reverse proxy in front of our Visual Studio development machine. The connection is successfully established but the initial frame that should be sent from the SignalR server once the connection is established is never sent, as a matter of fact, no frames can be sent, this causes the client to drop the WebSocket connection. To sum up, "the websocket connection can establish, but can't transfer frames."

The MVC app works without the reverse proxy.

We've tried all suggested solutions in the following threads:

Screenshot of "negotiate"-request. 1

Screenshot of "connect"-request. enter image description here

EDIT 1

It appears that the connected-frame is being sent but fails down the road. It's visible through Wireshark on loopback.

enter image description here

I have a method in which I have to populate dropdownlist from a collection that is formed like a tree. I have list of parent Objects, every parent can have list of child Objects, every child can have list of grandchild Objects and so on. I have to loop through tha collection because I want to indent items so hierarchy is built.

ddl should look like this:(- is symbol for indent) parent -child --grandchild ---grandgrandchild -child parent ..and so on..

How should I go about changing this method so i dont have loop inside a loop inside a loop, asume I dont know the depht of a tree

Thanks in advance!

Method:

private void BindObjectDropDown()
    {
        ddlObject.Items.Clear();

        ObjectCollection collection = Object.GetList();

        if (collection != null && collection.Count > 0)
        {
            foreach (var parent in collection)
            {
                ddlObject.Items.Add(new ListItem($"{parent.Title}", parent.Id.ToString()));
                if (parent.Objects != null && parent.Objects.Count > 0)
                {
                    foreach (var child in parent.Objects)
                    {
                        ddlObject.Items.Add(new ListItem($"{_ddlIndent}{child.Title}", child.Id.ToString()));

                        if (child.Objects != null && child.Objects.Count > 0)
                        {
                            foreach (var grandchild in child.Objects)
                            {
                                ddlObject.Items.Add(new ListItem($"{_ddlIndent}{_ddlIndent}{grandchild.Title}", grandchild.Id.ToString()));

                                //and so on and so on ....

                            }
                        }

                    }
                }
            }
            foreach (ListItem item in ddlObject.Items)
            {
                item.Text = HttpUtility.HtmlDecode(item.Text);
            }
        }
    }

how to convert following razor code for telerik kendo grid

@{

int rowNum = 0;
@Html.AntiForgeryToken()
WebGrid grid = new WebGrid(Model, rowsPerPage: Model.Count() == 0 ? 1 : Model.Count());
@Html.Hidden("StdCourse[" + (0).ToString() + "].TotalPaidFee",Model.Sum(m => m.PaidFee),new  {@id= "hdnTotalPaidFee" });
@Html.Hidden("StdCourse[" + (0).ToString() + "].TotalCourseFee", Model.Sum(m => m.CourseFees), new { @id = "hdnTotalCourseFee" });
@Html.Hidden("StdCourse[" + (0).ToString() + "].TotalRemainingFee", Model.Sum(m => m.RemainingFee), new { @id = "hdnTotalRemainingFee" });

var gridColumns = new List<WebGridColumn>();

gridColumns.Add(grid.Column("Row No", format: item => rowNum = rowNum + 1, style: "RowNumber"));
gridColumns.Add(grid.Column("StudentCode", header: "StudentCode", format: (item) => Html.Hidden("StdCourse[" + (rowNum - 1).ToString() + "].StudentCode", (object)item.StudentCode, (object)new { @style = "width:100%;" }), style: "StudentCode"));
gridColumns.Add(grid.Column("Sr No", header: "Sr No", format: (item) => 

Html.TextBox("StdCourse[" + (rowNum - 1).ToString() + "].SrNo", (object)item.SrNo,Model.First().PageMode > 1? (object)new { @style = "width:100%;",@readonly="true" }: (object)new { @style = "width:100%;" }), style: "SrNo")); gridColumns.Add(grid.Column("Course Name", header: "Course Name", format: (item) => Html.TextBox("StdCourse[" + (rowNum - 1).ToString() + "].CourseName", (object)item.CourseName, Model.First().PageMode > 1 ? (object)new { @style = "width:100%;", @readonly = "true"} : (object)new { @style = "width:100%;" }), style: "CourseName")); gridColumns.Add(grid.Column("Course Fees", header: "Course Fees", format: (item) => Html.TextBox("StdCourse[" + (rowNum - 1).ToString() + "].CourseFees", (object)item.CourseFees, Model.First().PageMode > 1 ? (object)new { @style = "width:100%;text-align:right;", @readonly = "true", @id = "txtCourseFee" } : (object)new { @style = "width:100%;text-align:right;", @onblur = "chkNumbers($(this),1);colInputSum('CourseGrid','CourseFee');calRemainFees(this);", @id = "txtCourseFee" }), style: "CourseFees")); gridColumns.Add(grid.Column("Paid Fees", header: "Paid Fees", format: (item) => Html.TextBox("StdCourse[" + (rowNum - 1).ToString() + "].PaidFee", (object)item.PaidFee, Model.First().PageMode > 1? (object)new { @style = "width:100%;text-align:right;",@readonly="true", @id = "txtPaidFee" } : (object)new { @style = "width:100%;text-align:right;", @onblur = "chkNumbers($(this),1);colInputSum('CourseGrid','PaidFee');calRemainFees(this);", @id = "txtPaidFee" }), style: "PaidFee")); gridColumns.Add(grid.Column("Pending Fees", header: "Pending Fees", format: (item) => Html.TextBox("StdCourse[" + (rowNum - 1).ToString() + "].RemainingFee", (object)item.RemainingFee, Model.First().PageMode > 1 ? (object)new { @style = "width:100%;text-align:right;", @readonly = "true", @id = "txtRemainingFee" } : (object)new { @style = "width:100%; border:none;disabled:true;cursor:default;text-align:right ; ", @id = "txtRemainingFee", @readonly = true }), style: "RemainingFee")); if (Model != null && Model.Count() > 0) { if (Model.First().MastCode != null) { if (Model.First().MastCode != "0") { // gridColumns.Add(grid.Column("REMAININGFEE", header: "RemainingFee", format: (item) => Html.TextBox("StdCourse[" + (rowNum - 1).ToString() + "].RemainingFee", (object)item.RemainingFee, (object)new { @style = "width:100%;" }), style: "RemainingFee")); } } }

@grid.Table(
htmlAttributes: new { id = "CourseGrid" },
            tableStyle: "webgrid table-responsive",
            fillEmptyRows: true,
            headerStyle: "webgrid-header",
            footerStyle: "webgrid-footer",
            alternatingRowStyle: "webgrid-alternating-row",
            rowStyle: "webgrid-row-style",
            columns: gridColumns.ToArray(),
   footer: @<tr>
                <td></td> 
                <td></td>
                <td></td>
                <td></td>
                <td><label id="lblTotalCourseFee" >0.00</label></td>
                <td><label id="lblTotalPaidFee" >0.00</label></td>
                <td><label id="lblTotalRemainingFee">0.00</label></td>
            </tr>

 )

}

I have a SPA web app built with Angular 2, with a back-end of Asp.Net Core Web Api. I use Identity as my auth framework. Client app and back-end are two separate projects, and connected via CORS (client is hosted at localhost:4200 and server is at localhost:5555).

All is excellent but I got one weird(?) problem: Auth (login/logout) works as expected, but when I refresh the client (e.g. by hitting F5 in my browser) the my authentication is lost!

Note that I don't want to persist login info at client side (no "remember me" functionality on login) because this is a line-of-buisness app. So as long as user closes the browser, I'm ok to redirect him/her at login page at next visit, but by just hitting F5 to refresh the page, I don't think the auth info should be lost!

Yes it is a SPA app so basically one should never have to hit F5 usually, but still... That's not really the desired behavior.

I wonder this has to do with the fact that I'm using CORS (i.e. invoking web api from different origin)? Other than that, I have no idea what have I messed up...

Here is relevant parts from ConfigureServices:

services.AddIdentity<User, string>(options =>
    {
        options.Cookies.ApplicationCookie.AutomaticChallenge = false;

        options.Password.RequireDigit = false;
        options.Password.RequireLowercase = false;
        options.Password.RequireNonAlphanumeric = false;
        options.Password.RequireUppercase = false;
    })
    .AddUserStore<MyUserStore>()
    .AddRoleStore<MyRoleStoreDummy>()
    .AddDefaultTokenProviders();

services.AddCors();

services.AddMvc(options => options.Filters.Add(new ModelStateValidationFilter()));

...and from Configure method of startup class:

app.UseIdentity();

app.UseCors(policy => policy.WithOrigins("http://localhost:4200")
                            .AllowAnyHeader()
                            .AllowAnyMethod()
                            .AllowCredentials());

app.UseMvc();

I have login and signup forms on a single asp.net page (like facebook landing page) and I want to fire submit both forms on the page independently from each other. While a page can have only one server-side form tag, I can't do it.

İs this a simple way to do that?

I used panel, validationgroup, requiredformvalidation, webusercontrol, etc. However, it didn't work.

Help me please.

Thanks in advance.

I have a logs table with a smalldatetime column.

When I'm inserting into the table GETDATE() value, the data is inserted without the seconds (insert query from the server side in ASP.net).

Example result: 2017-01-15 15:20:00

What am I missing?

Thanks!

Problem with a simple Razor template. This should be rendering a list of my DNN pages:

@using DotNetNuke.Web.DDRMenu;
@using System.Dynamic; 
@inherits DotNetNuke.Web.Razor.DotNetNukeWebPage<dynamic>
@{
    var root = Model.Source.root;
}
@helper RenderNodes(IList<MenuNode> nodes) {
    if (nodes.Count > 0) {
        <div id="dnnFooterMenu">
            <ul>
                @foreach (var node in nodes) {
                    if (node.HasChildren()) {
                        <li>
                            <a href="#"><b>@node.Text</b></a>
                            @RenderChildNodes(node.Children)
                        </li>
                    } 
                }
            </ul>
        </div>
    }
}
@helper RenderChildNodes(IList<MenuNode> nodes) {
    if (nodes.Count > 0) {
        <ul>
            @foreach (var node in nodes) {
                <li><a href="@node.Url">@node.Text</a></li>
            }
        </ul>
    }
}
@RenderNodes(root.Children)

All it renders is this:

<div id="dnnFooterMenu">
    <ul>
        </ul>
</div>

The first and last pages have no children. What am I missing here?

Where can I find the code for the dialog box? I would like to have a dialog box for the password textbox as well.

enter image description here

I am now developing an ASP.Net web forms application. The problem is, every time I want to make a small change, I have to rebuild and redeploy the application in IIS Express, which typically takes over a minute. I can be waiting for over a half hour every day just for the application to compile and start up. Coming from development in interpreted languages like ruby where I can keep the server running, save the code and refresh, this seems like a huge waste of time. Is there any way for me to speed this process up?

i have a problem in rendering a header to my export to pdf. i am trying to make something like having text on the top left of page with a text and the other side having image on the top right of the page. may be the image example would be like this header example

guys, do you have any idea for this problem and suggestion for what should i do regarding this problem. May be most of itext user will try to use this type of header. Any open suggestion will be very helpfull.

PS: i am using itextsharp

As the title states, is it possible to do so? I managed to of course authenticate and get the response data (in this case, getting the user details) and just display it in another browser using windows.location.

I don't really know how to go about into passing the "data" chunk and save it into the database SQL. Any help will be appreciated

I referenced the code from source: http://www.c-sharpcorner.com/uploadfile/raj1979/how-to-authenticate-and-get-data-using-instagram-api/

snippet code

    $.ajax({
                type: "GET",
                async: true,
                contentType: "application/json; charset=utf-8",
                url: 'https://api.instagram.com/v1/users/' + instagramaccessid + '?access_token=' + instagramaccesstoken,
                dataType: "jsonp",

                cache: false,
                beforeSend: function () {
                    $("#loading").show();
                },
                success: function (data) {

                   window.location = 'https://api.instagram.com/v1/users/' + instagramaccessid + '?access_token=' + instagramaccesstoken;


                }
            });

I have a ListBox that i've bound items to, but when I try and retrieved the object from the ListBox at a later point I get a compiler error... Does anyone know what the deal is?

    protected void Page_Load(object sender, EventArgs e)
{
    List<Project> projects;

    DeleteListBox.ItemType = "Project";
    DeleteListBox.DataValueField = "projName";

    using(DBMethods db = new DBMethods())
    {
        //Projects is not null during testing
        projects = db.getProjects() as List<Project>;
        DeleteListBox.DataSource = projects;
        DeleteListBox.DataBind();
    }

}

Now later I'm trying to retrieve the object from the ListBox but I get a red squiggly line under the entire line of code:

    protected void PermDelete_Click(object sender, EventArgs e)
{
    using(DBMethods db = new DBMethods())
    {
        //Compiler error here
        var toDelete = DeleteListBox.SelectedItem as Project;
    }
}

How can I cast my selected list item into a Project object without a compiler error? Cannot convert type 'SystemW.Web.UI.WebControls.ListItem' to 'Project' via a reference conversion...

I need to build a highly scalable website, actually i need it to be as cheap as possible since my cash reserves are rather limited.

Apart from various caching strategies and so forth, here is one strategy i want to implement.

I will have 2 separate sites.

One will be a NodeJs powered website, that will serve static content (scripts, css, angular 2, have webpack running on it).I want to have it NodeJS because i want to learn a bit about Node in the process, and it is really hard to work with Angular 2/typescript enviromnent in visual studio for me.( some will disagree and thats fine ).

The other will be a ASP.NET WEB API 2 powered website, which will only expose some endpoints for the nodejs application to consume data.

Both will be hosted in Microsoft Azure's Web Apps.

Is this a good idea? are there any drawbacks, what do you guys think?

I understand Node runs on a single thread as javascript does.If i have a 2 cpu machine on Azure, will Node run on those 2 cpus as different instances, or will it just use one thread and the other cpu will stand by idly.

here is a code in HTML in header

 @Styles.Render("~/Content/plugins.css")
 @Styles.Render("~/Content/maincss.css")

here is a code in HTML in body in end

 @Scripts.Render("~/Content/Jquery.js")
 @Scripts.Render("~/Content/mainjs.js")

here is i have used made a Bundles in BundleConifig.cs

Bundles.Add(new ScriptBundle("~/Content/Jquery.js").Include(
                "~/Content/plugins/jquery-1.8.3.min.js",
                "~/Content/plugins/jquery-ui/jquery-ui-1.10.1.custom.min.js",
                "~/Content/plugins/boostrapv3/js/bootstrap.min.js",
                "~/Content/plugins/breakpoints.js",
                "~/Content/plugins/jquery-unveil/jquery.unveil.min.js",
                "~/Content/plugins/jquery-scrollbar/jquery.scrollbar.min.js",
                "~/Content/plugins/jquery-block-ui/jqueryblockui.js",
                "~/Content/plugins/jquery-numberAnimate/jquery.animateNumbers.js",
                "~/Content/plugins/pace/pace.min.js",
                "~/Content/plugins/bootstrap-select2/select2.min.js",
                "~/Content/plugins/jquery-validation/js/jquery.validate.min.js",
                "~/Content/plugins/jquery-datatable/js/jquery.dataTables.min.js",
                "~/Content/plugins/jquery-datatable/extra/js/dataTables.tableTools.min.js",
                "~/Content/plugins/datatables-responsive/js/datatables.responsive.js",
                "~/Content/plugins/datatables-responsive/js/lodash.min.js"
             ));
            Bundles.Add(new ScriptBundle("~/Content/mainjs.js").Include(
                "~/Content/js/datatables.js",
                "~/Content/js/messages_notifications.js",
                "~/Content/js/core.js",
                "~/Content/js/demo.js",
                "~/Content/js/validations.js"
                ));
            Bundles.Add(new StyleBundle("~/Content/plugins.css").Include(
                "~/Content/plugins/pace/pace-theme-flash.css",
                "~/Content/plugins/bootstrap-select2/select2.css",
                "~/Content/plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.css",
                "~/Content/plugins/boostrap-checkbox/css/bootstrap-checkbox.css",
                "~/Content/plugins/boostrapv3/css/bootstrap.min.css",
                "~/Content/plugins/boostrapv3/css/bootstrap-theme.min.css",
                "~/Content/plugins/font-awesome/css/font-awesome.css",
                "~/Content/plugins/jquery-scrollbar/jquery.scrollbar.css",
                "~/Content/plugins/jquery-datatable/css/jquery.dataTables.css",
                "~/Content/plugins/datatables-responsive/css/datatables.responsive.css"
             ));
            Bundles.Add(new StyleBundle("~/Content/maincss.css").Include(
                "~/Content/css/animate.min.css",
                "~/Content/css/style.css",
                "~/Content/css/responsive.css",
                "~/Content/css/custom-icon-set.css"
            ));
            BundleTable.EnableOptimizations = true;

I have also added a code in web.confg under <system.webServer> is

<modules runAllManagedModulesForAllRequests="true">
            <remove name="BundleModule" />
            <add name="BundleModule" type="System.Web.Optimization.BundleModule" />
        </modules>  

here is a issue it was showing below in screenshot

enter image description here

How can i fix this issue..

I have website with 2 languages (English and Arabic).Every language has different URL like that:

/en/Account/Register in English language.

/ar/الحساب/تسجيل in Arabic language.

I used two ActionLinks in _MainLayout to switch between two languages and it works well but i want if the URL in the browser is /en/Account/Register and i replaced "en" with "ar" and pressed enter the page reloaded in Arabic and URL become /ar/الحساب/تسجيل .How to do that?

Code in layout:

@{
                    var routeValues = this.ViewContext.RouteData.Values;
                    var controller = routeValues["controller"] as string;
                    var action = routeValues["action"] as string;
}
 <ul>
                    <li>@Html.ActionLink("English", @action, @controller, {culture="en"}, new { rel= "alternate" , hreflang= "en" } )</li>
                    <li>@Html.ActionLink("Arabic", @action, @controller, {culture="ar"}, { rel="alternate" , hreflang= "ar" })</li>
                </ul>

RouteConfig code:

Note: RoutingTranslations is table in database containing all routing urls of website in two languages

public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //Build up routing table based from the database.  
            //This will stop us from having to create shedloads of these statements each time a new language, controller or action is added
            using (RoutingEntities db = new RoutingEntities())
            {
                List<RoutingTranslations> rt = db.RoutingTranslations.ToList();
                foreach (var r in rt)
                {
                    routes.MapRoute(
                        name: r.LanguageCode + r.ControllerDisplayName + r.ActionDisplayName,
                        url: r.LanguageCode + "/" + r.ControllerDisplayName + "/" + r.ActionDisplayName + "/{id}",
                        defaults: new { culture = r.LanguageCode, controller = r.ControllerName, action = r.ActionName, id = UrlParameter.Optional },
                        constraints: new { culture = r.LanguageCode }
                    );

                }
            }

            routes.LowercaseUrls = true;

            routes.MapRoute(
              name: "Errors",
              url: "Error/{action}/{code}",
              defaults: new { controller = "Error", action = "Other", code = UrlParameter.Optional }
              );

            routes.MapRoute(
              name: "DefaultWithCulture",
              url: "{culture}/{controller}/{action}/{id}",
              defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
              constraints: new { culture = new CultureConstraint(defaultCulture: "en", pattern: "[a-z]{2}") }
              );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { culture = "en", controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }

CultureConstraint Class:

public class CultureConstraint : IRouteConstraint
    {
        private readonly string defaultCulture;
        private readonly string pattern;

        public CultureConstraint(string defaultCulture, string pattern)
        {
            this.defaultCulture = defaultCulture;
            this.pattern = pattern;
        }

        public bool Match(
            HttpContextBase httpContext,
            Route route,
            string parameterName,
            RouteValueDictionary values,
            RouteDirection routeDirection)

        {
            if (routeDirection == RouteDirection.UrlGeneration &&
                this.defaultCulture.Equals(values[parameterName]))
            {
                return false;
            }
            else
            {
                return Regex.IsMatch((string)values[parameterName], "^" + pattern + "$");
            }
        }
    }

CultureFilter Class:

public class CultureFilter : IAuthorizationFilter
    {
        private readonly string defaultCulture;

        public CultureFilter(string defaultCulture)
        {
            this.defaultCulture = defaultCulture;
        }

        public void OnAuthorization(AuthorizationContext filterContext)
        {
            var values = filterContext.RouteData.Values;

            string culture = (string)values["culture"] ?? this.defaultCulture;

            CultureInfo ci = new CultureInfo(culture);

            Thread.CurrentThread.CurrentCulture = ci;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(ci.Name);
        }
    }

Below is code which displays an accordion on my ASPX page:

When an item within the accordion is clicked, that panel expands as expected. This panel contains a number of ASP controls (buttons, etc.). When the button is clicked, the code-behind is executed successfully.

However, the page is also refreshed, and the accordion is closed.

How do I stop the accordion being closed, while still being able to execute the code behind?

<div class="panel-group" id="accordion">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">News</a>
                            </h4>
                        </div>
                        <div id="collapseTwo" class="panel-collapse collapse">
                            <div class="panel-body">
                                <!--Update News Section-->
                                <div class="col-md-12">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            <h3>Post Latest News</h3>
                                        </div>

                                        <div class="panel-body">
                                            <div class="col-lg-12">
                                                <textarea id="myTextarea" runat="server"></textarea>
                                            </div>
                                            <asp:Button Text="Save" OnClick="btnSaveNews_Click" ID="btnSaveNews" runat="server" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

Here is the Code-Behind also:

    protected void btnSaveNews_Click(object sender, EventArgs e)
{
    String strConnString = System.Configuration.ConfigurationManager.ConnectionStrings["BallinoraDBConnectionString1"].ConnectionString;
    SqlConnection con = new SqlConnection(strConnString);
    //====== Getting connection string defined in the web.config file. Pointed to the database we want to use.
    //   SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["EmployeeConnection"].ConnectionString);

    //======= Insert Query.
    string cmdText = "INSERT INTO News (News_Content, News_Date) VALUES (@Content, @Date)";

    //====== Providning information to SQL command object about which query to 
    //====== execute and from where to get database connection information.
    SqlCommand cmd = new SqlCommand(cmdText, con);

    //===== Adding parameters/Values.
    cmd.Parameters.AddWithValue("@Content", myTextarea.Value);
    cmd.Parameters.AddWithValue("@Date", DateTime.Now);


    //===== To check current state of the connection object. If it is closed open the connection
    //===== to execute the insert query.
    if (con.State == ConnectionState.Closed)
    {
        con.Open();
    }

    //===== Execute Query.
    cmd.ExecuteNonQuery();

    //===== close the connection.
    con.Close();

    //===== Clear text from textboxes
    // clearInputControls();

    //===== Bind data to repeater.
    // bindEmployeeDetailsToRepeater();
}

I have a web-site with asp.net web pages on the backend, and javascript with jQuery and bootstrap on the client side. I have a serious issue playing video on safari iPhone and iPad devices. Mostly videos are inside bootstrap carousel. This is the example of the video in page

<div class="resp col-xs-12 col-sm-4 col-lg-3">
        <div class="mob-xs-1x1 mob-hover-style mob-video-style">
            <div class="video- mob" data-autoplay="@IsAutoplay.ToString().ToLower()" data-poster-desktop="@Html.SomeUrl(Image)" data-poster-mobile="@Html. SomeUrl (Image)"
                 data-poster-tablet="@Html. SomeUrl (Image)" data-disable-sound="@DisableSound.ToString().ToLower()">
                <video loop="true" preload="auto " playsinline="playsinline">
                    <source src="@Html. SomeUrl(SomeUrl)"></source>
                </video>
                <div class="poster" style="background: url('@Html. SomeUrl(Image)') no-repeat center center; background-size: cover; display: none;">
                    <img src="" />
                </div>
                <div class="container-wrap">
                    <div alt="loading" class="loading" style="display: none;"></div>
                    <div class="container-flex">
                        @if (ShowButtons)
                        {
                            <div class="controls">
                                <div class="play" data-play="@Html. SomeUrl("/icons/misc/video-playerOn.svg")" data-stop="@Html.SomeUrl("/icons/misc/video-playerOff.svg")">
                                    <img src="@Html.SomeUrl("/icons/misc/video-playerOn.svg")" />
                                </div>
                                <div class="sound" data-on="@Html.SomeUrl("/icons/misc/volumeOn.svg")" data-off="@Html.SomeUrl("/icons/misc/volumeOff.svg")">
                                    <img src="@Html.SomeUrl("/icons/misc/volumeOff.svg")" />
                                </div>
                            </div>
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>

In the client side we have multiple bootstrap carousels in which those videos are playing. All those carousels are in jQuery widgets like

$.widget('sm.someWidget, {

_create: function () { var widget = this; var div = this.element; widget.options.isMobile = window.matchMedia("screen and (max-width: 767px)").matches; widget.options.isTablet = window.matchMedia("screen and (min-width: 768px) and (max-width:999px)").matches; widget.options.iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; widget.options.disableSound = $(div).attr("data-disable-sound") === "true"; if (widget.options.iOS) { widget._hideSound(); } widget._setPoster(); widget._setSrc(); widget.options.isAutoplay = div.data('autoplay'); widget.options.canPlay = false; var playImage = widget._getPlayImage(); playImage.unbind('click'); playImage.bind('click', function(){ if (widget.options.isPlaying) { console.log('stop playing video'); widget._stop(); } else { widget._play(); } }); var soundImage = widget._getSoundImage(); soundImage.unbind('click'); soundImage.bind('click', function(){ widget._sound(!widget.options.soundOn); }); var videoElement = widget._getVideoElement(); videoElement.unbind('canplay'); videoElement.bind('canplay', function(e){ widget._getLoadingIcon().hide(); if (widget.options.isPlaying) { widget._getPosterElement().hide(); } widget.options.canPlay = true; }); var source = videoElement.find('source'); source.bind('error', function (e) { widget._getPlayControl().hide(); widget._getSoundControl().hide(); widget._getLoadingIcon().hide(); }); if (widget.options.isAutoplay && !widget.options.isMobile && !widget.options.isTablet && $(div).is(":visible")) { $(widget.element).show(); setTimeout(function () { widget._play(); }, 150); } else { } widget._setSoundIcon('off'); if(widget.options.disableSound) { widget._sound(true); } else { widget._sound(false); } $(widget.element).show(); widget._getVideoElementNative().addEventListener('ended', function(){ widget._stop(); } , false); if(widget.isPlaying){ widget._getVideoElementNative().addEventListener('pause', function() { widget._stop(); }, false);} widget._getVideoElementNative().addEventListener('webkitendfullscreen', function() { widget._stop(); }, false); },

My problem is that on iPhone and iPad devices video just don’t want to play. When I push play on my custom play button it changes on stop button, but that’s all, video doesn’t play. Can you help me? On the Chrome console i have an error like Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause().