Click here to Skip to main content
15,886,798 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi sir this is view page?
string constr = ConfigurationManager.ConnectionStrings["CONSTR"].ConnectionString;
private int id = 0;

protected void Page_Load(object sender, EventArgs e)
{
id = Convert.ToInt32(Request.QueryString["id"].ToString());
if (!IsPostBack)
{
BindControlvalues();
}

}

private void BindControlvalues()
{
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand cmd = new SqlCommand("select * from tbl_addnewproduct where id=" + id, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.ExecuteNonQuery();
con.Close();
DataSet ds = new DataSet();
da.Fill(ds);
Image1.ImageUrl = ds.Tables[0].Rows[0][1].ToString();
Label1.Text = ds.Tables[0].Rows[0][2].ToString();
Label2.Text = ds.Tables[0].Rows[0][3].ToString();

}

*****this is gridview page********
XML
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        DataSourceID="SqlDataSource1" Width="237px">
        <Columns>
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False"
                ReadOnly="True" SortExpression="id" />
             <asp:TemplateField HeaderText="Image">
                        <ItemTemplate>
                         <img alt ="" src ='images/<%#Eval("imagename") %>' height="50px" width="50px" />
                          </ItemTemplate>
                        </asp:TemplateField>

           <asp:TemplateField>
<ItemTemplate>
<a href ='<%#"viewdeatil.aspx?id="+DataBinder.Eval(Container.DataItem,"id") %>'> <%#Eval("Name") %>  </a>
</ItemTemplate>
</asp:TemplateField>
            <asp:BoundField DataField="product" HeaderText="product"
                SortExpression="product" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:BussinessConnectionString %>"
        SelectCommand="SELECT [id], [imagename], [Name], [product] FROM [tbl_addnewproduct]">
    </asp:SqlDataSource>
</td></tr></table></div>
</div>


i want to show the gridview image in next page after click view button
but above code working but image is not show;
thanks sir
Posted
Updated 18-Oct-14 0:45am
v2
Comments
/\jmot 20-Oct-14 5:31am    
what's the error?

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