小编Ort*_*und的帖子

正确实现IDisposable

在我的类中,我实现IDisposable如下:

public class User : IDisposable
{
    public int id { get; protected set; }
    public string name { get; protected set; }
    public string pass { get; protected set; }

    public User(int UserID)
    {
        id = UserID;
    }
    public User(string Username, string Password)
    {
        name = Username;
        pass = Password;
    }

    // Other functions go here...

    public void Dispose()
    {
        // Clear all property values that maybe have been set
        // when the class was instantiated
        id = 0; …
Run Code Online (Sandbox Code Playgroud)

.net c# garbage-collection memory-leaks memory-management

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

名称在当前上下文中不存在

所以,我正在我的笔记本电脑和桌面之间进行这个项目.

该项目在笔记本电脑上运行,但现在已将更新后的源代码复制到桌面上,我在项目中有500多个错误,所有错误都是......

该名称在当前上下文中不存在

这是一个例子......

Jobs.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Members/Members.master" AutoEventWireup="true" CodeFile="Jobs.aspx.cs" Inherits="Members_Jobs" %>

<%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" TagPrefix="aj" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel runat="server" ID="upJobs">
        <ContentTemplate>
            <!-- page content goes here -->
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)

Jobs.aspx.cs

public partial class Members_Jobs : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadJobs();
            gvItems.Visible = false;
            loadComplexes();
            loadBusinesses();
            loadSubcontractors();
            loadInsurers();

            pnlCallback.Visible = false;
            pnlInsurer.Visible = false;
        }
    }

    // more goes down …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

45
推荐指数
5
解决办法
32万
查看次数

为什么我的网站上的撇号和连字符等符号会被黑色钻石取代?

