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

In my javascript I want to check if a button is enabled or disabled. how can i do that.
0
I have a pop up screen with save and cancel button.
When the user clicks on cancel button I want to do the following

if (allconditionstrue)
{
show confirm message box.
if the user clicks yes , close the pop up
if user clicks no, close the message box and keep pop up open.
}
else
{
close pop up
}
0
Editing an ASP.Net webpage.

Everyone, We are trying to edit this webpage, please see the attached images.
This is a checkout page and we are trying to put the "Zip Code" text box on the same
line as the "City and State" text boxes. We want to move the highlighted box which is
the zip code box, one row up to be on the same line as "city" and "state". The "State"
text box is the "Drop Down" box. I also included the image with the Code. I know a little bit of HTML and CSS, but nothing really about ASP.Web Page DesignWeb Page Source
Thanks in advance for your help.
0
I am working on an ASP.NET application.

The Design window of VS2019 does not render correctly CSS3, like grid or flexbox. Or it only understands the old CSS. (?)

While this may not be important (one can view page in browser), still I may be missing some setting... Is there a way or option I can set for CSS3 in VS2019?
0
Hello Experts,

I have an issue with C# List, when I add values it showing the duplicates data.

using System;
using System.Collections.Generic;

public class Program
{
	public static void Main()
	{
		Student std = new Student();
		List<Student> studentList = new List<Student>();
		
		std.ID = 1;
		std.Name = "John";
		studentList.Add(std);
		
		
		std.ID = 2;
		std.Name = "Doe";
		studentList.Add(std);	
		
		
		Console.WriteLine(studentList.Count);//count
		
		Console.WriteLine(studentList[0].ID); //ID
		Console.WriteLine(studentList[0].Name); //Name
	}
}

public class Student
{ 
	public int ID { get; set; }
	public string Name { get; set; }
}

Open in new window


Output:
2
2
Doe

The count was correct, but I was expecting below output and the list shows duplicates:

2 -- >Count
1 --> ID
John -- > Name

Please help, what I was doing incorrect.

Thanks,
ASPDEV
0
My HiddentFields are getting document.getElementById are not working as expected inside javascript in asp.net. Everytime I tried set a value for hidden field I get the following error

Uncaught TypeError : Cannot ready property 'value" of null


In the below code there is a javascript function loadfile().
This is the line where i am getting the error : document.getElementById("hAction").value = "";
if I move past that error the next step where i have to read/update value for a variable I am getting the above mentioned error. So looks like somewhere the variables are not getting set correctly

Here is my aspx code :

<%@ Page Language="C#"  MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeBehind="A.aspx.cs" Inherits="A" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ MasterType VirtualPath="~/MasterPage2.master" %>

<asp:Content ID="Content2" ContentPlaceHolderID="CP1" runat="Server">


<meta http-equiv="Pragma" content="nocache">
<meta http-equiv="Expires" content="-1">
<title>Account Exception Upload</title>
<%--<script type="text/javascript" src="ccr_scripts.js"></script>--%>
<script type="text/javascript" src="/apps/jfunctions.js"></script>
<script type="text/javascript" src="/apps/jquery-1.11.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="/apps/commonStyles.css" />

<script type="text/javascript">

var timerID = -1;

