小编Moh*_*sin的帖子

从typeahead中选择一个值显示Objec对象

我正在处理单页应用程序并使用Angular-TypeAhead当我在文本框中写东西时它向我显示建议但是当我选择建议时,文本框的值变为Object object而不是名称

这是我的HTML标记

<div class="bs-example" style="padding-bottom: 24px;" append-source>
    <form class="form-inline" role="form">
      <div class="form-group">
        <label><i class="fa fa-globe"></i> State</label>
        <input type="text" class="form-control" ng-model="selectedState" ng-options="state.FirstName for state in states" placeholder="Enter state" bs-typeahead>
      </div>
    </form>
  </div>
Run Code Online (Sandbox Code Playgroud)

这是我的AngularJS代码

var app = angular.module('mgcrea.ngStrapDocs', ['ngAnimate', 'ngSanitize', 'mgcrea.ngStrap'])

        .controller('TypeaheadDemoCtrl', function ($scope, $templateCache, $http) {

            $scope.selectedState = '';

            $http.get('/api/servicesapi/GetAllClients')
            .then(
                function (result) {
                    //success
                    $scope.states = result.data;
                },
                function () {
                    //error
                });

        });
Run Code Online (Sandbox Code Playgroud)

看到这里的图像

在此输入图像描述 在此输入图像描述

angularjs bootstrap-typeahead angular-ui-typeahead

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

将html属性传递给Html.Actionlink帮助函数

我想知道如何将html属性传递给@Html.ActionLink辅助函数

我想这样做

<a class="accordion-toggle" data-toggle="collapse" data-parent="#leftMenu" href="/Admin/UserManagment">
                    <i class="icon-user"></i>User Managment
                </a>
Run Code Online (Sandbox Code Playgroud)

如何传递italic html属性

asp.net-mvc asp.net-mvc-4

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

两次之间的时间间隔为一小时

我有两次喜欢

Time A:09:00 AM
Run Code Online (Sandbox Code Playgroud)

并且Time B:06:00 PM 我想时间A与时间B中的总时间和用时1小时EG的时间跨度表现出来:

09:00 AM

10:00 AM

11:00 AM

12:00 PM

upto

06:00 PM
Run Code Online (Sandbox Code Playgroud)

c# datetime timespan

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

在调试模式下获取正确的值,在使用串行编程的释放模式下出错

我创建了一个软件,它从RFID标签读取值,并通过串行端口连接到计算机.当我在调试模式下运行程序时,会收到正确的值,但是当我在发布模式下运行它时会显示一个不同的值.

RFID在调试模式下发送的值是\n00200054476720D\r\n,但是当我在发布模式下运行时,它以小块显示值,或者有时显示空值后跟该代码.

这是我的代码:

    try
    {
         _port2.PortName = "COM" + doorport_txt.Text;
         _port2.BaudRate = 9600;
         _port2.Parity = Parity.None;
         _port2.DataBits = 8;
         _port2.StopBits = StopBits.One;
         _port2.DataReceived += DoorPortDataReceivedHandler;
         _port2.ReadTimeout = 2000;
         if (!_port2.IsOpen)
    {
         _port2.Open();
    }
    MessageBox.Show(@"Door Port is Ready", @"Information", MessageBoxButtons.OK, 
MessageBoxIcon.Information);
    }
        catch (Exception ex)
        {
        MessageBox.Show(ex.Message, @"Error", MessageBoxButtons.OK,
     MessageBoxIcon.Error);
        }

    private void DoorPortDataReceivedHandler(object sender, 
SerialDataReceivedEventArgs e)
    {
        var sp = (SerialPort) sender;
        string indata = sp.ReadExisting();
        CheckTheft(indata);
    }
Run Code Online (Sandbox Code Playgroud)

c# serial-port

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

通配符sql日期查询

我正在研究一个项目并坚持一个sql query,查询不会给出任何错误,也不会返回任何结果告诉我问题在哪里

SELECT
      barcode
    , Date
    , timein
    , timeout
    , totaltime
    , leave
    , remarks
FROM TimeSheet
WHERE barcode = @barcode
     AND Date LIKE '@year-07-%'
Run Code Online (Sandbox Code Playgroud)

我在运行时传递变量中的2个值,@barcode @year 但如果我在sql编辑器中显式运行查询值类型,它可以正常工作并返回值

如果运行这个

SELECT
      barcode
    , Date
    , timein
    , timeout
    , totaltime
    , leave
    , remarks
FROM TimeSheet
WHERE barcode = 123456
     AND Date LIKE '2013-07-%'
Run Code Online (Sandbox Code Playgroud)

它返回值

sql sql-server asp.net

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

根据下拉列表的值显示asp.net日历控件中的月份

什么是从下拉列表中选择月份名称然后在asp.net日历控件中显示月份的方法我已经尝试了很多但没有成功

在此输入图像描述

附图是为了更好地理解

asp.net asp.net-controls

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

获取c#中的记录总数

我试图在运行以下查询时获取记录总数:

var cmd =new SqlCommand("SELECT * FROM Issue where BookID = @bid and IssueDate = @idate order by IssueDate desc", conn);
cmd.Parameters.AddWithValue("bid", bookid);
cmd.Parameters.AddWithValue("idate", DateTime.Now);
int val = cmd.ExecuteNonQuery();
Run Code Online (Sandbox Code Playgroud)

数据库中有可用的记录,但val始终返回-1.

c# sql-server

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

$ http.get之后视图未在AngularJS中更新

从获取值后REST-API $scope不更新视图

这是我的HTML

<div ng-repeat="s in services1">
<label class="checkbox-inline">
<input type="checkbox" id="{{s.Id}}" name="{{s.Id}}" ng-model="s.IsChecked">
{{s.Name}}</label>
<br/>
</div>
Run Code Online (Sandbox Code Playgroud)

AngularJS控制器

var addMember = [
    '$scope', '$http', function ($scope, $http) {
        $scope.member = [];
        $scope.services1 = [];
        var bid = "";

        //onclick function
        $scope.setId = function(id) {
            $("#processing-modal").modal('show');
            $http.get('/api/Servicesapi/ServicesByBusiness/' + id)
                .then(function (response) { 
                    $scope.services1 = response.data;
                        $("#processing-modal").modal('hide');
                        $("#anm").modal('show');
                        console.log($scope.services1); //this is printing values

                },
                    function() {
                        alert("Error in getting services of this Employee");
                    });
            console.log($scope.services1); //this prints empty array …
Run Code Online (Sandbox Code Playgroud)

angularjs

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