本文介绍了为什么照片未显示在网页中.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么照片不显示在网页上.我的HTML和CS编码如下所示.仅图像图标代替图像显示.


HTML零件

Why the photo is not displaying in web page.My HTML and CS coading is given below.Only image icon is displaying in place of image.


HTML Part

<body>
    <form id="form1"  runat="server">
    <div>

        <asp:Image ID="Image1" runat="server" ImageUrl="~/blank.jpg" />
        <br />
        <br />
        <br />
        <br />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <br />
        <br />
        <br />
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <br />
        <br />
        <br />
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        <br />
        <br />
    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
    </div>
    </form>
</body>
</html>



CS Part is given below


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;
using System.IO;


public partial class Retrive_Data_From_Database_and_display_in_TextBox : System.Web.UI.Page
{
    OleDbConnection con;
    OleDbCommand com;
    OleDbDataAdapter da;
    DataSet ds;
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new System.Data.OleDb.OleDbConnection();
        ds = new DataSet();
        con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/kamnagroup.mdb") + "";
        string sql = "select aname,add1,photo,point from joining WHERE point=(SELECT MAX(point) FROM joining)";
        da = new System.Data.OleDb.OleDbDataAdapter(sql,con);
        con.Open();
        da.Fill(ds,"joining");
        navigatedata();
        con.Close();

    }
    private void navigatedata()
    {
        DataRow dRow=ds.Tables["joining"].Rows[0];
        System.Web.UI.WebControls.Label lbl1 = new System.Web.UI.WebControls.Label();
        TextBox1.Text = dRow.ItemArray.GetValue(0).ToString();
        TextBox2.Text = dRow.ItemArray.GetValue(1).ToString();
        lbl1.Text = dRow.ItemArray.GetValue(2).ToString();
        TextBox3.Text = dRow.ItemArray.GetValue(3).ToString();
        TextBox4.Text = dRow.ItemArray.GetValue(2).ToString();
        Image1.ImageUrl = System.IO.Path.GetFileName(lbl1.Text);

    }
}

推荐答案


这篇关于为什么照片未显示在网页中.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 04:22
查看更多