Jaya Prakash

Jaya Prakash

  • 534
  • 2.2k
  • 49.4k

How to display Image in Profile page

Mar 7 2023 4:44 AM

when i click on profile page all the details are visible but image filed is not visible pls help me

This Asp.net code

 protected void Page_Load(object sender, EventArgs e)
        {
            HyperLink link = (HyperLink)Master.FindControl("HyperLink6");
            link.Visible = false;
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString());
            con.Open();
            string commandText = "select namek,passwrd,gender,email,mobileno,country,stat,city,img1,img2,amount from newtable where namek='" + Session["UserName"] + "'";
            SqlCommand com = new SqlCommand(commandText, con);
            SqlDataReader reader = com.ExecuteReader();
            if (reader.Read())
            {
                lblmsg.Text = "Welcome To"+ "\n"+Session["UserName"].ToString()+"\n"+"Page";
                Label2.Text = reader["namek"].ToString();
                Label4.Text = reader["passwrd"].ToString();
                Label6.Text = reader["gender"].ToString();
                Label8.Text = reader["email"].ToString();
                Label10.Text = reader["mobileno"].ToString();
                Label14.Text = reader["country"].ToString();
                Label16.Text = reader["stat"].ToString();
                Label20.Text = reader["city"].ToString();
                ImageButton1.ImageUrl = "~/Images/" + reader["img1"].ToString();
                ImageButton2.ImageUrl = "~/Images/" + reader["img2"].ToString();
                Label24.Text = reader["amount"].ToString();
            }
        }

This is My Source

<tr>
        <td class="auto-style9">
            <asp:Label ID="Label21" runat="server" Text="Image1"></asp:Label>
            </td>
        <td class="auto-style10">
            <asp:ImageButton ID="ImageButton1" runat="server"   OnClick="ImageButton1_Click"/>
            </td>
    </tr>
    <tr>
        <td class="auto-style13">
            <asp:Label ID="Label22" runat="server" Text="Image2"></asp:Label>
        </td>
        <td class="auto-style12">
            <asp:ImageButton ID="ImageButton2" runat="server"  OnClick="ImageButton2_Click" />
        </td>
    </tr>

 


Answers (6)