小编Dvi*_*ski的帖子

AjaxfileUpload错误

我正在尝试实现一个简单的ajaxtoolkit文件上载控件,每次单击"上传",我得到的都是错误.我尝试在"AjaxFileUpload1_UploadComplete"函数中放置断点但它甚至不会被解雇..(可能是因为上传尚未完成?)我该怎么做才能使它工作?

这是错误: 在此输入图像描述

这是我的aspx:

 <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>

       <asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
            onuploadcomplete="AjaxFileUpload1_UploadComplete" ThrobberID="myThrobber" MaximumNumberOfFiles="10" AllowedFileTypes="jpg,jpeg"/>

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

这是背后的功能:

protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
    {
        string id = "038191904";
        Directory.CreateDirectory(Server.MapPath("~/App_Data/" + id + "/scanned_docs/"));
        string filePath = "~/Member_Data/" + id + "/images/";
        string path = filePath + e.FileName;
        AjaxFileUpload1.SaveAs(Server.MapPath(filePath) + e.FileName);

        //db1.insert_pic_slide(id, path);

    }
Run Code Online (Sandbox Code Playgroud)

c# asp.net

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

Facebook登录引发"应用程序配置不允许给定URL:不允许使用一个或多个给定URL

我知道这个问题已被多次询问,但仍然似乎抛出了这个错误,尽管我尝试了几个url地址.

我试图让Facebook登录通过asp.net MVC应用程序像微软教程 这里.

