Click here to Skip to main content
14,771,400 members
Home » Discussions » ASP.NET
   

ASP.NET

 
AnswerRe: How I can insert data into gridview without use data source??? Pin
ZurdoDev3-Jan-20 7:30
professionalZurdoDev3-Jan-20 7:30 
GeneralRe: How I can insert data into gridview without use data source??? Pin
Nowiglah4-Jan-20 7:16
MemberNowiglah4-Jan-20 7:16 
AnswerRe: How I can insert data into gridview without use data source??? Pin
ZurdoDev4-Jan-20 8:46
professionalZurdoDev4-Jan-20 8:46 
QuestionError: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl) Pin
Member 24584672-Jan-20 21:41
MemberMember 24584672-Jan-20 21:41 
AnswerRe: Error: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl) Pin
ZurdoDev3-Jan-20 7:32
professionalZurdoDev3-Jan-20 7:32 
GeneralRe: Error: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl) Pin
Member 24584677-Jan-20 18:13
MemberMember 24584677-Jan-20 18:13 
QuestionASP .NET list of text boxes not aligning properly Pin
Member 1462055328-Dec-19 17:23
MemberMember 1462055328-Dec-19 17:23 
AnswerRe: ASP .NET list of text boxes not aligning properly Pin
Member 1462055329-Dec-19 2:38
MemberMember 1462055329-Dec-19 2:38 
QuestionASP.Net MVC: How to print raw model in razor view Pin
Mou_kol24-Dec-19 23:19
MemberMou_kol24-Dec-19 23:19 
AnswerRe: ASP.Net MVC: How to print raw model in razor view Pin
F-ES Sitecore25-Dec-19 10:17
mveF-ES Sitecore25-Dec-19 10:17 
QuestionallowDefinition='MachineToApplication' beyond application level Pin
kuldeeps2117-Dec-19 5:53
Memberkuldeeps2117-Dec-19 5:53 
AnswerRe: allowDefinition='MachineToApplication' beyond application level Pin
Richard Deeming17-Dec-19 6:07
mveRichard Deeming17-Dec-19 6:07 
QuestionScrape with htmlagilitypack problems Pin
Member 175325016-Dec-19 7:02
MemberMember 175325016-Dec-19 7:02 
AnswerRe: Scrape with htmlagilitypack problems Pin
Richard Deeming16-Dec-19 9:41
mveRichard Deeming16-Dec-19 9:41 
GeneralRe: Scrape with htmlagilitypack problems Pin
Member 175325018-Dec-19 12:22
MemberMember 175325018-Dec-19 12:22 
QuestionASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Mou_kol15-Dec-19 10:33
MemberMou_kol15-Dec-19 10:33 
AnswerRe: ASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Richard Deeming16-Dec-19 9:30
mveRichard Deeming16-Dec-19 9:30 
GeneralRe: ASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Mou_kol24-Dec-19 22:14
MemberMou_kol24-Dec-19 22:14 
GeneralRe: ASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Richard Deeming7-Jan-20 9:09
mveRichard Deeming7-Jan-20 9:09 
QuestionHow do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 22:39
MemberMarc Hede12-Dec-19 22:39 
AnswerRe: How do I change this code using Inheritance? Pin
Richard MacCutchan12-Dec-19 23:15
mveRichard MacCutchan12-Dec-19 23:15 
AnswerRe: How do I change this code using Inheritance? Pin
phil.o12-Dec-19 23:23
mvephil.o12-Dec-19 23:23 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 23:57
MemberMarc Hede12-Dec-19 23:57 
GeneralRe: How do I change this code using Inheritance? Pin
phil.o13-Dec-19 0:26
mvephil.o13-Dec-19 0:26 
Marc Hede wrote:
"Person does not contain a constructor that takes 0 arguements"
The Person class has a single constructor accepting a string value as argument. Defining a constructor also means that the class does not have any default parameterless constructor. Since the KeyCard class inherits from Person, it has to provide its base class a name argument (so that the base class can be constructed).
There are several solutions to this:

  1. you can define a parameterless constructor in the base class.
  2. you can delete defined constructor in base class (so that compiler generate a default, parameterless one); but this "solution" is not really clever.
  3. you can provide a default name argument in KeyCard's constructor.

In clear:
#region Solution 1 : Defining a parameterless constructor

public class Person
{
   // ...
   public Person() : this("unnamed") { }
}

#endregion

#region Solution 3 : providing a default name in inherited classs' constructor

public class KeyCard : Person
{
   // ...
   public KeyCard(int mykey) : base("unnamed")
   {
      // ...
   }

   // and/or

   public KeyCard(string name) : base(name)
   {
      this.Mykey = -1;
   }

   public KeyCard(string name, int mykey) : base(name)
   {
      this.Mykey = mykey;
   }
}

#endregion


Marc Hede wrote:
"mykey does not exist within current context"
The compiler does not how to differentiate the mykey parameter of the constructor from the protected mykey field. You can either rename one of them, or just define an auto-implemented property and get rid of the protected field:
public int Mykey { get; set; }


Marc Hede wrote:
"method must have a return type"
Probably because you defined the KeyCard class inside the Person class, and then defined a KeyCard constructor inside Person (which is incorrect). Please get the KeyCard class out of the Person (you do not need to nest inheriting classes), and put constructors and methods in the class to which they properly belong.
Good work Smile | :)
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."


modified 13-Dec-19 5:32am.

GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede13-Dec-19 0:49
MemberMarc Hede13-Dec-19 0:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.