Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用引导控件更改配置文件图片_C#_Asp.net_Twitter Bootstrap - Fatal编程技术网

C# 如何使用引导控件更改配置文件图片

C# 如何使用引导控件更改配置文件图片,c#,asp.net,twitter-bootstrap,C#,Asp.net,Twitter Bootstrap,我正在onclick()事件上更改用户配置文件图片。天气越来越冷了 已保存在iis服务器中,但未反映aspx页面。当我注销并再次登录时。它正在更新。 这是我的密码: Default.aspx <input type="file" id="userPicFileUpload" runat="server" /> <button runat="server" class="btn btn-info editable-submit" id="btnChangeUse

我正在
onclick()
事件上更改用户配置文件图片。天气越来越冷了

已保存在iis服务器中,但未反映aspx页面。当我注销并再次登录时。它正在更新。 这是我的密码:

Default.aspx

 <input type="file" id="userPicFileUpload" runat="server" />
        <button runat="server" class="btn btn-info editable-submit" id="btnChangeUserPic" onclick="ChangeUserPic();">Change</button>    

上传图片后无法刷新。请帮我解决此问题

只需将您的按钮替换为asp按钮,即可正常工作


只需将您的按钮替换为asp按钮,它就可以工作了


保存图像后,您不会更改图像

protected void btnChangeUserPic2_Click(object sender, EventArgs e)
{
    try
    {
        string filePath = Server.MapPath("~/Upload/");                            
        HttpPostedFile File = userPicFileUpload.PostedFile;
        string fileExtn = Path.GetExtension(File.FileName).ToLower();
        string filename = System.IO.Path.GetFileName(File.FileName);               
        File.SaveAs(filename);
        lblStatus.Visible = true;
        lblStatus.Text = "Profile picture changed successfully !!";
        profilepic.ImageUrl=filePath+filename;

    }
    catch (Exception ex)
    {               
    }

}

保存图像后,您不会更改图像

protected void btnChangeUserPic2_Click(object sender, EventArgs e)
{
    try
    {
        string filePath = Server.MapPath("~/Upload/");                            
        HttpPostedFile File = userPicFileUpload.PostedFile;
        string fileExtn = Path.GetExtension(File.FileName).ToLower();
        string filename = System.IO.Path.GetFileName(File.FileName);               
        File.SaveAs(filename);
        lblStatus.Visible = true;
        lblStatus.Text = "Profile picture changed successfully !!";
        profilepic.ImageUrl=filePath+filename;

    }
    catch (Exception ex)
    {               
    }

}
是客户端按钮的客户端标记

要使用按钮回调,您需要

其中解释了使用ASP.NET WebForms进行文件上载的所有内容

是客户端按钮的客户端标记

要使用按钮回调,您需要

其中介绍了使用ASP.NET WebForms进行文件上载的所有内容