Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
i made databse that contain images description like price details etc
i place pics on asp page
<img src = "" ...........>
i want to do that when i click on image image descripton from databse comes on page
my c# code is
C#
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
    String str = "provider = Microsoft.ACE.OLEDB.12.0; Data Source = image.accdb; Persist Security Info = False;";
           OleDbConnection conn = new OleDbConnection(str);
            conn.Open();
            string sql = "SELECT * FROM image where Name = p1";
            OleDbCommand cmd = new OleDbCommand(sql, conn);
             OleDbDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
{

Session["price"] = "TextBox2.Text";

Response.Redirect("Default.aspx");

code on aspx page
XML
<script type ="text/javascript">\
  function f2(value){
  document.getElementById('TextBox1').value = value;
  }
  </script>
  <style type="text/css">


          <img src = "p1.jpg"http://images.daniweb.com/vbulletin/editor/color.gif value = "p1"  onclick = "f2(value)"/>
          </td>
          <td>

              <input type = "text" id = "TextBox1"  Height="65px"
                 Width="195px"></asp:TextBox
Posted
Updated 1-Jun-11 19:20pm
v2

1 solution

First of all whatever code you have shared does not make any sense-connection with what you ask.

Now,
i want to do that when i click on image image descripton from databse comes on page
SERVER side:
Steps:
1. Attach a onclick handler to the image
2. On server side, in the method, pass on the imageID to database and get the desired data
3. Use the retrieved data from database to show it

CLIENT side:
Steps:
1. Attach a javascript onclick handler to image
2. Use XMLHTTPRequest to send the imageID on server side
3. On server side, use the imageID passed to database and get the desired data
4. Return the retrieved data to client
5. Get the data in Javascript and show it as needed.

Try!

Lastly, I have no clue why would you hit a server to get a tooltip info on a click of a image!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900