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

Share tech news, updates, or what's on your mind.

Sign up to Post

How do use "document.getElementById(StgElementName)" in C#, I tried the following but not working.

                        HtmlGenericControl myControl1 = (HtmlGenericControl)FindControl(StgElementName);
                        myControl1.InnerText = stgElementContent;
0
Exploring ASP.NET Core: Fundamentals
LVL 19
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Hi,

I need your help!!

My javascript:
 var URLname2 = document.location.href.match(/.*\/(.*)$/)[0];

the variable "URLname2" generate this path below
"http://localhost:00000/BusinessRules/Rule/1"

what I want for the "var URLname2" is to pull just the word "Rule" from the whole path

I'm not sure how this is done, but I tried Substring and didn't work. 

Thank you so much for your help, 
Lulu50

Open in new window

0
ASP.NET Web Page rendering single-quote as ’

How do I fix???
0
Hi Experts,
i'm getting following datetime output but how to ignore when sending to the
SQL server. becuase SQL server genearion error message

01/01/0001 00:00:00

Sql error :
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
0
so on a btn click I have this code:  not getting any errors but it's not transferring to the database:

 if (rd.HasRows)
                    if (rdshop.HasRows)
                        if (rdoper.HasRows)
                        {
                            SqlConnection uptime = new SqlConnection();
                            uptime.ConnectionString = ConfigurationManager.ConnectionStrings["gcerp"].ToString();
                            uptime.Open();
                            cmd.CommandText = "Insert into [_lcclockfil](empId, shift, clockin, ord_no, item_no, oper_no, oper_desc) values('" + TxtEmp.Text + "', '" + TxtShift.Text + "','" + TxtTime.Text + "', '" + TxtShop.Text + ",'" + TxtSHOPItem.Text + "','" + TxtOp.Text + "','" + TxtOpDesc.Text + "')";
                            uptime.Close();
                            Response.Write("<script>window.alert('Complete')</script>");
                           
                            TxtEmp.Text = "";
                            txtfullname.Text = "";
                            TxtShift.Text = "";
                            TxtShop.Text = "";
                            TxtOp.Text = "";
                            TxtOpDesc.Text = "";
                        }
                        else
                        { Response.Write("<script>window.alert('Did Not Update')</script>"); }
            }
0
I am trying to build a small web application in ASP.net that texts our employees when we have an urgent message that we need to distribute.  My idea is that someone with the authority to send one of these messages will login, create a message, and send it.  I have been able to send messages successfully if name a single mobile number to a variable, or even when I assign multiple numbers to an array.  Of course I don't want to go to the code to add/remove numbers, so I have a database with the numbers in it.

This is the part that is frustrating me is that I don't know how to get my data from SQL into my application.  The closest I have gotten appears to assign the current location to my array, I am not even sure how that is happening.

[EDIT: the data I am trying to get from SQL is a single column of integers representing phone numbers.]

