We help IT Professionals succeed at work.

ASP.NET

125K

Solutions

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

I need help please.


it_saige helped me with data range question.
It works but I found out it will not work with the following scenario:

              - if I have more than one range in a record.
                 the system will not pull the record. (I want the record to be pulled)
                for example: if I enter in the textbox    (G2000 - G5000)
                the system will not pull it because it has "Not"

               - if the record has " Px Not Between Range (G2000 - G5000)"
                  the system will not pull the record  (I want the record to be pulled)
                  for example: if I enter in the textbox (T20 - T50)
                  it will not pull the record, it will only find it if there is one range in a record.
       

so if the user enter: in the textbox any px or dx range
or
any px or dx in the list
the record should come up

I'm not sure how to fix it.

https://www.experts-exchange.com/questions/29172616/Linq-Data-Range.html


This is it_saige proof of concept.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace EE_Q29172573
{
    class Program
    {
        static void Main(string[] args)
        {
            var attributes = new[] 
            {
                "<br> IF Px IN Actigraphy (0089T,<br>0124T,<br>53860,<br>90620,<br>96904,<br>J2325,<br>M0075,<br>S8040,<br>S8940,)",
                "<br> IF Dx IN 

Open in new window

0
I have a search page that filter data and display the search result.
one of the dropdown list is CommitID




                   list = _unitOfWorkCABusinessRules.RuleDetailRepo.GetAll().ToList();

                    //Filter CommitID
                    if (model.SelectedCommitID != null)
                        list = list.Where(x => model.SelectedCommitID .Any(m => Equals(x.CommitID, m)));



the data in the database looks like this:

Table: RuleDetailRepo
RuleDetailID                       CommitID 
1                                         4534565434, 488573377
2                                         7876545665
3                                         9878787678, 39484723, 494858573
4                                         8475637364
5                                         8374478534, 95574746 

but the dropdown list 
list the data like this: 

                          <select name="SelectedCommitID " class="btn btn-default dropdown-toggle" id="SelectedCommitID " multiple="multiple">

                                        <option value="4534565434">4534565434</option>

                                        <option value="488573377">488573377</option>

                                        <option value="7876545665">7876545665</option>

                                        <option value="9878787678">9878787678</option>

                                        <option value="39484723">39484723</option>

                                       

Open in new window

0
I am new to ASP.NET. I am using ASP.NET core 3.1 and razor page and wondering how to implement stored procudere on it.

So I have tables and stored procedure to insert and select on the sql server management studio. I would like to work with Database approach first, and I just want to insert some records on database and retrieve database table on the web form. My main concern is how do I establish connection using appsettings.json file and call insert,select, or update stored procedure. I have been using stored proc before using ADODB.net to create windows form application but I haven't done anything with ASP.net. So, any help regarding using stored proc with razor pages is highly appreciated. Thank you.
0
To avoid post back I use xmlhttp.open

so far I manage to display text on the bottom of page1 using the called page2

function showMada(str)
{
    xmlhttp.open("GET", "getmada.aspx?q=" + str, true);
    xmlhttp.send();
}
how to change the contents of a specific textbox and a P tag in page1

Thanks
0
Hi Experts!

How do you update the Input element to accept multiple files?

This is in the view:
@Html.TextBoxFor(Model => Model.Something, new { @type = "file",@id= "js-spec-file_", @class = "js-spec-file form-control", @accept = ".pdf, .doc, .docx, .jpg, .jpeg, .png"})

Open in new window

This is what's returned from the browser:
<input accept=".pdf, .doc, .docx, .jpg, .jpeg, .png" class="js-spec-file form-control" id="js-spec-file_0" name="Something" type="file" value="">

Open in new window

To update the input to accept multiple files we'll need to add "multiple" to the Input as in the example:
https://www.w3schools.com/tags/att_input_multiple.asp
<form action="/action_page.php">
  <label for="files">Select files:</label>
  <input type="file" id="files" name="files" multiple><br><br>
  <input type="submit">
</form>

Open in new window

Have tried adding the word "multiple" and it would fail:
@Html.TextBoxFor(Model => Model.Specialty.Something, new { @type = "file",@id= "js-spec-file_", @class = "js-spec-file form-control", @accept = ".pdf, .doc, .docx, .jpg, .jpeg, .png", "multiple" })

Open in new window

error
TIA
0
Hi,

I need to convert this html file attached to classic asp. Please advise how I go about doing so. Thankyou.
sample.txt
0
Hi,

I am parsing an XML file but as this breaks there is no clear way to see at which record this fails, hence I have added a console log each value such as:


   Dim sqlConn = New SqlConnection(ConfigurationManager.ConnectionStrings("ProjectConnectionString").ToString)
        Try
            Dim ds As DataSet = New DataSet()
            ds.ReadXml(Server.MapPath("~/SampleData.xml"))
            Dim dt As DataTable = New DataTable
            'dt.Columns.Add("IDNumber", GetType(Integer))
            dt.Columns.Add("code", GetType(Integer))
            dt.Columns.Add("stage", GetType(String))
            dt.Columns.Add("systemplantreference", GetType(String))
            dt.Columns.Add("equipmentdescription", GetType(String))
            dt.Columns.Add("[level]", GetType(String))
            dt.Columns.Add("location", GetType(String))
            dt.Columns.Add("detailsnotes", GetType(String))
            dt.Columns.Add("duration", GetType(Integer))
            dt.Columns.Add("targetreportdate", GetType(Integer))
            dt.Columns.Add("progress", GetType(Integer))
            dt.Columns.Add("reporteddate", GetType(DateTime))
            dt.Columns.Add("start", GetType(DateTime))
            dt.Columns.Add("[end]", GetType(DateTime))

            Dim dr As DataRow
            For Each _dr As DataRow In ds.Tables(0).Rows
                dr = dt.NewRow

                'dr("IDNumber") = _dr(0)
                'Page.Response.Write("<script>console.log('IDNUMBER: 

Open in new window

0
I have a side project in Web Forms that I want to upgrade to .Net Core and Angular on my own time.  I'm using VS 2019.

1. I'm following this example   https://www.c-sharpcorner.com/article/create-angular-8-application-with-asp-net-core-3-0/

2. I installed npm

3. Installed Angular 9. I see this

ee1.png
4. I created the project. Looking at package.json...why do I see Angular 8? I see this. Is this OK?
ee2.png
0
I am making an ASP.NET webform and have a inline SVG (vector) graphic progression graphic on it I have created.  I have the graphic the way I want it and working.  However, I want to change the colors of the spheres an Lines from grey to yellow to green based on conditionals in the code behind (yet to be built).   I want to set the SVG Circle "fill" property to a variable so I can have the SVG code one time and change the color of the spheres via the variables.   (Instead of listing the same SVG code 3 times, once for each color, and executing the relevant color code based on an "IF" in the ASP code.)

Is there a simple way I can change the inline SVG Circle fill color with a variable instead of hard coding a value?

Thanks,

Page sample:
Page Sample
ASP.NET Code:
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
    
      <style type="text/css">

        /* Set background color of web page */ 
        body {background-color: #F7F7F7;}

      </style>

      <title>Order Progression</title>

</head>

<body>
    
    <form id="frmMfgProg" runat="server">

        <div>

                 <svg viewBox="0 ,0, 100, 100" preserveAspectRatio="xMidYMin slice" width="9%" style="padding-bottom: 92%; height: 1px; overflow: visible">

                     <circle id = "circle1" cx = "50" cy = "50" r = "36" fill = "green" />

                     <text x="30" y="105" fill="black" font-size = "16" font-family = "sans-serif">Order</text>

       

Open in new window

0
Hi

I'm learning EF6 and due to other restrainsts I'm not using the full framework, rather using it to run SQL against the Database.

What I'm trying to do is with the returned dataset, convert an int to an enum.

Is this possible and are the any examples
0
I am diving into MVC and hit a snag.

In my home controller I am populating a ViewBag. Then I am trying to put that into a drop down list

Home controller:

 
string _connectionString = WebConfigurationManager.ConnectionStrings["xxxxxxx"].ToString();

            using (SqlConnection con = new SqlConnection(_connectionString))
            {
                //
                // Open the SqlConnection.
                //
                con.Open();
                //
                // The following code uses an SqlCommand based on the SqlConnection.
                //

            
                SqlDataAdapter _da = new SqlDataAdapter("Select Name from AspNetRoles", con);
                DataTable _dt = new DataTable();


                _da.Fill(_dt);
                
                ViewBag.RoleList = new SelectList(_dt.AsEnumerable());

                
                con.Close();
                
            }

Open in new window


Index.html :
 
@Html.DropDownList("Name", (IEnumerable<SelectListItem>)ViewBag.RoleList, "Select an application", "Name")

Open in new window



My dropdown populates the correct number of rows, however the proper text does not come up=> system.data.datarow is there 6 times

I am sure I am not converting something....can you help me with this easy newbie question?
0
Hello all:

I have a old asp.net web form application I have been tasked to maintain.  I have a Site.Master page that I've added some server controls on.  This page mainly hold a menu bar with links to various other pages. When someone clicks on a link in a specific section of the menu, they are directed to a sub-folder containing other pages.  These pages are not linked to the master page.

So my issue is on these pages that are not linked, I have an asp:label control that I am trying to populate via ConfigurationManager.AppSettings.  The problem is when the page renders, nothing is showing up, not even the span that would've been created with the asp:label.

The purpose of this control is to display what environment the user is in.  I have it on the Site.Master and it works well, but on the individual page that is not associated with the Site.Master, it does not show up.

on Site.Master:
<asp:Label ID="EnvironmentDescr" runat="server" CssClass="environmentDesc" Text="<%$ AppSettings: EnvironmentDescription %>" />

on individual page:
<asp:Label ID="EnvironmentDescrDO20" runat="server" CssClass="environmentDesc" Text="<%$ AppSettings: EnvironmentDescription %>" />

Can someone please let me know what I am doing wrong?  I have other asp:label controls on the individual page and they're all working.

Many thanks for your assistance!

Juan
0
Hi,

I am working on C#, ASP.net application.


I am getting IQueryable<byte[]> from the query.
I need byte[] bytes to pass into the method Read to get the real document.

Please advise the solution


IQueryable<byte[]> AWBFile = from x in repository.Select() where x.OrderCode == ordercode && x.TrackingNumber == trackingNumber select x.AWBimagefile;

byte[] bytes = AWBFile //  Get bytes[] from here
docFromUrl.Read(bytes);

Open in new window


Thanks
0
Could someone please tell me how I can resolve this error? This error that I've been receiving from my Production environment does not tell me exactly where or what page in my ASP.NET web app causes the error:

Invalid URI: The hostname could not be parsed.

at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Web.Util.UriUtil.BuildUriImpl(String scheme, String serverName, String port, String path, String queryString, Boolean useLegacyRequestUrlGeneration)
at System.Web.HttpRequest.BuildUrl(Func`1 pathAccessor)
at System.Web.HttpRequest.get_Url()
at System.Web.Http.WebHost.HttpControllerHandler.ConvertRequest(HttpContextBase httpContextBase, IHostBufferPolicySelector policySelector)
at System.Web.Http.WebHost.Routing.HttpContextBaseExtensions.GetOrCreateHttpRequestMessage(HttpContextBase context)
at System.Web.Http.WebHost.Routing.HttpRouteExceptionHandler.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Open in new window


Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.85 Safari/537.36


Many thanks in advance.
0
public int Calculator(int fristno, int secondno)
        {
            return(fristno + secondno);
        }

this will give int as an element tag. how do I customized that?
0
I am designing an api, which will be called from my front end. say I have a controller method  that calls some other third party api process results and returns json response to the front end ( see sample code below) .

if there is an error in the reques/response and the request is unsucessful to the 3rd party apis, what is best approach. should I return empty json response to the front end , after handling and logging exceptions.

or is it better to send some message so that it can be dealt on the front end. if so can someone share some sample code for this. ?

//get method in some controller
public ActionResult GetData()
{
try
    //call other apis
    //if the response is successful
           return data;
    //if unsucessful
          // ?? what to return to the front end ??
catch
      //log exceptions    
}

front end code ----------------------------------------

$(document).ready(function () {
            $.ajax({
                type: "GET",
                url: "//somecontroller//GetMethod",
                data: param = "",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: successFunc,
                error: errorFunc
            });

            function successFunc(data, status) {    
                           //process json data
            }

            function errorFunc() {
                         //do something
            }
       …
0
Dear Experts
Based on the business processes we have identified solution development to be done in .NET Core framework with  Visual Studio using C# and MSSQL we have decided power BI for reporting and analytics( on-premise power BI report server) but customer have asked if possible to consider PostgreSQL, please help to understand on following
1.Application developing using .NET Core framework with Visual Studio using C# instead of MSSQL for database going for PostgreSQL will there be any complications, limitations and some thing that we have to comprise.
2.If we chose PostgreSQL as database server and front end application .NET Core framework with Visual Studio using C# and develop application but using power BI for reporting and analytics is there going to be any challenges, does power BI has connector to interface with PostgreSQL please let us know ,
Please help on above 1 and 2
0
Hello All:

I have a classic web forms asp (vb) web application that I am working with.  I have one page that I would like to embed a value from my web.config's app.settings.  this page references an external js file.  What I am ultimately trying to do is pass the value from app.settings to the js file on an onclick event.  The app.settings key holds the value of the current server, so I have transforms set to update the web.config with the correct server name when the application runs.

So in my app.settings I have:
<add key="CurrentServer" value="ProductionServer"/>

What I was trying to do was something like this:
<input type="hidden" id ="CurrentServer" value="<%$ AppSettings: CurrentServer %>" />

My reasoning behind this approach is then in the external file, I could target this input by doing something like:

let currentServer = document.getElementById('CurrentServer').value

When I run the page, I receive the following error:
Literal expressions like '<%$ AppSettings: CurrentServer %>' are not allowed. Use <asp:Literal runat="server" Text="<%$ AppSettings: CurrentServer%>" /> instead.

Can someone please steer me in the right direction?  Would a server control be more appropriate?  If so, how would I interrogate the rendered control using JavaScript once the onclick even is fired that triggers the javascript code?

Many thanks for any assistance!

Juan
0
Hi,

How can I make a string from database as a link?

<asp:HyperLink ID="SponsorWebsiteURL" NavigateUrl="XXXXX" runat="server">link</asp:HyperLink>

This is what I use in the page, what is the code to use in code-behind? thank you very much
0
Hi. I have been asked to put a header tag in the ASP.net whose markup is shown below
Part of the tag is shown in the first code piece below and the markup for the page is shown in the second code piece
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GN');</script>
<!-- End Google Tag Manager -->

Open in new window


<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.vb" Inherits="Office2Web._Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

	<section class="p-0">
		<div id="homeCarousel" class="carousel slide" data-ride="carousel">
			<!-- Indicators -->
			<ol class="carousel-indicators">
				<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
				<li data-target="#myCarousel" data-slide-to="1"></li>
				<li data-target="#myCarousel" data-slide-to="2"></li>
			</ol>

			<!-- Wrapper for slides -->
			<div class="carousel-inner">
				<div class="item active">
					<div class="carousel-content">
						<div class="container h-100">
							<div class="row h-100">
								<div class="col-md-6 h-100">
									<h1>Widen your horizons. 

Open in new window

0
HttpContext.Current is null after calling ConfigureAwait(false) in ASP.NET MVC using C#.  How do I resolve this problem.?

Please provide code fix.

Many thanks in advance.
0
C#.MVC What Controller for MP3 Upload Web Service?

I need a web service that accepts an MP3 file and kicks off a series of steps. So, what is the best type of Controller object to use?

And what kinds of configurations will be best for this? Does this require configurations available only through WCF?

Thanks
0
I have a Windows 2016 RDS farm.  In Windows 2012r2 RDS, there was documentation on how to remove the domain name requirement.

So far I have not been able to find in any of the blogs such as RDS Gurus or nedimmehic.org or even on MS forums.

Does anyone know how to remove this in Server 2016?
0
I have a cache object in C# that still has not expired yet, and I want to update the value of its key. How do I do that? This is for an ASP.NET MVC web app.  For example:

UserLogin userLogin = new UserLogin() {
  LoginAttempts = 1,
  DateTimeAttempted = DateTime.Now
};

if (System.Web.HttpContext.Current.Cache["LoginInfo"] == null)
{
   System.Web.HttpContext.Current.Cache.Insert("LoginInfo", userLogin, null, DateTime.Now.AddSeconds(60), TimeSpan.Zero);
}

if (System.Web.HttpContext.Current.Cache["LoginInfo"] != null && UserAuthenticationFailedAgain)
{
   userLogin.LoginAttempts = 2;
   userLogin.DateTimeAttempted = DateTime.Now;
   // Now how do I update the value of this existing cache object's key "LoginInfo" so that the when I access Cache["LoginInfo"].LoginAttempts and Cache["LoginInfo"]. DateTimeAttempted, I get 2 and an updated date time, respectively??  I don't see System.Web.HttpContext.Current.Cache.Update() in docs.microsoft.com
}


Many thanks in advance.
0
Hi
In my ASP.net Site Master whose markup code is shown below I have the following button
     <button class="btn btn-primary" ID="btnGetStarted">Get started</button>
I want to run VB.net code behind this but when I double click on it it does not create a VB.net click event



<%@ Master Language="VB" AutoEventWireup="true" CodeBehind="Site.master.vb" Inherits="Office2Web.SiteMaster" %>

<!DOCTYPE html>

<html lang="en">
<head runat="server">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title><%: Page.Title %> Office2Web Microsoft Office and Web Solutions</title>

    <asp:PlaceHolder runat="server">
        <%: Scripts.Render("~/bundles/modernizr") %>
    </asp:PlaceHolder>

    <webopt:bundlereference runat="server" path="~/Content/css" />
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,700&display=swap" rel="stylesheet">
</head>
<body>
    <form runat="server">
        <asp:ScriptManager runat="server">
            <Scripts>
                <%--To learn more about bundling scripts in ScriptManager see https://go.microsoft.com/fwlink/?LinkID=301884 --%>
                <%--Framework Scripts--%>
                <asp:ScriptReference Name="MsAjaxBundle" />
                <asp:ScriptReference Name="jquery" />
                <asp:ScriptReference Name="bootstrap" />
              …
0

ASP.NET

125K

Solutions

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications