小编Adr*_*rma的帖子

如何使用ASP.Net成员资格提供程序添加额外字段?

我有一个使用ASP.NET成员资格提供程序的基本应用程序 默认情况下,您可以使用一些字段,如用户名,密码,记住我.

如何添加到asp.net成员资格提供程序,以便我可以在寄存器部分添加一个额外的字段"地址"并将其保存到数据库中?

在帐户模型中创建用户时,我目前看到以下内容:

public MembershipCreateStatus CreateUser(string userName, string password,
   string email)
{
   if (String.IsNullOrEmpty(userName))
   { throw new ArgumentException("Value cannot be null or empty.", "userName"); }
   if (String.IsNullOrEmpty(password))
   { throw new ArgumentException("Value cannot be null or empty.", "password"); }
   if (String.IsNullOrEmpty(email))
   { throw new ArgumentException("Value cannot be null or empty.", "email"); }

   MembershipCreateStatus status;
   _provider.CreateUser(userName, password, email, null, null, true,
       null, out status);

   return status;
}
Run Code Online (Sandbox Code Playgroud)

在创建用户功能中,我还想保存用户的"地址".

在register.aspx中,我添加了以下内容:

<div class="editor-label">
    <%: Html.LabelFor(m => m.Address) %>
</div>
<div class="editor-field">
    <%: Html.TextAreaFor(m …
Run Code Online (Sandbox Code Playgroud)

asp.net-membership

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

占位符不在select2中工作

我正在工作Select2 选择框.

问题

占位符未显示select2.它始终显示在中选择的第一个选项select2.它会自动选择我想要显示占位符而不是它的第一个选项.

在此输入图像描述

我的代码:

脚本:

<script type="text/javascript">
    $(document).ready(function () {
       var data = $('#test_skill').select2({
            placeholder: "Please select an skill",
            allowClear: true
       });
    });

// I have also tried this: This is also not working
    $('#test_skill').select2({
      placeholder: {
        id: '-1', // the value of the option
        text: 'Please select an skill'
      } 
    });
</script>
Run Code Online (Sandbox Code Playgroud)

HTML:

<select class="skills_select2" required name="test_skill" id="test_skill">          
    <option value="1">TEST1</option>
    <option value="2">TEST2</option>
    <option value="3">TEST3</option>            
</select>
Run Code Online (Sandbox Code Playgroud)

jquery jquery-select2

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

Typescript错误:当一个类包含初始化属性时,'super'调用必须是构造函数中的第一个语句

我的项目中有以下打字错误.让我分享一个示例,以便您可以看到正在处理的内容.

module CoreWeb {
export class Controller implements IController {
    public $q;
    public $rootScope;
    public $scope:ng.IScope;
    public $state:ng.ui.IStateService;
    public $translate:ng.translate.ITranslateService;
    public appEvents;
    public commonValidationsService;
    public defaultPagingOptions = {
        currentPage: 1,
        pageSize: 10,
        totalServerItems: 0,
        maxSize: 5
    };
    public detailModelName:string;
    public filter:string;
    public listModelName:string;
    public mode;
    public modelDataService;
    public modelDefaultProperty:string;
    public ngDialog;
    public notificationsService;
    public pagingOptions:IPagingOptions;
    public selectionStatus:boolean;
    public serviceCreateFunction:string;
    public serviceGetAllCanceller:ng.IDeferred<any>;
    public serviceGetAllFunction:string;
    public serviceGetOneFunction:string;
    public serviceUpdateFunction:string;
    public showInactive:boolean;
    public tableAction:number;
    public tableActions:ITableAction[];
    public titleDataFactory;
    public validationOptions;
    public validationRules;
    public …
Run Code Online (Sandbox Code Playgroud)

javascript backbone.js angularjs typescript

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

如何重置选择默认值Angular2

我有一个选择第一个选项作为硬编码只是为了显示占位符和对象列表,点击清除我需要重置选择到第一个选项,我不能在这里做,有没有办法??

<select class="form-control" aria-placeholder="Select File" style=" margin-right:5px;padding:0px;width:400px" [(ngModel)]="ddlFileId" (change)="loadFiles($event.target.value)"  [ngModelOptions]="{standalone: true}" >
    <option [value]="''" disabled selected>Select File</option> // this will appear like a place holder
    <option *ngFor="let file of AllFileIDS" [value]="file.FileID" [ngValue]="file.FileID">{{file.FileID}}</option>
</select>
Run Code Online (Sandbox Code Playgroud)

我试过了

  this.ddlFileId = "";
Run Code Online (Sandbox Code Playgroud)

我的尝试

  • 使数据源为空并重新分配
  • 给了一个值,而不是""[(ngmodel)]
  • 我甚至添加了一个标志,并尝试将其分配给[选定]它仍然无法正常工作

有什么方法除了使这个字典成为一个字典并添加第一个对象与设置禁用属性作为它的标志?,这就是我现在正在计划的.

其他SO问题对我没有帮助

angular

8
推荐指数
1
解决办法
8434
查看次数

Angular-DataTables自定义过滤器

我正在尝试使用服务器端处理为angular-DataTables添加自定义过滤器,这与排序和内置数据表搜索完美配合.

我正在关注示例Angular-DataTables,构建服务器端处理并设置DataTable,在搜索时我发现了一些信息,但还是无法使其工作.

我想要获得的是checkbox [Player]在触发后用重叠数据重绘表.

有没有人知道这方面的解决方案或有一个工作的例子吗?

已经找到了这个示例自定义表过滤器,但似乎它也不起作用.

HTML:

<div ng-app="showcase"><div ng-controller="ServerSideProcessingCtrl">
<label><input type="checkbox" id="customFilter" value="player"> Player</label>
<table datatable="" dt-options="dtOptions" dt-columns="dtColumns" class="row-border hover"></table>
Run Code Online (Sandbox Code Playgroud)

JS部分:

 'use strict';

    angular.module('showcase', ['datatables'])
            //.controller('ServerSideProcessingCtrl', ServerSideProcessingCtrl);
    .controller('ServerSideProcessingCtrl',["$scope", "DTOptionsBuilder", "DTColumnBuilder", function($scope, DTOptionsBuilder, DTColumnBuilder) {

    //function ServerSideProcessingCtrl(DTOptionsBuilder, DTColumnBuilder) {
        console.log($scope);
        $scope.dtOptions = DTOptionsBuilder.newOptions()
                .withOption('ajax', {
                    // Either you specify the AjaxDataProp here
                    // dataSrc: 'data',
                    url: 'getTableData.php',
                    type: 'POST'
                })
            // or here
                .withDataProp('data')
                .withOption('serverSide', true)
                .withPaginationType('full_numbers');
        $scope.dtColumns = [
            DTColumnBuilder.newColumn('id').withTitle('ID'),
            DTColumnBuilder.newColumn('name').withTitle('First …
Run Code Online (Sandbox Code Playgroud)

datatable datatables angularjs angularjs-filter

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

Angular 8 下拉选择的选项没有显示,怎么会?

这个问题经常被问到。我的情况显然与其他所有情况不同,因为我无法从现有答案中找到解决方案。

我有这个代码:

<form (ngSubmit)="getExceptions(f)" #f="ngForm">
          <div class="row">
            <div class="form-group col-xs-3 col-sm-3">
              <label class="col-form-label" for="aantal">Aantal meldingen per pagina?</label>
              <select name="selectedQuantity" id="aantal" class="form-control" ngModel>
                <option *ngFor="let option of options" [value]="option">{{option}}</option>

              </select>
            </div>
.
.
.
</form>
Run Code Online (Sandbox Code Playgroud)

选项定义为:

private options: string[] = ['10', '20', '50'];
Run Code Online (Sandbox Code Playgroud)

我想将“10”显示为默认选定值,但无论我做什么下拉菜单都会为选定值显示空白。单击下拉列表会显示值 10、20 和 30。因此它已正确填充。

我尝试了什么:

<option *ngFor="let option of options" [value]="option" [selected]="option==10">{{option}}
</option>
Run Code Online (Sandbox Code Playgroud)

<option [value]="10" [selected]="true == true">10</option>
<option [value]="20">20</option>
<option [value]="50">50</option>
Run Code Online (Sandbox Code Playgroud)

<option [value]="10" selected>10</option>
<option [value]="20">20</option>
<option [value]="50">50</option>
Run Code Online (Sandbox Code Playgroud)

它与绑定有关,因为如果我从 select 标记中删除“ngModel”,它会显示我想用作默认值 (10) 的值。有点。我无法再读取选定的值,但显示的是默认值。

我从来没有用 plunkr …

html-select drop-down-menu typescript angular

7
推荐指数
2
解决办法
5万
查看次数

当id在数组中时,linq where子句

我有一个方法,如果UserId在数组中,应该返回用户列表.UserIds数组传递给方法.

我不知道如何在数组中编写... where userid?

下面in ids[]显然不正确.

public List<User> GetUsers(int[] ids)
{
   return Users.Values.Where(u => u.UserID in ids[]).ToList();
}
Run Code Online (Sandbox Code Playgroud)

任何想法如何纠正?

谢谢,

c# linq

6
推荐指数
2
解决办法
4251
查看次数

如何在角度2/4上的表单提交上传递所有选中的复选框值

我想在不使用change()click()函数的情况下获取组件中表单的所有已检查项目,因为它无法获取已经检查过的项目.

这是我在TS中的数组:

  PartyRoles = [
    {
     Id: 1,
     Name: "Vendor",
     Checked: true
    },
    {
      Id: 2,
      Name: "Client",
      Checked: true
    },
    {
      Id: 3,
      Name: "Consigner",
      Checked: false
    }       
  ]
Run Code Online (Sandbox Code Playgroud)

我的HTML表单:

<form (ngSubmit)="editPartyRolesSubmit()">
    <div *ngFor="let item of PartyRoles">
        <label>
        <input type="checkbox" value="{{item.Id}}" [attr.checked]="item.Checked==true ? true : null" [attr.disabled]="item.Id==1 ? true : null" />
        <span innerHTML="{{item.Name}}"></span>
       </label>
    </div>
</form>
Run Code Online (Sandbox Code Playgroud)

我的onSubmit函数,我想要获取所有选中的值:

  editPartyRolesSubmit= function () {
    // Please suggest how to fetch checked items
  }
Run Code Online (Sandbox Code Playgroud)

typescript angular2-forms angular angular4-forms

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

当使用 container="body" 滚动主页时​​,ngx boostrap popover 不会随按钮移动

我正在根据本文档使用 ngx boostrap popover

我需要使用,container="body"因为没有这个,主体样式会影响我的弹出框并被剪掉。但是,在添加此属性后,我遇到了一个新问题。当我单击按钮时,弹出窗口会显示在按钮的后面,这很好。但是,当我滚动主页时​​,弹出框不会随与其关联的按钮一起移动,因此进入分离状态,然后看起来很奇怪。我该如何解决这个问题?

bootstrap-popover angular2-template ngx-bootstrap angular

6
推荐指数
0
解决办法
486
查看次数

无法删除 [object Array] 的属性“1”

Input在我的组件中获取列表:

@Input() usersInput: Section[];

export interface Section {
    displayName: string;
    userId: number;
    title: number;
}
Run Code Online (Sandbox Code Playgroud)

这是值列表:

    0:
     displayName: "???? ???"
     firstName: null
     lastName: null
     title: 0
     userId: 1
   1:
     displayName: "???????? ????????"
     firstName: "????????"
     lastName: "????????"
     title: 0
     userId: 2
Run Code Online (Sandbox Code Playgroud)

ngAfterViewInit我将输入值设置为用户列表:

ngAfterViewInit(): void {
    this.users = this.usersInput;
    if (this.users.length === 0) {
        this.show = false;
    } else {
        this.show = true;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是用户:

users: Section[] = []; 我在 html 列表中使用它:

<div *ngFor="let item of users" class="d-flex …
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular

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