[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

ASP.NET

124K

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

I'm working with JavaScript eventlistener

Right now I have this:

            // ----- Event Listener - TextBox Click -----
            document.getElementById('DataGridA_txtBox1').addEventListener('click', function () {

                // get value of textbox and save in variable
                var x = document.getElementById("DataGridA_txtBox1").value;

                // after clicking in textbox save existing textbox value in hiddenfield1
                document.getElementById('HiddenField1').value = x;

            })
            // ----- Event Listener - TextBox Click -----


The above event listener works fine.
When I click in a Textbox called DataGridA_txtBox1, then the value of the textbox is stored in HiddenField1


What if I have 3 textbox on my page.

The texboxes on my page would be called this:

DataGridA_txtBox1
DataGridA_txtBox2
DataGridA_txtBox3

I only want to have one event listener.

Is there a way so revise my click event so that the click event applies to any textbox whose id starts with DataGridA_txtBox?
0
Become a CompTIA Certified Healthcare IT Tech
LVL 12
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Hi

I have been asked to build a web based calendar in ASP.net. It is for the 2019 year.
I want the current day to be selected on page load.
What is the best way to do this so that it is easy to read on a mobile device?
I was thinking of putting a calendar control at the top of the page and a dropdownlist
below it that shows the days selected on the calendar.
0
I'm using asp.net web forms and visual basic.

On my page i have a ASP Textbox.

I'm using the TextChanged event.

This is my code:

    Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs)


        HiddenField_TextBox1Changed.Value = TextBox1.Text

    End Sub

So when I type some text in the textbox, the textchanged event is saving the value I typed in the textbox, to a hidden field.

What's the equivalent to the TextChanged event of a textbox using JavaScript instead of Visual Basic?
1
What is the correct way to take a ASP.NET web application offline?  Is it necessary to take a web application offline to update dlls, etc.?
0
Need some good technology news sources for .NET Full Stack development and the Microsoft Stack

What are good news sources for me to read and learn about what technologies are coming next and which new technologies are being adopted more that expected or less than expected?

Thanks
0
I have two gridviews in my asp.net application, a parent one and also a child gridview. I am able to bind data to each of these gridviews correctly, but I have been unable to figure out how to get the different events for the child gridview to work. In specific, I need to use the child gridview's rowdatabound event, but I can't seem to figure out how to. I have tried using the following syntax to start the sub:

Protected Sub GridView2_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView2.RowDataBound

This however shows up as an error saying that the "handles clause requires a withevents variable defined in the containing type or one of its base types. I have also tried eliminating the handles part of the syntax and tried to call the code with an "OnRowDataBound" property in the view.ascx of my webpage. This never fires any events.

Thank you for any help or guidance you can offer.

Protected Sub GridView2_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView2.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim label1 As Label = TryCast(e.Row.FindControl("Label1"), Label)
            label1.Text = "this works"
        End If
End Sub

Open in new window

0
I'm using ASP.NET Web Forms and VB

On my page I have a ASP TextBox and a ASP Button

I'm using the TextChanged event for the textbox.

This is my working code for my page

ASP_TextBox_TextChanged4.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ASP_TextBox_TextChanged4.aspx.vb" Inherits="ASP_TextBox_TextChanged4" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
                <td></td>
                <td><asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged" Text="This is a test"> </asp:TextBox></td>
            </tr>
            <tr>
                <td></td>
                <td><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></td>
            </tr>
            <tr>
                <td></td>
                <td><asp:Button ID="Button1" runat="server" Text="Button" /></td>
            </tr>
        </table>
    </div>
        <asp:HiddenField ID="HiddenField1" runat="server" />
    </form>
</body>
</html>

Open in new window


ASP_TextBox_TextChanged4.aspx.vb

Partial Class ASP_TextBox_TextChanged4
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    'TextBox.TextChanged Event
    ' Occurs when the content of the text box changes between posts to the server.
    

Open in new window

0
This works but I wonder if there's another way of writing foreach. If not, I'll keep what I have

