placeholder does not recognize line break code [modified]
-
Hi . I am creating dynamically dataitem for datalist and populating record to it on fly. My problem is that table does not recognize
Inside ph.Controls.Add(new LiteralControl("
")); WHAT IS THE ISSUE PLEASE HELP... THANK YOU CODE THAT I AM USING TO CREATE DATALIST DATAITEM. public void InstantiateIn(System.Web.UI.Control container ) { PlaceHolder ph = new PlaceHolder(); ImageMap imp = new ImageMap(); Label item1 = new Label(); .. .. imp.ID = "img1"; switch (templateType) { case ListItemType.Header: ph.Controls.Add(new LiteralControl("" )); break; case ListItemType.Item: ph.Controls.Add(new LiteralControl("")); //ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item1); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item2); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item3); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item4); ph.Controls.Add(new LiteralControl("
")); ph.DataBinding += new EventHandler(Item_DataBinding); break; case ListItemType.Footer: ph.Controls.Add(new LiteralControl("")); break; } container.Controls.Add(ph); } And binding it as static void Item_DataBinding(object sender, System.EventArgs e) { PlaceHolder ph = (PlaceHolder)sender; DataListItem ri = (DataListItem)ph.NamingContainer; /string impValue = (string)DataBinder.Eval(ri.DataItem, "photopath1"); String item1Value = (String)DataBinder.Eval(ri.DataItem, "Categoryid1"); String item2Value = (String)DataBinder.Eval(ri.DataItem, "subcategoryid1"); String item3Value = (String)DataBinder.Eval(ri.DataItem, "customerid1"); String item4Value = (String ) DataBinder.Eval(ri.DataItem, "retailprice1").ToString() ; ((ImageMap)ph.FindControl("img1")).ImageUrl = impValue; ((Label)ph.FindControl("ite
-
Hi . I am creating dynamically dataitem for datalist and populating record to it on fly. My problem is that table does not recognize
Inside ph.Controls.Add(new LiteralControl("
")); WHAT IS THE ISSUE PLEASE HELP... THANK YOU CODE THAT I AM USING TO CREATE DATALIST DATAITEM. public void InstantiateIn(System.Web.UI.Control container ) { PlaceHolder ph = new PlaceHolder(); ImageMap imp = new ImageMap(); Label item1 = new Label(); .. .. imp.ID = "img1"; switch (templateType) { case ListItemType.Header: ph.Controls.Add(new LiteralControl("" )); break; case ListItemType.Item: ph.Controls.Add(new LiteralControl("")); //ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item1); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item2); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item3); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item4); ph.Controls.Add(new LiteralControl("
")); ph.DataBinding += new EventHandler(Item_DataBinding); break; case ListItemType.Footer: ph.Controls.Add(new LiteralControl("")); break; } container.Controls.Add(ph); } And binding it as static void Item_DataBinding(object sender, System.EventArgs e) { PlaceHolder ph = (PlaceHolder)sender; DataListItem ri = (DataListItem)ph.NamingContainer; /string impValue = (string)DataBinder.Eval(ri.DataItem, "photopath1"); String item1Value = (String)DataBinder.Eval(ri.DataItem, "Categoryid1"); String item2Value = (String)DataBinder.Eval(ri.DataItem, "subcategoryid1"); String item3Value = (String)DataBinder.Eval(ri.DataItem, "customerid1"); String item4Value = (String ) DataBinder.Eval(ri.DataItem, "retailprice1").ToString() ; ((ImageMap)ph.FindControl("img1")).ImageUrl = impValue; ((Label)ph.FindControl("ite
.... Nothing to do with the placeholder - it is not valid HTML to have a
tag placed between two tags... -
.... Nothing to do with the placeholder - it is not valid HTML to have a
tag placed between two tags...thanks for reply. actually then how can i move record to next line. please help
imran khan
-
thanks for reply. actually then how can i move record to next line. please help
imran khan
well it depends how yu want to display them - either put them all in one td tag with br betwen them, or else use the tr tag to start a new table row between each. Try making up a simple html page with some sample data on it displayed how you want it, then recreate the html there in your code, inserting the records as and when needed.
-
well it depends how yu want to display them - either put them all in one td tag with br betwen them, or else use the tr tag to start a new table row between each. Try making up a simple html page with some sample data on it displayed how you want it, then recreate the html there in your code, inserting the records as and when needed.
actually in one i have five data to show and i would be like these data to display one below the other. how can i do it please help
imaran khan
-
actually in one i have five data to show and i would be like these data to display one below the other. how can i do it please help
imaran khan
the put a
between them, but leave out the -
the put a
between them, but leave out thenow i change the code but it does not working ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(item1); imaran khan -
now i change the code but it does not working ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(item1); imaran khanyou're still putting a br between the td tags - just leave out those tow lines: ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item1); -
you're still putting a br between the td tags - just leave out those tow lines: ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("
")); ph.Controls.Add(item1);thanks buddy i worked ... i understood my mistake. thanks alot
imaran khan