Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to change behaviour of item_databinding of itemplate interface

how to change behaviour of item_databinding of itemplate interface

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netsharepointwpf
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    imranafsari
    wrote on last edited by
    #1

    Hi all, I am using asp.net2.0 and C# VS2005. I am creating asp.net web server control templates Dynamically . My requirement is such that sp return very no of field( 4 or 5 or 6 …). Now I am assigning it to datalist by creating web server control template dynamilly. My problem is as no of field return very .how can I change databinding(which is method of itemplate) method so that I can bind data as per field. That is how can I change the behavior of method Item_DataBinding(itemplate interface) so that it accept parameter Please help. Code i am using ……. public class MyTemplate:ITemplate { ListItemType templateType; String para1, para2, para3, para4, para5; public MyTemplate(System.Web.UI.WebControls.ListItemType type , string parameter1) { templateType = type; para1 = parameter1; } // public void InstantiateIn(System.Web.UI.Control container ) { PlaceHolder ph = new PlaceHolder(); ImageMap imp = new ImageMap(); //declaration imp.ID = "img1"; switch (templateType) { case ListItemType.Header: // ph.Controls.Add(new LiteralControl(" ")); ph.Controls.Add(new LiteralControl("" )); break; case ListItemType.Item: ph.Controls.Add(new LiteralControl("")); ph.DataBinding += new EventHandler(Item_DataBinding); break; case ListItemType.Footer: ph.Controls.Add(new LiteralControl("

    ")); ph.Controls.Add(imp); // some code //optional parameter if (!((para1 == "categoryid") || (para1 == "customerid") || (para1 == "retailprice") || (para1 == "subcategory"))) { ph.Controls.Add(item5); ph.Controls.Add(new LiteralControl("
    ")); } ph.Controls.Add(new LiteralControl("

    ")); break; } container.Controls.Add(ph); } // container code end static void Item_DataBinding(object sender, System.EventArgs e ) { PlaceHolder ph = (PlaceHolder)sender; DataListItem ri = (DataListItem)ph.NamingContainer; //RepeaterItem ri = (RepeaterItem)ph.NamingContain

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups