小编mul*_*123的帖子

dropdownlist selectedvalue

我已经使用web服务创建了一个国家/地区的下拉列表,我正在尝试将下拉列表选项添加到sql数据库中,但是当我在insert语句中使用ddlCountry.SelectedValue执行此操作时,只有下拉列表中的第一个值是出现在桌子上.我应该使用onselectedindexchanged以某种方式存储值吗?我应该使用什么代码?

c# asp.net

5
推荐指数
1
解决办法
3万
查看次数

如何在 Angular 测验应用程序中显示选项 1 的说明?

我正在使用 Angular 开发一个测验应用程序,我需要在选择第一个选项时也显示解释文本(解释显示所有选项,但第一个选项除外)。选择选项1时,解释,即使没有任何,也会返回问题。同样对于问题 1(多项选择),选择选项 1 时会播放错误的声音,但答案是正确的。

di-quiz.component.html 中的代码片段,其中出现了解释文本:

<mat-card-content>
  <scoreboard></scoreboard>

  <section id="question" [class.answered]="answer">
    <span *ngIf="!answer">{{ question?.questionText }}&nbsp;
      <span *ngIf="numberOfCorrectOptions > 1">
        <em>({{ numberOfCorrectOptions }} options are correct)</em>
      </span>
    </span>
    <span *ngIf="answer">{{ explanationText }}</span>
  </section>

  <quiz-question
    [question]="question"
    (answer)="selectedAnswer($event)">
  </quiz-question>
</mat-card-content>
Run Code Online (Sandbox Code Playgroud)

请在此处查看我的 StackBlitz:https ://stackblitz.com/edit/angular-9-quiz-app

感谢您帮助修复这些错误。谢谢你。

angular

5
推荐指数
1
解决办法
406
查看次数

传入字典的ASP.NET MVC模型项是类型的

在我看来,我遇到了这个麻烦的错误:

传递到字典中的模型项的类型为"ContactWeb.Models.ContactListViewModel",但此字典需要"ContactWebLibrary.Contact"类型的模型项.

在这行代码上: @{Html.RenderPartial("Form");}

我在@model ContactWeb.Models.ContactListViewModel这个文件的顶部使用.

这是我的观点:

 @model ContactWeb.Models.ContactListViewModel

 <h2>Edit</h2>

 @{Html.RenderPartial("Form");}

 @using (Html.BeginForm())
 {
    <fieldset>
    <legend>Select roles for this user:</legend>
    <ul>
    @foreach(var role in Model.AllRoles)
    {
        <li><input name="Roles" type="checkbox" value="@role" />@role</li>
    }
    </ul>
    <input type="submit" />
    </fieldset>
}
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc razor asp.net-mvc-3

4
推荐指数
1
解决办法
2973
查看次数

Angular 7 与 iframe 链接

我试图在 iframe 内绑定一个链接 (project.projectUrl),但似乎无法让它工作。我正在尝试将我的 JSON 文件中的 projectUrl 绑定到 iframe src,以便我可以在可能的情况下从模式中动态显示 iframe。请在下面的评论中查看我的代码。

iframe angular

4
推荐指数
2
解决办法
3万
查看次数

如何在导航到新页面之前让 Angular 休眠 5 秒?

快速提问,如何在导航到新页面之前让 Angular 休眠 5 秒?

我正在我的函数中尝试这个,但它似乎不起作用:

setTimeout(() => {
        console.log('sleep');
      }, 5000);
this.router.navigate(['/question', this.getQuestionID() + 1]);
...
Run Code Online (Sandbox Code Playgroud)

javascript angular

4
推荐指数
1
解决办法
7009
查看次数

自动生成确认号码

我需要使用SQL Server 2008自动生成订单确认号并将其显示在网页上.我已经设置了一个名为confirmationnumber的列,并为其分配了一个uniqueidentifier.这是正确的方法吗?

c# sql-server asp.net

2
推荐指数
1
解决办法
2508
查看次数

为什么我的 RxJS 倒计时时钟没有显示?

我正在开发一个 Angular 9 测验应用程序,我正在使用 RxJS 作为倒数计时器(在容器\记分板\时间\time.component.ts 中),但计时器似乎没有显示。stopTimer() 函数应该在计时器停止的秒数上停止计时器。选择正确答案后计时器应停止,并且计时器应在问题之间重置。每个问题经过的时间应保存到 elapsedTimes 数组中。请在 Stackblitz 上的 TimeComponent 中查看我的计时器代码:https ://stackblitz.com/edit/angular-9-quiz-app 。谢谢你。

下面的代码是我第一次用 RxJS 构建倒计时时钟。我最近的代码在 Stackblitz 上。

  countdownClock() {
    this.timer = interval(1000)
      .pipe(
        takeUntil(this.isPause),
        takeUntil(this.isStop)
      );
    this.timerObserver = {
      next: (_: number) => {
        this.timePerQuestion -= 1;
          ...
        }
    };

    this.timer.subscribe(this.timerObserver);
  }

  goOn() {
    this.timer.subscribe(this.timerObserver);
  }

  pauseTimer() {
    this.isPause.next();
    // setTimeout(() => this.goOn(), 1000)
  }

  stopTimer() {
    this.timePerQuestion = 0;
    this.isStop.next();
  }
Run Code Online (Sandbox Code Playgroud)

我在 TimerService 中使用了 stopTimer() 和 pauseTimer(),因此我可以从不同的组件调用它们。

rxjs angular

0
推荐指数
1
解决办法
543
查看次数

Angular 9 + Uncaught ReferenceError:进程未定义

我已将我的应用程序转移到另一台笔记本电脑上,并在控制台中收到此错误。知道为什么会发生这种情况吗?

未捕获的ReferenceError:进程未在对象.../../node_modules/@babel/types/lib/definitions/core.js (vendor.js:133069)在webpack_require (runtime.js:85)在对象.. ./../node_modules/@babel/types/lib/definitions/index.js (vendor.js:135192) 在 webpack_require (runtime.js:85) 在 Object.../../node_modules/@babel/types /lib/builders/builder.js (vendor.js:130507) 在 webpack_require (runtime.js:85) 在 Object.../../node_modules/@babel/types/lib/builders/ generated/index.js ( vendor.js:130871) 在 webpack_require (runtime.js:85) 在 Object.../../node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js (vendor.js:137453) 在 webpack_require (运行时.js:85)

angular

-2
推荐指数
1
解决办法
6635
查看次数

how do I clear Angular reactive form?

I have a mat-radio-group inside my form and I would like to clear the radio button so that nothing is selected for each new question in my quiz app. How do I go about doing this? Here's how my form looks:

<form [formGroup]="formGroup" (ngSubmit)="onSubmit()">
  <ol class="form-group">
    <mat-radio-group formControlName="answer" name="answer" (change)="radioChange($event.value)"
  (click)="question.selectedOption = option">
      <div class="radio-options" *ngFor="let option of question.options">
        <mat-radio-button class="option" [value]="option.optionValue" disableRipple="true"
          [checked]="question.selectedOption == option"
          [ngClass]="{'is-correct': isCorrect(option.optionValue),
                  'is-incorrect': isIncorrect(option.optionValue)}">
          <li>{{ option.optionText }}</li>
Run Code Online (Sandbox Code Playgroud)

radio-button angular angular-reactive-forms

-5
推荐指数
1
解决办法
77
查看次数