小编who*_*ee1的帖子

MVC3 EditorFor readOnly

我想在编辑页面中使用EditorFor进行readOnly.

我尝试将readonly和disabled设置为:

<div class="editor-field">
        @Html.EditorFor(model => model.userName, new { disabled = "disabled", @readonly = "readonly" })
    </div>
Run Code Online (Sandbox Code Playgroud)

但是,它不起作用.如何禁用编辑此字段?

谢谢.

readonly editorfor asp.net-mvc-3

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

带有确认对话框的MVC3 Actionlink

我可以显示确认消息ActionLink吗?

我需要使用javascript吗?没有它可能吗?

你能给我一些例子吗?

谢谢.

//I want to make a confirmation message appear before the link opens.
@Html.ActionLink("Checkout and view order list", "Order", "Order")
Run Code Online (Sandbox Code Playgroud)

confirmation asp.net-mvc-3

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

ASP.NET MVC 3 EntityType没有定义键

我想显示客户信息.然后我创建了一些类; 客户,交货,订单,OrderLine,产品和rentalDB.rentalDB类设置产品,客户,订单,OrderLine和交付的5 DbSet.当我使用列表视图创建UserController时,我无法显示客户信息,并且它会出错:

One or more validation errors were detected during model generation:
System.Data.Edm.EdmEntityType: : EntityType 'OrderLine' has no key defined. Define the key for this EntityType.
System.Data.Edm.EdmEntityType: : EntityType 'Delivery' has no key defined. Define the key for this EntityType.
System.Data.Edm.EdmEntitySet: EntityType: EntitySet ?OrderLine? is based on type ?OrderLine? that has no keys defined.
System.Data.Edm.EdmEntitySet: EntityType: EntitySet ?Delivery? is based on type ?Delivery? that has no keys defined.
Run Code Online (Sandbox Code Playgroud)

我不知道为什么这些实体需要密钥?我不知道这个错误..你能帮帮我吗?

--UserController.cs--

