Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
i want that on the click of an image or an image button my page should get redirected to another page which comprise of a grid view. Suppose that image id is supplier1 and on the click of this image i want to show the details of supplier1 in the grid view eg the products he paid for and the prize etc. i have used an objectdatasource to connect to the grid view and by applying a join i have succeeded in populating the grid view but i am unable to find a link to establish with the image. your reply will be appreciated.Thank you in advance
Posted

You can simply use a hyperlink with the image in background. Have the supplier id in the querystring of the url. Clicking on the link you will go to the new page and based on the id you will load the detail in the gridview. Does this make sense?

Thanks
Mahmud
 
Share this answer
 
try loading the query values ​​in a datasource and a gridview

Dim conn As New MySqlConnection
Dim myCommand As New MySqlCommand
Dim daMySQL As MySqlDataAdapter 'Novo
Dim dsMySQL As DataSet 'Novo
Dim SQL As String

Dim Conectaprovide As New Conectar
Dim oconecta As New Conectar '

oconecta.AbreBanco(conn)

SQL = "SELECT DISTINCT Mensagem " + _
"FROM Home_Mensagem_meio " + _
"ORDER BY Id DESC"
Try
myCommand.Connection = conn
myCommand.CommandText = SQL
Try
daMySQL = New MySqlDataAdapter(SQL, conn)
dsMySQL = New DataSet
daMySQL.Fill(dsMySQL, "mensagem")
gvCategorias.DataSource = dsMySQL
gvCategorias.DataBind()
Catch myerro As MySqlException
End Try
conn.Close()
Catch myerro As MySqlException
Finally
conn.Dispose()
End Try



SQL
then you need to recover through the databind the option
  <,% # Eval ("link"%)>


XML
<pre lang="xml">&lt;asp:GridView ID=&quot;gvCategorias&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;False&quot;
        Height=&quot;123px&quot; Width=&quot;146px&quot;&gt;
    &lt;Columns&gt;
        &lt;asp:TemplateField&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:HyperLink ID=&quot;linkCategoria&quot; runat=&quot;server&quot;
                    NavigateUrl=&#39;&lt;%#&quot;?id_cat=&quot; + Eval(&quot;id&quot;)%&gt;&#39;&gt;&lt;%# Eval(&quot;name&quot;) %&gt;&lt;/asp:HyperLink&gt;
            &lt;/ItemTemplate&gt;
            &lt;HeaderTemplate&gt;
                Categorias
            &lt;/HeaderTemplate&gt;
        &lt;/asp:TemplateField&gt;
    &lt;/Columns&gt;
&lt;/asp:GridView&gt;</pre>
 
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