Here is my code asking SQL for data:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace ProjectASPudemy.Pages
{


    public partial class Comms : Page
    {
        private const string cs = "Data Source=ElRando\\SQLE;Initial Catalog=Inventory;Integrated Security=True";
        private const string sql = "SELECT CellPhone, LastName FROM Employees WHERE CellPhone IS NOT NULL AND CurrentEmployee = 1";
        private const int V = 0;

        protected void Page_Load(object sender, 

Open in new window

0
Hi Guys!!!

I'm new to MVC C# coding and I really need your help.

I have a left menu that I want to be populated from my database and I'm not sure how to do it.

Thank you in advance for taking the time to help me with this.

I have two tables a parent table and a child table 

Parent table called: RuleSet

RuleSetID       |     RuleSet                 |    CreatedDate   |     CreatedBy 
1                             Blended                      11/12/2019            Y000001
2                             OSCMain                     11/12/2019            Y000001
3                             Questionnaire            11/12/2019            Y000001

Child table called: RuleIdentifier

RuleIdentifierId    |    RuleSetId    |    RuleIdentifier            |      CreatedDate   |    CreatedBy
1                                     1                       Blended_00010                 11/12/2019            Y000001
2                                     2                       OSCMain_0049                  11/12/2019           Y000001
3                                     2                       OSCMain_0010                  11/12/2019           Y000001
4                                     2                       OSCMain_0122                  11/12/2019           Y000001
5                                     1                       Blended_0234                    11/12/2019           Y000001
6                                     3                       Questionnaire_02 

Open in new window

0
Hi

I am trying to publish a web app that I built for a client. When I try to publish I get the following error. Where do I find this password in Azure?
1
0
Hi Expert,
Can you help me to find out where i'm doing mistake or how to call this and also I used  newtonsoft

Following way i have tried to Deserialize Json. The results from REST services working fine
(candidateResults) i iwll get the data.

 var jcCandidate1 = JsonConvert.DeserializeObject<List<candidateDetails>>(candidateResults);

also i tried
 var jcCandidate1 = JsonConvert.DeserializeObject<List<candidateDetails>>(candidateResults);

Open in new window



all classes  created according to Json Results. (go to Edit special paste -> select Json)

namespace TestConsolApp
{
   
    public class candidateMain
    {
        public candidateDetails[] Property1 { get; set; }
    }

    public class candidateDetails
    {
        public string _id { get; set; }
        public DateTime creation_date { get; set; }
        public string email_address { get; set; }
        public string headline { get; set; }
        public string initial { get; set; }
        public string name { get; set; }
        public string origin { get; set; }
        public string phone_number { get; set; }
        public candidateResume resume { get; set; }
        public candidateSource source { get; set; }
        public candidateStage stage { get; set; }
        //public object[] tags { get; set; }
        public DateTime updated_date { get; set; }
    }

    public class candidateResume
    {
        public string url { get; set; }
    }

    public class candidateSource
    {
        public

Open in new window

0
Hi expert ,
i'm getting following error message

Error Message
foreach statement cannot operate on variables of type 'candidate' because
does not contain a public instance definition for 'GetEnumerator'      

Class
public class candidatesClient : IcandidatesClient
    {
public async Task<candidate> TestsClient(string positionID)
        {
//code working fine
}

}

Method with issue
private async static Task ViewTestDetails(string TestID)
        {

           
            var tClient = new TestsClient();

            var candidate = await tClient.GetCandidates(TestID);

            foreach (var ca in candidate)
            {
            }


        }

Open in new window


Error Message
foreach statement cannot operate on variables of type 'candidate' because
does not contain a public instance definition for 'GetEnumerator'
0
CompTIA Security+
LVL 19
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

I can get Date variable to match sql server date to use in code to find indexed line in database table.  I have tried multiple formatting options - nothing works.  I need to include miliseconds in the vb.net Date format - not in string format.  I use this in a <= operations to compare date to the database.  When it is = it uses that indexed line to include in the charted data.  Everything I have tried gives me date and time without miliseconds.

I have tried the following.

Dim MaxDate As Date = DataTable.Rows(0)(0)
MaxDate = Date.ParseExact(DataTable.Rows(0)(0), "yyyy-MM-ddTHH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture)

I can convert using a string variable, but cannot use string variable in query search for date.
0
Hi Experts,

I have write following code. This code is working fine and geting results.
But only issue is how to return type designing.

 public async Task<List<Positions>> positionDetails(bool onlyCurrent = true)
        {
var results=response.Content;
var pJson = JsonConvert.DeserializeObject<List<Positions>>(results);

retrun ???

}

Open in new window


Any idea really appriciated
0
Hello Experts!

I am working on asp.net application in asp.net technology the application is very old around 10 years back.
I am using this configuration in web.config:

<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="UseCookies" timeout="20" cookieName ="DrainId"/>

As we know that Session hijacking means if someone steal/copy session cookie and paste it another browser then the one can access any inner page of the web application.
how can we stop the session hijacking so that if session cookie is pasted in another browser we can redirect such request to the login page.

 I copied this way the cookie so that I can paste in another browser and open inner page.
0
Hi,

How can I make a sub menu using my table menu?

I need a sub menu to Blended or Inpatient or Outpatient.
They each have a submenu. How can I do that?
This is my left menu.

I want on hover over the word "Blended" to list a submenu

 <table class="table">
                                                <tr>
                                                    <td>
                                                        <a id="RuleMenuDiv" href="../Rule" style="color:#0144af;">Rule</a>
                                                        </td>
                                                </tr>
                                                <tr id="BlendedMenu"> 
                                                    <td style="background-color:#5cb85c; color:#fff;font-weight:bold;">
                                                        Blended
                                                    </td>
                                                </tr>
                                                <tr id="InpatientMenu">
                                                    <td style="background-color:#5cb85c; color:#fff;font-weight:bold;">
                                                        Inpatient
                                                    </td>
                                                </tr>
                                                <tr id="OutpatientMenu">
                                                    <td 

Open in new window

0
I have these tables I want to return ONE row per employee.

Employee
EmployeeId
EmployeeName

UnitJobEmployee
EmployeeId
UnitId
JobId

Unit
UnitId
UnitName

Job
JobId
JobName


The problem is that an employee can have multiple unit/job rows.

So after we get the employee row, currently we look up the unit/job rows and return them as comma delimited strings. One for units, one for jobs.

I'd like to see if it is possible to return that in the original select statement, rather than doing it after the fact when looping through the collection.

So the result would look more like this:

EmployeeId, EmployeeName, UnitsString, JobsString
57                   Joe                        XYZ,               Cashier,
                                                     ABC               Stocker

Any ideas?

Thanks!
0
I have written a page that posts data for a client into the above, It works as part of a new website as the only page (used for testing) when I copy the code or paste the page into the web application I have been developing it for I get an error, I've used Nuget to ensure all the correct dll's are added.

This is the error

"An existing connection was forcibly closed by the remote host
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host"

This line is causing the error:
Dim myresponse As HttpResponseMessage = client.SendAsync(myrequest).Result


Can anyone suggest a solution or reason why the same code fails in one web application but not the other?

Here is the code

Imports System.Net.Http
Imports System.Net.Http.Headers
Imports System.Threading.Tasks
Imports Microsoft.IdentityModel.Clients.ActiveDirectory
Imports Newtonsoft.Json.Linq
Imports System.Collections.Generic
Public Class CRM_Contact
    Inherits System.Web.UI.Page

    Public myclientId As String = Convert.ToString(ConfigurationManager.AppSettings("clientid"))
    Public redirectUrl As String = Convert.ToString(ConfigurationManager.AppSettings("redirecturl"))
    Public serviceUrl As String = …
0
I have a larger site on IIS and now I am planning to add an asp.net web application to one of its folders, like this:

FLD_ROOT
    FLD_TXT
    FLD_APP

where FLD_ROOT is the root of the larger site and FLD_APP is the folder where I plan to deploy the application. In addition, the site contains the FLD_TXT folder.

The application needs to read the text files in FLD_TXT when it starts. It is not possible to include those files with the application (for site maintenance reasons).

My question is, can my application access those files? They are not part of it, but still part of the site. If not, what would be a solution to grant access?
0
I need a multiple selection drop down list that looks similar to this.

I currently use Telerik's but we are doing away with using Telerik.

Does anyone know of another jquery/javascript type of solution that does something like this?

We've been using Select2 for our comboboxes, but it doesn't support this kind of look.
ddl
0
How do I fix a localhost:#### port in use error?  I have several ASP.Net Web Applications.  All load fine in Microsoft Visual Studio 2019; however, two of them present the error and fails to run.

How do I fix this???
0
HTML5 and CSS3 Fundamentals
LVL 19
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

I'm using a select2 multiple dropdownlist. I am getting the above error.
I've seen posts where they say this error occurs if you have two items in the list with the same value, but I do not have that and I also use the "multiple" option.

    <select name = "ctl00$ContentBody$TeamProfileControl$ddlDistrictId" id="ddlDistrictId" Class="ddlSelectMultiple" name="ddlDistrictId" multiple="multiple" style="width:100%;">
    	<option value = "1786" > AP_Test_District</Option>
    	<option value = "209" > Honey Dew South</Option>
    	<option value = "562" > HQ</Option>
    	<option value = "38" > JK&#39;s Crib</Option>
    	<option value = "206" > Kansas City Office</Option>
    	<option value = "759" > Testing District</Option>

    </select>

Open in new window


I also read to add items this way, however, I populate with a sql databind, so using this is not applicable:
DDLModality.Items.Add(Li1)

I need to preselect the previously saved values in the dropdownlist to display them as selected on the screen. Here is my code, it runs with no errors but when the screen is loaded it generates:
Cannot have multiple items selected in a DropDownList.

   Public Sub CheckMultiListBoxNumeric(ByRef ddlDistrictId As DropDownList, ByVal districtIds As String)

        ddlDistrictId.ClearSelection()

        Dim checkedItems As String()
        checkedItems = Split(districtIds, ",")
        Dim selected As List(Of String) = checkedItems.ToList()

        For Each row As String In selected


            If ddlDistrictId.Items.FindByValue(row) IsNot Nothing Then
                ddlDistrictId.Items.FindByValue(row).Selected = True
            End If


        Next

Open in new window

0
Hi I am new to C# core and I come from a VB forms background.  I have been working on a web application project using the latest asp core.  

All i am trying to do at the moment is have a page where you enter a serial number then on leaving that serial number it comes back and displays some additional information from a stored procedure in a grid on the page or it displays an error from the stored procedure.  Then there is another button that will fire another stored procedure that will insert data into a database or return an error on error checks.   If not an error the whole page resets and ready for the next one.

The problem I have been having is that i cannot work out how to fire the stored procedure and return the data after leaving the text box and display an error if needed.  To simply it I have added a button so I enter the serial number then press the button rather than get the on leave event from the text box.

My problem is the data is binded before the page loads with some default data.  I do not know how to do it part of the way through or how to pass a parameter (serial number to it).  I have the ajax to call a function that displays the data from before, but i do not know how to change the lookup to be based on that serial number.  Or in the case of being an error display an error.

My code is below:
Model class:
public class OperationsData
    {

       public string Job { get; set; }
       public string Item { get; set; }
       public 

Open in new window

0
How do you reset a Microsoft ASP.NET Application?  I have the following files:

*.master
global.asax
*.aspx
web.sitemap
*.aspx.vb
web.config

I want to use the files I have and start all over.  Is this doable?  If so,  how???
0
Need to get value of webpage URL (with query string parameters, without, and only string with parameters)
Thank you in advance.
0
In Visual Studio or asp.net is there a way to track a programmer's productivity -- lines of code created or altered and time spent in the project actively working/ debugging/ etc.?

We use Team Explorer for our code repository, so perhaps there is a way to use that.

I've looked at an example of a coding tracker and it seemed to only handle it locally for the local person to see. I'd like something perhaps handled in Team Explorer by the checked in developer.

I once worked for a company that had a tracker like that, but not visual studio related, and at the end of a quarter they would have a % productive and level of difficulty the person did in their coding.

Is there such a thing available anywhere for .NET programming?


thanks!
0
Hi,
Question: I wanted to host my web application developed in React.js and asp.net core 2.2 WebAPI with unlimited SQL Server 2012 (or higher) databases support. Which shared hosting plan best suites this requirement?
Please help
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