var nn = q.Select(x => x.Schedule); //scheudles that don't have authusers attached to them
var p = CurrentContext.Schedules.Select(x => x.AuthUsers.Where(u=> u.ID == user.ID)).ToList(); //list all schedules and their authusers

	foreach (var row in p)
	  {
		foreach (var s in row)
		  {
		    if (s.ID == 72)
			{
				//var f = s.Schedules;
				//var t = f.Select(x => x.AuthUsers);authuser for the schedule

				foreach (var ss in nn)
				{
						
				  var schedId = s.ID;
				  ss.AuthUsers.Add(new AuthUser()
					{
						ID = s.ID
					});
	}
	   }

Open in new window

0
Is React the right technology for me to learn right now?

I am a C#.NET Full Stack developer with some experience in Angular 4.

I've been out of the job market for 9 months as I worked on private projects only tangentially related to web development and social media. But the next job could be me back as a
software engineer or a Sr. Software Engineer, my usual title.

I feel that React is key. What are your thoughts?

How hard might it be for me to do a crash course in React?

What are some good training sites for that?

Thanks.
0
I hope someone can help me with this. Been at this all afternoon. I'l go step by step.

1. I have a table Schedule and AuthUsersSchedule.  For each Schedule row, we can have one or more users in AuthUsersSchedule. There's a FK relationship. Looks like this.
s1.png
s2.png
2. There's an EDMX. I see the Scheudle table in it but the AuthUsersSchedule is a navgiation property. In the code, I can't do dbcontext.AuthUsersSchedule. Looks like this

s3
3. I have a stored proc and I get the Schedules

var param = new SqlParameter() { ParameterName = "searchtext", Value = string.Concat('%',searchText,'%') };
var result = CurrentContext.Database.SqlQuery<SearchAssetModel>("[dbo].[usp_SearchAssets] @searchtext", param).ToList(); 

Open in new window


4. I populate the Scheudle like this

 Schedule = new Schedule()
			  {
				 ID = c.ScheduleId,
				 Sched = c.Sched,
				 MasterLeaseID = c.MasterLeaseID,
                                ......

Open in new window


But how do I populate AuthUsers? How do say.... give all the users in AuthUserSchedule with AuthUserSchedule.ScheduleId = Scheudle.Id.  I did this and getting errors

 Schedule = new Schedule()
			  {
				 ID = c.ScheduleId,
				 Sched = c.Sched,
				 MasterLeaseID = c.MasterLeaseID,
                                ......,
                                 AuthUsers = new AuthUser()
				  {

				 }

Open in new window


s4.png
If it helps, this is the entire code section that I populate Schedule




Open in new window

0
OWASP: Threats Fundamentals
LVL 12
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

I'm using ASP.NET Web Forms.

In a ASP TextBox that holds a string, how do i check if a user typed in the textbox?
Sometimes the textbox might contain a string already on page load. I'm not checking if the textbox is empty.
I want to check if the user typed anything in the textbox.


So on button click if they user typed anything in the textbox

Then set this variable CheckTextBoxTyped = "Yes"

If nothing was typed in the texbox set this variable CheckTextBoxTyped = "No"


Right now i have this:



    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    Dim CheckTextBoxTyped As String

    CheckTextBoxTyped = "Yes"


    CheckTextBoxTyped = "No"

    End Sub
0
Of course, this can't be that hard but I don't know what the project I'm adding is not becoming part of the solution.

I go step by step with screenshots

1. I added a Class Library to the solution. I right clicked on the solution to add it
p1.png
2. I got this message but I clicked Continue
p2.png
3. I saw it in solution and added a reference to it to another project in the solution

p3.png
4. Then I wanted to use the namespace but code couldn't find it
p4.png
5. I went digging in to see what's going on. Read it might be resharper so cleared the cache. Removed the reference, added it back. Compared it with another reference that's added. Then, I opened the project in notepad and saw the path is different You see ..\..\ compared to ..\

<ItemGroup>
    <ProjectReference Include="..\..\CSI.MYxyz.ViewModels\CSI.Myxyz.ViewModels.csproj">
      <Project>{f34226c8-0718-4fdf-a9e1-217e7334b1f3}</Project>
      <Name>CSI.Myxyz.ViewModels</Name>
    </ProjectReference>
    <ProjectReference Include="..\CSI.Myxyz.Shared\CSI.Myxyz.Shared.csproj">
      <Project>{2B09F5F9-AA55-4704-B32F-42F5BFCBD3A7}</Project>
      <Name>CSI.Myxyz.Shared</Name>
    </ProjectReference>
  </ItemGroup>

Open in new window


6. I see all the projects in the solution
p5.png
7. When I look at the Windows Exploere, the project I added it is not there. It's somewhere else. I wonder if this is the cause of my problem for step 4. Why isn't this newly added project where it should be...listed with all other projects? What am I missing? Why can't I reference this namespace? I doubt the location of the project is the reason why I can't reference that namespace

It's not here
p6.png
It's listed in the root

p7.png
0
1. I want to add the compare checkbox under the item. When user checks the checkbox, the image will be added to the bottom  of the comparing area. The following code does not work. Please advise!
2. How to add the Compare link to the comparing area, which will be linked to the page with the four compared products. Click each product and then linked to the product page.  

Thank you!
<%@ Page Language="VB" %>

<script language="vb" runat="server">

Sub Page_Load(sender As Object, e As EventArgs)
Dim strSQL
		
 	-------------
					
</script>

<style>
.empty-border {
  padding-bottom: 100%;
  border: 1px dashed #9c9c9c;
}

#compare-box-products {
  box-shadow: 0 1px 2px 2px rgba(0, 0, 0, .2);
  background-color: #fff;
  position: fixed;
  right: 0;
  bottom: 0;
  width: 558px;
  padding: 10px;
  pointer-events: all;
  display: none;
}

.empty-border {
  width: 110px;
  height: 110px;
}

.compare-image-container img {
  width: 108px !important;
  height: 108px !important;
  border: 1px dashed #9c9c9c;
}


</style>


 
 
<body >










<div class ="grid-top-spa"><asp:Label runat="server" ID="lblMessage" /> </div>

 <asp:DataList ID="compare"
									           CellPadding="0"
                                               CellSpacing="0"
                                               RepeatDirection="Horizontal"
									           borderstyle= "none"
									           GridLines="None"
									           RepeatLayout="Table"
									           RepeatColumns="3"				

Open in new window

1
1. Two years ago, I worked on a project that used Entity Framework and bindind of the data was to the Entity Framework entities (tables). This wasn't flexible, so the architect moved the ViewModels folder out of the project and created a separate project for it. Doing this, we were able to create ViewModels and reference them in the Data Access layer and bind to the ViewModels and not to the Entity Framework entities.

Example If we had a table called Teachers, instead of doing something like IQuerayble<Teachers> , we created a TeacherViewModel and did IQuerayble<TeacherViewModel>

2. Fast forward to now and I'm working on a project that has the same thing; binding to the EF entities and not to ViewModels. If we want to join, for example to two tables, and bring data from both...then I can't just do IQueryable<Teachers>

 3. I want to make sure the change I'm going to make is correct.
  I see a "Shared" project in the solution and this Shared project is referenced in the Data Access layer. I can add the ViewModels here but I'm wondering if I should create a separate ViewModels project (like what I had in the project from two years ago)

Anyone has had this problem?  Should I create a whole new ViewModel project OR use the existing project? I eventually want to remove all the ViewModel classes from the web project and move them either to the Shared folder (if this is the best way to go) or to the new ViewModels project.

p1.png
0
How to accomplish it per the attached image? Beside the textbox there is a arrow dropdown. When user clicks the arrow, it pulls out two textboxes. After the user enters the value and clicks Apply, the value will go to the textbox. Any simple example?
search.jpg
1
The folder name is labeled by ID. If the idProduct is 3, the folder is 3. In folder 3  there are three images, and in folder 4, there are 2 images, but in folder 6 there are 7 images.  

In the coding as below, the images for idproduct 3 and idproduct 4  will be displayed as X (no images) starting from image 4 and image 3 separately. How to modify the coding?  Thank you!

<ul id="carousel" class="jcarousel jcarousel-skin-tango">
<li><a href="#" rel="p1"><img src="images/small/<%=idProduct%>/1.jpg" /></a></li>
<li><a href="#" rel="p2"><img src="images/small/<%=idProduct%>/2.jpg" ></a></li>
<li><a href="#" rel="p3"><img src="images/small/<%=idProduct%>/3.jpg" ></a></li>
<li><a href="#" rel="p3"><img src="images/small/<%=idProduct%>/4.jpg" ></a></li>
<li><a href="#" rel="p3"><img src="images/small/<%=idProduct%>/5.jpg" ></a></li>
<li><a href="#" rel="p3"><img src="images/small/<%=idProduct%>/6.jpg" ></a></li>
<li><a href="#" rel="p3"><img src="images/small/<%=idProduct%>/7.jpg" ></a></li>

  </ul>

Open in new window

0
Hi experts,

I have a .aspx web forms website.

Some users of our site who have an iPhone and are using their web browser on their iPhone get an error. But the error doesn't occurs on every iPhone on some iPhones it works fine.

In this day and age is their a tool you use to test a site so it works ok against all different iOS versions and iPhone web browsers?

In a perfect world I would have an iPhone 6 and iPhone 7 and iPhone 8 and iPhone Xs and launch the web browser on each one to test the site.

But how do you guys test across all mobile platforms?
0
I have an asp.net repeater. I want to search text in the repeater, any text on a row.

I downloaded and installed the jquery.quicksearch.js from github. I hadn't read the part about the project being abandoned and probably wouldn't work. I installed the examples and none of them worked in Chrome.

Can you direct me please to some javascript or jquery or something that searches within a repeater clientside? I don't need to have tables in there, and in fact would prefer not. I just want it to find any of the text that I am searching for and return the row if it does.

thanks!
0
I have a form with a Text Area. I want the text box to automatically be set to display at least 10 rows.

 <div class="col-xs-12">
                        @Html.TextAreaFor(x => x.notes, new
                   {
                       @class = "form-control",
                   })
</div>
0
Exploring SQL Server 2016: Fundamentals
LVL 12
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

I have an object that I'm trying to return the following value but I'm having some issue with my syntax... my object x contain a property StationActivity that also contain a set of 8 more property that I would like to access let say productUsed that is part of the stationActivity.  Please see screen attached. What is the best way to do this?

My Problem is I have this following model, I can get access to the customerNumber but how can I get access to the StationActivity property list object that is of type StationHistoryReportActivity



public class StationHistoryReportResults : CustomerStations
    {
        public StationHistoryReportResults(CustomerStations parentObj)
        {
            
      
        public int CustomerNumber { get; set; }


        public List<StationHistoryReportActivity> StationActivity { get; set; }
    }

Open in new window


   
  foreach (var x in (List<StationHistoryReportResults>)TempData["excsv"])

                {
                    var data = String.Join(",", new string[] {
                  
                        x.CustomerNumber.ToString()?? string.Empty,
                   
                        x.StationActivity.Select( x => x.ProductsUsed.ToString());

Open in new window


better explanation
0
Add the compare checkbox in the product category page. When users check the checkbox under the item, the item image will be added like the following link. How to accomplish it?

Thank you!
https://www.costco.com/CatalogSearch?dept=All&pageSize=96&keyword=computerhpf1127
1
I have come across this page per the following link.  A button "Add to List" is at the right side of the image. When the user clicks Add to the list button, it will be added to the My List.

The button turns to Remove from the list once Add to List has been clicked.  How to accomplish it? Thank you!

https://www.pcna.com/leeds/en-us/leeds-mobiletech-power/product/7121-50_reg-
1
I have no idea how to make my manager understand that we can't jump into a reskinning of our site. The project was done about 4 yrs ago by some contractors. It's C#, ASP.Net, jQuery. It looks like the  generic ASP.Net out of the box.

I've used Themeforest before and I got this template https://themeforest.net/item/minotaur-angular-admin-dashboard/19319935 

This is what I've suggested:

1. Use the jQuery version of the template to save time and not rewrite the entire code in Angular or something new
2. I am creating a prototype of our site by hardcoding some pages
3 . Current code uses Grid.MVC and I want to replace them with DataTables
4. Spme code clean up is probably needed
5. I wanted to add Leaflet.js Heatmap or map but my manager doesn't have a clear direction on this
6 . Wanted to do charts but no clear direction on this either
7. I want a project plan

This is my manager
1. I have the landing page and side menu in the prototype. He only looked at these and said we're ready to go
2. Explained to him that Grid.MVC with DataTables but he thinks it's just replacing the grids with no much coding
3. He says he doesn't want the prototype to be a 6 months project

This is what my developer friend says

1. Your manager doesn't care about a plan. He just wants to do it and you're not going to change his mind
2. Document everything so when it fails you have documentation
3. In the end he's the boss, if you don't agree with him after …
1
Is there server specific coding needed for Web.config files  where the website is uploaded to a Windows server? Believe it or not; “Verio; my website hosing company does not know which version of Windows Server they are using --  they only know that it is Windows server!” Please look at my web config file and let me know if anything stands out.

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <httpRuntime targetFramework="4.5" />
    <compilation debug="true" targetFramework="4.5" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove 

Open in new window

0
I have a jquery grid.  When a row is selected, I load a div with a page returned from a controller, using $("divTarget").load("/Mycontroller/Edit/123").  this works perfectly the first time and the data is stored to the database.  I reload the grid and the change is there, but when I click the row again to edit the same record, the controller isn't even called!

Any help appreciated.
1

ASP.NET

124K

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