|
You can't. The DropdownList control renders an HTML <select> element, which doesn't support that behaviour.
If you could switch to a TextBox , you could combine it with a <datalist>[^] to provide autocomplete suggestions as the user typed.
Otherwise, any solution will involve using Javascript.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello All,
Wondering why my system is giving me the message: "Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2 ... use a version of the .NET SDK that supports .NET Core 2.2"
I put line numbers below for ease in illustrating where I'm coming from. From what I can tell based on the Package Manager Console (see line numbers 19, 23, 25 and 28 below) I have .NET Core 2.2, am I correct? If I already have .NET Core 2.2, then I wonder what am I missing that is preventing a successful program run?
To make sure I am not missing any detail in showing what I am seeing, I have uploaded the full solution to github shown in the link:
https://github.com/vlmbts/MVCcoreExploreCalifornia/commit/5ef856d8e497518553f641ad9df50a9c2b2db044
If I uninstall then reinstall things in a trial and error fashion hoping that somehow things can get fixed, I can actually do more harm than good, so I do not wish to pretend having significant experience
installing Visual Studio and .NET Core 2.2; instead I'd like to ask the guidance of experts here who have more experience than I do in this area.
1 From Error List Window:
2 Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2.
3
4 From Package Manager Console:
5
6 PM> dotnet --info
7 .NET SDK (reflecting any global.json):
8 Version: 6.0.101
9 Runtime Environment:
10 OS Name: Windows
11 OS Version: 6.3.9600
12 OS Platform: Windows
13 RID: win81-x64
14 Base Path: C:\Program Files\dotnet\sdk\6.0.101\
15 Host (useful for support):
16 Version: 6.0.1
17 .NET SDKs installed:
18 2.1.526 [C:\Program Files\dotnet\sdk]
19 2.2.207 [C:\Program Files\dotnet\sdk]
20 6.0.101 [C:\Program Files\dotnet\sdk]
21 .NET runtimes installed:
22 Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
23 Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
24 Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
25 Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
26 Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
27 Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
28 Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
29 Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
30 Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Thanks in advance for all the help you could give.
|
|
|
|
|
Please don't repost if your question does not appear immediately: all of these went to moderation and required a human being to review them for publication. In order to prevent you being kicked off as a spammer, both had to be accepted, and then I have to clean up the spares. Have a little patience, please!
I've deleted the spare version.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You should probably look at using an updated package, the one you are loading is well out of date and probably not supported.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Thanks for your suggestion I will keep it in mind and make sure I do it as soon as I am able to move to Windows 10. Currently, I do not have much choice except to stick around with Windows 8 whose tools are no longer supported.
As an update, I looked at the error message closer and noticed I am running Microsoft .NET Framework Version 4.7.02053 on Microsoft Visual Studio 2017, using SDK 2.2.207 (from the Microsoft download site Download .NET Core 2.2), and therein I think lies the problem.
I can't believe it skipped my eyes that SDK 2.2.207 has Visual Studio support for Visual Studio 2019 so obviously the SDK I should have installed was SDK 2.2.110 as it is the one carrying Visual Studio support for Visual Studio 2017 not SDK 2.2.207 so it's my bad.
Can I uninstall SDK 2.2.207 and restart and then install SDK 2.2.110 without any problem?
|
|
|
|
|
Hi Good Day,
I have been trying to redirect my http web pages using the rewrite module.
The module works in converting http link to https, but then the converted url path is not as expected.
For example:
original link: http://servername/folder/page_x.aspx
Converted link: https://servername/page_x.aspx
To achieve expected result, updated the rules in web.config file with various combinations of constructing the target url but i have had no luck.
Any tips/direction towards the fix will be really helpful.
|
|
|
|
|
This rule works fine for me:
<system.webServer>
<rewrite>
<rules>
<rule name="RequiresSSL-Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" redirectType="Temporary" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a model as follows:
[Key]
public int pmId { get; set; }
[Required]
public int pmNumber { get; set; }
[Required]
[MaxLength(50)]
public string costCenter { get; set; }
[Required]
[MaxLength(15)]
public string serviceType { get; set; }
[Required]
[MaxLength(50)]
public string destination { get; set; }
[Required]
[MaxLength(50)]
public string workCenter { get; set; }
[Required]
public DateTime creationDate { get; set; }
[Display]
[Required]
public DateTime startDate { get; set; }
[Required]
public DateTime endDate { get; set; }
[Required]
[MaxLength(100)]
public string mainFileName { get; set; }
public DateTime? returnDate { get; set; }
public string? status { get; set; }
[MaxLength(100)]
public string? fileName { get; set; }
public int? uploader { get; set; }
public bool? isDownloaded { get; set; } = false;
public virtual AppUser user { get; set; }
public PM()
{
}
The Foreign Key is id which is Primary Key of the EF Core Identity table. In a form, I need to insert a new row in PM table. I can fill all necessary columns using the following code:
var inputElements = new PM()
{
pmNumber = Convert.ToInt32(adminModel.pmNumber),
costCenter = adminModel.costCenter,
serviceType = adminModel.serviceType,
destination = adminModel.destination,
workCenter = adminModel.workCenter,
creationDate = DateTime.Now,
startDate = DateTime.Now,
endDate = DateTime.Now,
mainFileName = newFileName
};
But, because of relational nature of my tables, I need to specify userId when creating a new row in PM table. How can I set Foreign Key? I can detect userId using Session object but I don't know how to insert it in the table.
modified 19-Dec-21 13:22pm.
|
|
|
|
|
I added the following code to PM model:
public int userId { get; set; }
and changed the navigation property to the following code:
[ForeignKey("userId ")]
public virtual AppUser user { get; set; }
|
|
|
|
|
|
How would we possibly know where you got something?
If you want help, you need to ask better questions.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I think the question deserves an upvote for the depth of thought that went into that question!
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I want to have two ReportViewer controls in my VS project. I have two completely different types of reports and I want to split them between two RepportViewers that would be processed in two ReportViewer.aspx.cs. I have create copies of three files:
ReportViewer1.aspx
ReportViewer1.aspx.cs
ReportViewer1.aspx.designer.cs
in ReportViewer1.aspx.designer.cs I changed this line:
protected global::Microsoft.Reporting.WebForms.ReportViewer ReportViewer2;
In ReportViewer1.aspx.cs I name dthe class like this:
public partial class ReportViewer1
Inside of this class I changed all ReportViewer1 to ReportViewer2.
I also modified ReportViewer1.aspx.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportViewer1.aspx.cs" Inherits="PrismWeb.reports.ReportViewer1" EnableEventValidation="false" %>
rsweb:ReportViewer1 ID="ReportViewer2" runat="server" Height="100%" Width="100%">
Call from UI:
/reports/ReportViewer1.aspx crashes somewhere on the server, cannot fine where.
However, if I call /reports/ReportViewer.aspx with same changes I did in ReportViewer1.aspx then it works fine. I just can't figure out why calling ReportViewer1.asx is not working.
Please note, I am not a c# developer, I might be doing something abviously wrong. Please help.
Thanks
|
|
|
|
|
Quote: crashes somewhere on the server What are the symptoms of that "crash" - any errors reported?
|
|
|
|
|
I use the following code for dependency injection of Register/Login controller. The problem is that I cannot use Repository pattern I have created previously.
private readonly UserManager<AppUser> _userManager;
private readonly SignInManager<AppUser> _signInManager;
private readonly IUserRepository _userRepository;
public HomeController(UserManager<AppUser> userManager, SignInManager<AppUser> signInManager, IUserRepository userRepository)
{
_userManager = userManager;
_signInManager = signInManager;
_userRepository = userRepository;
}
When I run the code, the following error is occured:
Quote: InvalidOperationException: Unable to resolve service for type 'CustomizedIdentity.Repositories.IUserRepository' while attempting to activate 'CustomizedIdentity.Controllers.HomeController'.
modified 6-Dec-21 14:00pm.
|
|
|
|
|
You haven't registered an implementation of your IUserRepository service in your DI container. You need to fix your service registration code to register that service, and any services it depends on.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I am trying to create a site on IIS that can allow users to manually thru their mobile phones (yes they will have access to this internal site), and use their AD username/password to login. Anyone that's valid is allowed in. Once authenticated will present the next page. Plus that next page wouldn't allow them on it unless they are authenticated. Does anyone have any sample ASP.NET Web examples to get me started? Don't usually develop applications within IIS other than HTML pages so looking for any samples to get me started. Having a hard time finding one that isn't how to use Azure online.
|
|
|
|
|
Hi,
I'm creating models for my ASP.NET Core project. I want to use "Code First" approach to create database and tables. Please check these annotations to be correct:
[Required]
[DataType(DataType.Date)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy}")]
public DateTime creationDate { get; set; }
[Required]
[DataType(DataType.Time)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm:ss}")]
public DateTime creationTime { get; set; }
And please tell me that what 0 means inside the curly braces.
|
|
|
|
|
The DataFormatString value is a format string to convert a date to a string in the format shown. The zero gives the position of the data parameter (following the format string) when the format is used, like:
string theDate = string.Format(DataFormatString, someDateTimeValue);
See String.Format Method (System) | Microsoft Docs[^]
|
|
|
|
|
Is data annotation for the time correct?
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm:ss}")]
|
|
|
|
|
I deliberately did not answer that part because I don't know the answer. Does it correspond to the documentation?
|
|
|
|
|
No, I did not find any reference for time format. Can I use String type instead?
|
|
|
|
|
|
I get what you want to do here, which is to create models to match your database perhaps, so each table has a matching model. But your over thinking this, and don't need that much detail. Keep it simple and flexible at first, and only add detail when needed. For some reason Microsoft likes to capitalize the first letter, and will nag you later about the first letter being lower case.
This is an example model in c# to match a DB table or collection. Your example is a like a model used to present data in the view. Even when presenting data in the view, I would keep that simple as well. You want to craft models as simple as possible, and try to make them as reusable as possible to keep models down in count.
public class PORTFOLIOS
{
public string Id { get; set; }
public DateTime TimeStamp { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string CreatedBy { get; set; }
public string UpdatedBy { get; set; }
public DateTime UpdateDate { get; set; }
public string HTML { get; set; }
public string AvatarB64 { get; set; }
public string AvatarName { get; set; }
public string AvatarType { get; set; }
public string AvatarUrl { get; set; }
public int AvatarX { get; set; }
public int AvatarY { get; set; }
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|