Click here to Skip to main content
14,270,386 members
Rate this:
Please Sign up or sign in to vote.
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********
<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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100