function cancelProcessing()
{
	if (confirm("Are you 

Open in new window

0
hiii im using crystal report in my web application in which i have a main report and a subreport my problem is that in my subreport i have passed a store procedure which except parameter @relationid so in code behind i have used this code to set that parameter value which is  

rpt.SetParameterValue("@relationid", documentId, rpt.Subreports[0].Name.ToString());

i have linked subreport with main report parameter but im getting this error  which is attached below  any solution thanks in advance
Capture.PNG
0
Hello Experts,

I'm new to MVC and JQuery web development. I'm trying to bind the data to my datatable using JSon object. Below is the sample code:

View
<div id="mdlMsg" class="modal fade" tabindex="-1" role="dialog">
            <div class="table-responsive m-t-40">
                <table id="dtData" class="display nowrap table  dataTable" cellspacing="0" width="100%">
                    <thead>
                        <tr>
                            <th>Col1</th>
                            <th>Col2</th>
                        </tr>
                    </thead>
                    <tbody id="tblbody"></tbody>
                </table>
            </div>
        </div>

Open in new window


Controller
public async Task<ActionResult> Test()
{
 string resp = "";
  var msg = new Dictionary<int, string>();
msg .Add(1, 'Row 1');               
msg .Add(2, 'Row 2');       
      resp= Newtonsoft.Json.JsonConvert.SerializeObject(msg, Newtonsoft.Json.Formatting.Indented);
return resp;
}

Open in new window


Javascript
$.ajax({
        type: 'post',
        url: url,
        processData: false,
        contentType: false,
        data: files,
        success: function (resp) {
 $('#mdlMsg').modal({ show: true })
                var jsonTst = $.parseJSON(resp);
                $('#dtData').dataTable({
                    "bAutoWidth": false,
                    "aaData": jsonTst.data,   //this is your JSON object, which is what is showing in your post above with console.log(data)
                    "aoColumns": [{
                        "jsonTst": "Col1"
                    }, {
                            "jsonTst": "Col2"
                    }]
                });
});

Open in new window


The modal popup shows with no data and also I want to fix my Modal popup to be middle of the page.

Thanks,
ASPDEV
0
I save a class with various properties into a the current user session like this :
    Public ReadOnly Property UserSession As cUserSession
        Get
            If HttpContext.Current.Session("UserSession") Is Nothing Then
                HttpContext.Current.Session.Add("UserSession", New cUserSession)
            End If
            Return DirectCast(HttpContext.Current.Session("UserSession"), cUserSession)
        End Get
    End Property

Open in new window

I would like to save details in the class to a database before the session is lost.  If I rely upon Session_End in global.aspx, the object is already lost when I go to save it.  I tried to implement idisposable in the cUserSession but this didn't fire.  Whilst I can see how I can manually save the contents of the session by user action or property change, I would like to only do that when the session is about to be lost.

Is this achievable?

Thank you,
0
We have a vendor installed site on a local server in IIS.  They said the site only works in Chrome.  The site allows tickets to be printed by clicking a button called "PDF" which then generates and downloads a PDF.  For some tickets it works and others get "Failed - Network error".  It's not random, the same ticket either works every time or doesn't.  We can download those same tickets that don't work in Chrome, in Edge and Firefox without issue.  But Edge and Firefox have other view issues so we can't just switch to them.  Everything else within this site works fine in Chrome.  We've already tested disabling AV, UTM services, etc.  Those had no affect.  I'm thinking this issue lies in IIS or the code of the site.
0
Hi

      I am trying to build an html button for an email where the button is wrapped in a table cell using the following code. It isn't working properly as shown in the attached image

      Dim oLinkAccept As String = "http://SteelYard.azurewebsites.net/offers_to_me?oOfferID=" & oNewOfferID & "&oOfferAcceptDecline=Accept"

            oHBody = oHBody & TableCellWrapper("<a href=" & oLinkAccept & " style='padding: 8px 12px; border: 1px solid #006400;border-radius: 2px;font-family: Helvetica, Arial, sans - serif;font-size:   14px; color: #006400;text-decoration: none;font-weight:bold;display: inline-block;' >ACCEPT</a>")

    Function TableCellWrapper(ByVal X As String) As String

        Dim S As String

        S = "<table width = '100%' cellspacing='0' cellpadding='0'>"
        S &= S & "<tr>"
        S &= S & "<td>"
        S &= S & "<table cellspacing = '0' cellpadding='0'>"
        S &= S & "<tr>"
        S &= S & "<td style = 'border-radius: 2px;' bgcolor='#ED2939'>"
        '<a  Class=”link” href="https://www.copernica.com" target="_blank">
        'Click            
        '</a>
        S &= S & X
        S &= S & "</td>"
        S &= S & "</tr>"
        S &= S & "</table>"
        S &= S & "</td>"
        S &= S & "</tr>"
        S &= S & "</table>"



        TableCellWrapper = S

    End Function

Image1.jpg
0
Hi.  I am using the following hyperlink in the html of an email. I now want to include a text box
 in the email body too. I want the user to enter a value in the text box so that when my hyperlink is clicked it uses the value in the text box


  Dim oLinkAccept As String = "http://xxxx.azurewebsites.net/offers_to_me?oOfferID=" & oNewOfferID & "&oOfferAcceptDecline=Accept"

       oHBody = oHBody & "<a href=" & oLinkAccept & ">ACCEPT</a>"
0
If there is not action verb quoted in front of the method, does it mean it accept HttpGet ?

ThxAudioBookManualController
0
I have gridview in my asp.net form. there is an account number column in there which gets populated from a database. I want the entire account number to be masked with "*" and on mouse hover to the account number I want to see the actual account number. Can I please have an example for something like this.
0
What does the line below perform ?

audioServiceMock.Setup(x => x.Update(It.IsAny<Guid>(), It.Is<AudioBook>(ab => ab == audioBook))).Returns(audioBook)
TestCode02.png
0
Any idea what's the mock code in attached file mean ? What does x in #2 perform ?

Thx
TestCode01.png
0
Can anyone explain what the attached code mean ?
TestCode.png
0
Hi

I have inhertited a Reg Ex patter to validate mobile phone numbers.

/^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$/g;

I need to change it to validate an 8 digit number, starting with 2.

Can anyone help please.
0
Hi. I am getting the following error when I try and run my ASP.net web app in debug mode

This site can’t be reached localhost refused to connect.
Search Google for localhost 62054 Invoicing
ERR_CONNECTION_REFUSED
0
I have added some extra fields to the aspnet_user tables, one of the fields is a Boolean - ResetPassword that is set to true when user is first created by the Admin.

When the user logs in if the field is a Boolean is sends user to change password - once the user successfully changes their password I want to update the field to false - how do i update a field in the Identity User table easily ?

Thanks
0
Hello,

I am fairly new to the TFS environment and have tried to load an existing project saved to TFS into my local machine for development.

1. I identified the library and performed a get-latest
2. Entereed NUGET and did a RESTORE-ALL

Afterwards I found that no dll references whatever were restored.
How can I accomplish this on a regular basis?
From my readings it seems that there is no straightforward solution other tha creating a local folder and moving the DLLs into and re-referencing to that folder.

The problem with all of that is that this project was not built from an empty project andf has a lot of boilerplate DLLs (ASP.NET project) that are not used such as ANTLER. So the DLL list is quite long.

Thanks in advance

Charlie
0
Hi everyone,

I am having trouble with dropdown list being empty after a postback.  I am attempting to create a gridview with multiple filters in the headers using dropdowns.  When I select a dropdown and the grid filters, I would like the other dropdowns to only contain values that are left in the grid.  For example, if I choose a state region, I would like the county dropdown to only contain the counties in that region.

The code I have hear is for a very simple test application.  Please take a look and let me know if you have any suggestions.  The filtering part works correctly when I bind the grid on the OnSelectedIndexChanged but the dropdowns will all be empty.  If I do not bind the grid on the OnSelectedIndexChanged, the dropdowns work perfectly.  I just cannot get both to work at the same time.

Thank you,
Eric

[HTML]
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="OnRowDataBound">
        <Columns>
            <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id"></asp:BoundField>
            <asp:BoundField DataField="date" HeaderText="date" SortExpression="date"></asp:BoundField>
            <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone"></asp:BoundField>
            <asp:TemplateField HeaderText="floor_area" SortExpression="floor_area">
                <HeaderTemplate>
                    <asp:DropDownList ID="ddlfloor" runat="server" 

Open in new window

0
I have a common web config connection strings in asp.net / IIS / MS SQL Server Express DB.
When it is on localhost, everything is working. Both file web config & connectionstrings.config file are in the same directory level.

When it is on www.abc.com, the database does not read and have no error message.
Any idea how to fix it?

Web config
<connectionStrings configSource="connectionStrings.config" />

Open in new window


connectionStrings.config file name
<add 
       name="pwrsssdfsadfasdf_connectionstring"  
       connectionString="Data Source=WIN-GB8M3MMasdfasdf6T2M\SQLEXPRESS;Initial Catalog=dbdata;Integrated Security=True;User ID=sa;Password=asdfdsa000!"
       providerName="System.Data.SqlClient"
       />

Open in new window

0
I have the following db string  inside of my web app. The localhost work but the live website does not work. do you know how to fix it?
Both DB/IIS is in the same AWS instance.

 <add name="ConnectionString" connectionString="Data Source=WIN-GB8M3MM6asdfasdT2M\SQLEXPRESS;Initial Catalog=Pwr;Integrated Security=True;"
      providerName="System.Data.SqlClient" />
0
Hi

In ASP.net I am getting the error 0 of 21 Errors with no errors showing I the error list
What do I do to find the errors?
Image1.jpg
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