我制作的网站有一些问题...在其中一个页面上,无论哪里有撇号(')或破折号(-),该符号都会被一个奇怪的黑色钻石所取代,并在其中心带有问号

这就是我的意思
屏幕

看来这种情况发生在整个网站上,无论这些符号出现在哪里.我以前从未见过这个,有人可以向我解释一下吗?

关于如何解决它的建议也将非常感激.

请参阅http://test.rfinvestments.co.za/index.php?c=team以清楚地了解问题.

html character-encoding

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

表单提交后$ _FILES为空

我正在使用标准的PHP函数来上传文件,以用作PHPMailer的附件.

<form name="upload" method="post" action="send_form_email3.php">
    <div width="100%" class="con3">
        <div class="lable">
            <label for="first_name">First Name *</label>
        </div>
        <input  type="text" name="first_name" id="first_name" class="span4">

        <div class="lable">
            <label for="email">Email Address *</label>
        </div>
        <input  type="text" name="email" id="email" class="span4">

        <div class="lable">
            <label for="telephone">Contact Number *</label>
        </div>
        <input  type="text" name="telephone" id="telephone" class="span4">

        <div class="lable">
            <label for="comments">Message *</label>
        </div>
        <textarea  name="comments" rows="8" id="comments" class="span4"></textarea>

        <div class="lable">
            <label for="upload">Send Us Your CV *</label>
        </div>
        <input type="file" name="upload" id="upload" />

        <input type="submit" value="Submit" class="btn btn-success">
    </div>
</form>
Run Code Online (Sandbox Code Playgroud)

此表单将提交给以下php处理程序,其中构建并发送邮件:

<?php

    require_once("class.phpmailer.php");

    $first_name …
Run Code Online (Sandbox Code Playgroud)

php file-upload

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

带有帖子名称永久链接的HTTP 404

好的,我只是在这个网站上创建了第一页.它在我使用默认永久链接设置时有效.

如果我更改永久链接设置以使用帖子名称,那么我会得到一个HTTP 404.

我不确定出了什么问题,或者我是否已经破坏了什么.任何人都可以帮我解决?

该网站托管在apache上.

页面存在,链接被破坏

wordpress permalinks

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

使用实体框架对Gridview进行排序.

我有一个方法

private void BindGrid()
{
    dataContext = new VTCEntities();
    string SortExpression = "DisplayName";
    string SortDirection = "ASC";
    int skip = 0;

    if (this.ViewState["SortExp"] != null)
    {
        SortExpression = this.ViewState["SortExp"].ToString();
    }

    if (this.ViewState["SortOrder"] != null)
    {
        string d = this.ViewState["SortOrder"].ToString();
        if (d == "ASC")
        {
            SortDirection = "ASC";
        }
        else
        {
            SortDirection = "DESC";
        }
    }

    if (CurrentPage != 0)
    {
        skip = CurrentPage * PageSize;
    }

    if (SortDirection == "ASC")
    {
        this.grdCustomers.DataSource = dataContext.CustomerSet.OrderBy(i => i.DisplayName).Skip(skip).Take(PageSize);
    }
    else
    {
        this.grdCustomers.DataSource …
Run Code Online (Sandbox Code Playgroud)

asp.net gridview entity-framework

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

在WPF中使用FolderBrowserDialog的DialogResult

我第一次在WPF中实现FolderBrowserDialog并且我不喜欢它...

除了我已经弄清楚我的项目中没有引用Windows.Forms的问题,现在我在查看DialogResult返回值是什么时遇到了麻烦......

使用OpenFileDialog,过去我已经这样做了:

OpenFileDialog ofd = new OpenFileDialog();
Nullable<bool> result = ofd.ShowDialog();

if (result == true)
{
    // all went well, carry on and do your thing here
}
Run Code Online (Sandbox Code Playgroud)

不幸的是,我现在得到的错误是关于从DialogResult类型转换为bool以及任何有你的转换.

在WPF中使用对话框似乎无法找到关于如何完成此步骤的任何内容,任何人都可以解决一些问题吗?

提前致谢!

编辑

这是我的代码修改后没有类型转换错误.我不确定要检查什么价值result.通常我会使用,DialogResult.OK除了在这里没有显示为有效值.

    private void btnBrowse_Click(object sender, RoutedEventArgs e)
    {
        if (cmbTemplate.SelectedItem == "Blockbusters")
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            DialogResult result = fbd.ShowDialog();

            //
            // ERROR: 'System.Nullable<bool>' does not contain a definition for 'OK'
            // and no extention method 'OK' accepting a first argument …
Run Code Online (Sandbox Code Playgroud)

c# wpf folderbrowserdialog

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

日历扩展程序无法正确显示

我在我的页面上使用了ajax日历扩展程序控件,虽然扩展程序块正确显示,但它的内容却没有:

CalendarExtender的屏幕截图

这是我用来将其写入页面的代码:

<table class="tblForm">
    <tr>
        <td valign="top">
            <asp:TextBox runat="server" ID="txtPickupDate" AutoPostBack="true"></asp:TextBox>
            <aj:CalendarExtender runat="server" ID="calPickup" TargetControlID="txtPickupDate" Format="yyyy-MM-dd">
            </aj:CalendarExtender>
        </td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

没有任何样式规则直接应用于CalendarExtender,但我确实有这个css可能是相关的:

.tblForm
{
    display: block;
}
.tblForm td
{
    width: 245px;
    float: left;
}
Run Code Online (Sandbox Code Playgroud)

谁看过这个吗?有谁知道它可能是什么?

在此先感谢您的帮助!

编辑
我已经尝试删除浮动,虽然这修复了CalendarExtender,但它也会移动容器表中的每个单元格不对齐.我也尝试过设置clear: both;CalendarExtender,但这会让它的背景消失.

asp.net-ajax calendarextender

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

无法在WPF中编辑Textblock内容

我正在处理我的第一个WPF应用程序,我注意到我无法编辑任何文本块中的文本值.

我似乎在这里找不到任何会阻止我改变它的错误......

<Label Content="Line Terminator" Grid.Row="0" Grid.Column="0" Margin="5"></Label>
<Border BorderThickness="1" BorderBrush="LightBlue" Grid.Row="0" Grid.Column="1" Margin="5">
    <TextBlock x:Name="txtLineTerm" Focusable="True" IsManipulationEnabled="True" Padding="3"></TextBlock>
</Border>
<Label Content="Field Terminator" Grid.Row="0" Grid.Column="2" Margin="5"></Label>
<Border BorderThickness="1" BorderBrush="LightBlue" Grid.Row="0" Grid.Column="3" Margin="5">
    <TextBlock x:Name="txtFieldTerm" Focusable="True" IsManipulationEnabled="True" Padding="3"></TextBlock>
</Border>
Run Code Online (Sandbox Code Playgroud)

有谁能看到这个问题?我觉得这里有一个我缺少的概念.任何解释将不胜感激.

wpf xaml textblock

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

从存储过程输出最后插入的主键值

我对这个问题有点困难,因为我不确定如何在SQL Server中执行此操作.

基本上,我想在数据库中插入一个新行,获取刚刚插入的PK值(相同的查询)并将其输出回任何称为存储过程的行:

CREATE PROCEDURE Users_Insert
    -- Add the parameters for the stored procedure here
    @userid int output,
    @name varchar(50),
    @surname varchar(50),
    @email varchar(200),
    @password varchar(50),
    @location varchar(50)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    insert into Users(FirstName, LastName, Email, Password, Location)
    values(@name, @surname, @email, @password, @location);
    GO
    @userid = @@IDENTITY;
END
Run Code Online (Sandbox Code Playgroud)

我在MySQL中完成了以下操作:

CREATE PROCEDURE Users_Insert(@userid int output, @name varchar(50), …
Run Code Online (Sandbox Code Playgroud)

sql sql-server stored-procedures output-parameter

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