当我在本地主机上检查它时它工作正常(Facebook中的站点URL设置为:http://localhost:55797/ 但是当我在将应用程序上传到服务器后尝试检查它时,它给了我这个错误:

Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
Run Code Online (Sandbox Code Playgroud)

我的服务器的登录页面是:http://proj.ruppin.ac.il/igroup20/test1/Account/Login.aspx

我尝试在我的Facebook应用设置网站网址中写下以下内容:

*http://proj.ruppin.ac.il/
*http://proj.ruppin.ac.il/igroup20/
*http://proj.ruppin.ac.il/igroup20/test1/
*http://proj.ruppin.ac.il/igroup20/test1/Account/
*http://proj.ruppin.ac.il/igroup20/test1/Account/Login.aspx
Run Code Online (Sandbox Code Playgroud)

但它们都不适合我.

这是我的AuthConfig.cs:

public static void RegisterOpenAuth()
        {
            // See http://go.microsoft.com/fwlink/?LinkId=252803 for details on setting up this ASP.NET …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc facebook facebook-login

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

无法在静态方法内调用Response.Redirect

您好我正在尝试使用aspx页面中的ajax运行webmethod.基本上我想用一个查询字符串重定向到另一个aspx页面,但我想这样做<a href>,因为它是jquery菜单的一部分.

根据我的学习,我只能使用ajax来调用静态webmethods,但我可以从我的静态函数中重定向.

visual studio用红线标记它:"非静态字段方法或属性System.Web.HttpResponse.Redirect(string)需要一个对象引用"

这是ajax调用:

function redirect_to_profile() {
    $.ajax({
        type: "POST",
        url: "personal_profile.aspx.cs.aspx/redirect_to_profile",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (res) {
           alert("success");
        },
        error: function (res, msg, code) {
            // log the error to the console
        } //error
    });
}
Run Code Online (Sandbox Code Playgroud)

这是一个href:

<a  onclick="redirect_to_profile()">Personal Profile</a>
Run Code Online (Sandbox Code Playgroud)

这是personal_profile.aspx中的webmethod

[WebMethod]
public static void redirect_to_profile()
{

    dbservices db=new dbservices();
    string user = HttpContext.Current.User.Identity.Name;
    string id = db.return_id_by_user(user);

    HttpResponse.Redirect("personal_profile.aspx?id="+id);
}
Run Code Online (Sandbox Code Playgroud)

javascript c# asp.net ajax static-methods

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

$(document).ready函数不会启动

我正在构建一个由几个jquery移动页面组成的项目,每个页面都有一个导航栏.

当我查看每个页面时,$(document).ready函数启动良好,但是当我通过导航栏进入页面时它不会启动..也在chrome调试器中我只看到一个html页面(我"我正在查看"在源文件夹中.

当我刷新页面时功能正常

试图用"$(document).ready(function(){"代替:

"$("div [data-role*='page']").live('pageshow',function(event,ui){"正如有人建议的那样

但这不起作用.

那是我加载的第一页:

<!DOCTYPE html> 
<html> 
<head> 
    <title>My Page</title>

    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link href="css/jquery.mobile-1.2.0.min.css" rel="stylesheet" type="text/css" /> 
    <script src="js/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="js/jquery.mobile-1.2.0.min.js" type="text/javascript"></script>
    <link href="css/TableCSSCode.css" rel="stylesheet" type="text/css" />

    <script>

        $(document).ready(function () {



            $.ajax({
                type: "POST",
                url: "getdata.aspx/return_member_list",
                data: "{}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",

                success: function (res) {

                    var parsedData = JSON.parse(res.d);
                    var tableStr = "<table class='CSSTableGenerator'>";

                    $.each(parsedData, function () {
                        tableStr += "<tr><td>" + this.fName + "</td><td>" + this.lName + "</td></tr>";
                    });
                    tableStr …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery jquery-mobile

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

将参数分配给sqldatasource

我正在尝试从SQL Server获取数据并在formview中使用它,但formview控件不会从数据源获取任何数据.

(数据源在页面加载时获取参数)

输出只是:"这里没什么可看的"和一张空表.

这是datasource和formview标签:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:igroup20_test2ConnectionString %>" 
        SelectCommand="SELECT * FROM [member] where ([id] = @idd)">
   <SelectParameters>
       <asp:Parameter Name="idd" Type="String" />
   </SelectParameters>
</asp:SqlDataSource>

<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="id">
   <EmptyDataTemplate>
   There is nothing to see here.
   </EmptyDataTemplate>
   <ItemTemplate>
      <table>
         <tr>
            <td>
               <asp:Label ID="Label1" runat="server" Text='<%# Eval("id") %>'></asp:Label>
            </td>
            <td>
               <asp:Label ID="Label2" runat="server" Text='<%# Eval("f_name") %>'></asp:Label>
            </td>
         </tr>
      </table>
   </ItemTemplate>
</asp:FormView>
Run Code Online (Sandbox Code Playgroud)

这是我的代码背后:

 protected void Page_Load(object sender, EventArgs e)
 {
        SqlDataSource1.SelectParameters.Add("@idd", "077763554");
        FormView1.DataBind();
 }
Run Code Online (Sandbox Code Playgroud)

c# asp.net formview sqldatasource

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

将DateTime插入sql server 2008时的奇怪错误

我正在向sql server插入一个datetime字段.从我的本地电脑,它工作得很好.示例:sql server中的datetime字段为:"2013-07-31 08:00:00.000",但是当我从服务器运行应用程序时,它会切换日期和月份,并将其插入如下:"2013-07-31 15:15:00.000" .

我的相关页面根据今天的日期从sql server加载一些条目.像这样:

public List<act_event> return_event_list(DateTime date) //return all events for spesific date
    {

        List<act_event> event_list = new List<act_event>();

        String date_sql = date.ToString("yyyy-MM-dd");


        using (SqlConnection con = connect("igroup20_test2ConnectionString"))
        {

            using (SqlCommand cmd = create_command(con, "select * from act_events where  '" + date_sql + "'>=(CAST(e_start as DATE)) and '" + date_sql + "'<=(CAST(e_end as DATE))"))
            {
                using (SqlDataReader rdr = cmd.ExecuteReader())
                {
                    while (rdr.Read())
                    {
                        act_event a_event = new act_event();
                        a_event.e_num = Convert.ToInt32(rdr["e_num"]);
                        a_event.name = rdr["e_name"].ToString(); …
Run Code Online (Sandbox Code Playgroud)

c# sql-server asp.net datetime sql-server-2008

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

查询以在sql中剪切varchar

我有下表:

在此输入图像描述

我想剪切p_path中的所有条目并删除"〜\"

sql sql-server sql-server-2008

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