小编Joh*_*ohn的帖子

ASP.NET - 主页面中的更新面板,内容页面中的刷新按钮

我在Master页面中有Update面板:

<asp:ScriptManager id="CartScript" runat="server"></asp:ScriptManager>       
<asp:UpdatePanel id="CartBox" runat="server" updateMode="Conditional">
  <ContentTemplate>
    Košík [ <asp:HyperLink NavigateUrl="~/Account/Login.aspx" ID="ShoppingCart" runat="server" text="" /> ] <asp:LinkButton ID="DeleteCart" runat="server" Text="Vymazat košík" OnClick="ThrowCart_Click" />
  </ContentTemplate>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)

和内容页面中的购买按钮:

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">    
  <asp:Button ID="BuyButton" Runat="server" Text="P?idat do košíku" onclick="Buy_Click" />
</asp:Content>
Run Code Online (Sandbox Code Playgroud)

所以我需要为此按钮添加更新面板AsyncPostBackTrigger.

首先我尝试从内容页面添加它:

protected void Page_Load(object sender, EventArgs e)  
{  
    AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();         
    trigger.ControlID = "BuyButton";  
    UpdatePanel panel = (UpdatePanel)Master.FindControl("CartBox");   
    if (panel != null)  
    {  
        panel.Triggers.Add(trigger);  
    }  
    ScriptManager script = (ScriptManager)Master.FindControl("CartScript");  
    script.RegisterAsyncPostBackControl(BuyButton);  
}
Run Code Online (Sandbox Code Playgroud)

但它确实出错了:在UpdatePanel'CartBox'中找不到ID为"BuyButton"的控件.

所以我尝试从Master页面添加:

protected void …
Run Code Online (Sandbox Code Playgroud)

asp.net updatepanel master-pages ajax.net contentplaceholder

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

jQuery创建具有ID的新div?

我在ASP.NET masterPage.master中有表单,如果我单击“提交”,则通过ajax从masterPage.master.cs文件调用某种方法(我在更新面板中有此方法)。但是我想用jQuery改善它。所以我有这个:

$('#submit').click(function () {
            $.ajax({
                type: "POST",
                url: '<% Response.Write("~"+Request.Path); %>',
                beforeSend: function () {
                    $(document.createElement('div')).width($('#formBox').width())
                    .height($('#formBox').height())
                    .css({ backgroundImage: 'url(/Static/Img/bc_overlay.png)', position: 'absolute', left: 0, top: 0, margin: "5px", textAlign: "center", color: "#000", display: "none" })
                    .append("<strong>Na?ítám</strong><br /><img src='Static/Img/ajax-loader.gif' width='33px' height='33px' alt='loading' />")
                    .fadeIn("slow")
                    .prependTo($('#formBox'));
                    $('#formBox').css('position', 'relative');
                },
                success: function () {
                }
            });
        });
Run Code Online (Sandbox Code Playgroud)

因此,如果我单击“提交”,则会创建新的div(正在加载文本和图像,以及很酷的不透明度覆盖层),但是我如何给该div一些ID?因为我需要在

success: function () {
                    }
Run Code Online (Sandbox Code Playgroud)

我需要清除此框并在此处输入一些文字(错误或成功)。

html asp.net ajax jquery

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

GDI +中发生了一般错误.(只有我在服务器上试试)

你好我调整大小并将img上传到服务器有问题.一切都还可以,但今天告诉我朋友,当他想要添加img到服务器时,他得到"GDI +中发生了一般错误."..但在我的电脑上一切正常.那么IIS可能有问题吗?(两天前他有一些问题,所以管理员在服务器上改变了一些东西).

Bitmap image = KTEditImage.ResizeImage(new Bitmap(file.PostedFile.InputStream), 360, 360);
image.Save(Server.MapPath("~") + "/Static/Img/Zbozi/" + urlName, ImageFormat.Jpeg);
image.Dispose();
Bitmap smallImage = KTEditImage.ResizeImage(new Bitmap(file.PostedFile.InputStream), 230, 230);                           
smallImage.Save(Server.MapPath("~") + "/Static/Img/Zbozi/Small/" + urlName, ImageFormat.Jpeg);
smallImage.Dispose();
Run Code Online (Sandbox Code Playgroud)

和调整大小的方法是

public static Bitmap ResizeImage(Bitmap image, int maxWidth, int maxHeight)
{
    return new Bitmap(image, maxWidth, maxHeight);
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net iis image

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