namespace MvcApplication2.Controllers
{
public class UserController : Controller
  { …
Run Code Online (Sandbox Code Playgroud)

asp.net entity asp.net-mvc-3

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

Oracle查询多个表

我正在尝试显示有义务的志愿者信息以及分配的性能.我想显示这些信息.但是,当我运行查询时,它没有收集相同性能的不同日期.且availability_date也是混乱的.这是正确的查询吗?我不确定这是正确的查询.你能给我一些反馈意见吗?谢谢.

在此输入图像描述

查询就在这里.

SELECT Production.name, performance.performance_date, volunteer_duty.availability_date, customer.name "Customer volunteer", volunteer.volunteerid, membership.name "Member volunteer", membership.membershipid
FROM Customer, Membership, Volunteer, volunteer_duty, duty, performance_duty, performance, production
WHERE  
Customer.customerId (+) = Membership.customerId AND
Membership.membershipId = Volunteer.membershipId AND
volunteer.volunteerid = volunteer_duty.volunteerid AND
duty.dutyid = volunteer_duty.dutyid AND
volunteer_duty.dutyId = performance_duty.dutyId AND
volunteer_duty.volunteerId = performance_duty.volunteerId AND
performance_duty.performanceId = performance.performanceId AND
Performance.productionId = production.productionId
Run Code Online (Sandbox Code Playgroud)

- 已添加图片 - 结果: 在此输入图像描述

oracle

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

具有特定日期的Android闹钟设置

我想在特定日期通知通知.然后我现在正在使用带有NotificationManager的AmarmManager.当我从dateDialog设置所选日期时,警报正在运行.如何在固定时间内将日历值设置在闹钟设置上?我希望每天在固定时间重复闹钟,例如早上9点.目前,警报忽略了特定日期的时间.你可以帮帮我吗?非常感谢.

confirmButton.setOnClickListener(new View.OnClickListener() 
    {
        public void onClick(View v) {
            //set alarm with expiration date                
            am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
            setOneTimeAlarm();
            Toast.makeText(fridgeDetails.this, "Alarm automatic set", Toast.LENGTH_SHORT).show();
            setResult(RESULT_OK);
            finish();
        }
        public void setOneTimeAlarm() {
        c.set(Calendar.HOUR_OF_DAY, 10);
        c.set(Calendar.MINUTE, 0);
        c.set(expiredYear, expiredMonth, expiredDay);
        Intent myIntent = new Intent(fridgeDetails.this, AlarmService.class);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(fridgeDetails.this, 
                        0, myIntent, PendingIntent.FLAG_ONE_SHOT);
        am.set(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pendingIntent);

        }
    });


private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() 
{
    public void onDateSet(DatePicker view, int year, int monthOfYear,
            int dayOfMonth) {
        expiredYear = year;
        expiredMonth = monthOfYear; …
Run Code Online (Sandbox Code Playgroud)

android calendar alarmmanager notificationmanager

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

ASP.NET MVC 3在SQL Server 2008的模型中显示十进制值(18,1)

我在模型上设置了十进制值的问题.在我的SQL服务器中,displaySize字段类型是十进制(18,1)如何在模型中设置小数类型?

当我设置时

 public decimal displaySize { get; set; }
Run Code Online (Sandbox Code Playgroud)

它显示为21.00而不是21.如果我放3.7,那么它出来3.70.

如何设置十进制格式?这听起来很简单,但我现在是初学者MVC 3.你能回答一下吗?谢谢.

asp.net decimal asp.net-mvc-3

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

通过LINQ选择十进制值

我试图在MVC3项目中使用LINQ获取十进制值.

我怎么得到它?它看起来很简单,但我不能得到单个十进制值而不是Product.aWeekPrice列表.

我怎样才能得到特定的ThreeDayPrice?获得threeDayPrice之后,它将在if条件中用于给出不同的条件,如下面的代码中所示:

    public decimal GetTotal(decimal price)
    {
        // Multiply product price by count of that album to get 
        // the current price for each of those product in the cart
        // sum all product price totals to get the cart total

        //In select part, I have got error, 'cannot convert type 
        //'System.Linq.IQueryable<decimal>' to 'decimal'

        decimal threeDayPrice = (from cartItems in db.Cart
                              where cartItems.cartId == ShoppingCartId
                                 select (decimal)cartItems.Product.threeDayPrice);

        decimal aWeekPrice = (from cartItems in db.Cart
                                 where cartItems.cartId == ShoppingCartId
                                 select …
Run Code Online (Sandbox Code Playgroud)

.net linq entity-framework linq-to-sql

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

PHP move_uploaded_file无法在公共服务器上运行

我正在尝试将我的php项目上传到公共服务器.我在创建产品或编辑产品时制作了图片上传文件.它在localhost中工作,但是当我移动到公共服务器时,它不起作用.我认为move_uploaded_file部分不起作用.我该如何更改链接?还是我必须改变什么?当我看到Filzilla时,我可以看到它是'/ www/eshopProject/inventory_images'的远程站点.索引文件是'/ www/eshopProject/storeAdmin'.我必须像这样更改链接吗?我不知道如何更改链接.你可以帮帮我吗?将图像上传到公共服务器不起作用..是否存在安全问题?或者其他的东西?请帮我.谢谢.

--index.php--

$pid = mysql_insert_id();
//Place image in the folder
$newname = "$pid.jpg";
move_uploaded_file($_FILES['fileField']['tmp_name'], "../inventory_images/product_$newname");
Run Code Online (Sandbox Code Playgroud)

php upload image

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

PHP与打印或回显的href链接

我有关于php字段中的herf链接的快速问题.当我尝试使用echo或print在php字段中创建href链接时,它不起作用链接.你能简单地看一下代码吗?谢谢!

if(isset($_SESSION["manager"])){
    echo "<div id=\"login_link\">
            Welcome Admin!<br>
            <a herf=\"storeAdmin/admin_logout.php\">Log out</a>
            </div>"; 
    }
Run Code Online (Sandbox Code Playgroud)

php href echo

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