Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
int i;

       title = "";
       for (i = 0; i < ds.Tables[0].Rows.Count; i++)
       {
           title = title + "<div class='one' ><div class='Solar Mobile'><h1>" + (i + 1).ToString() + "." + ds.Tables[0].Rows[i]["product_name"].ToString() + " Just Rs." + ds.Tables[0].Rows[i]["price"].ToString() + "/-<asp:ImageButton ID='ImageButton1' runat='server' ImageUrl='~/images/cart.jpg' onclick='Addtocart' /></h1></div><div class='Solar-text' >" + ds.Tables[0].Rows[i]["description"].ToString() + "</div ><div class='img'><img  src='imggrab.aspx?ID=" + ds.Tables[0].Rows[i]["pk_product_id"].ToString() + "' /></div><div class='clr'></div></div>";
       }


is it correct ... i'm trying to call
Addtocart
function but the asp image button does not appers... why so...?
thanks in advance
Posted

Injecting HTML to the page is alright, but you can't inject an asp.net control as inline html.

Instead try to add controls to the parent control.
 
Share this answer
 
Comments
devildx2050 8-Oct-11 3:11am    
so what is the alternate solution of this problem ??
It doesn't work. you can render the html using Rosponse.Write method, but cannot render server controls (asp:ImageButton). I think here you are trying to add the item to a cart. Please add a GridView control and bind the data from table directly and try to customize the grid. You can do all these style things in GridView template columns.
 
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