Custom Web Control
-
Hey everyone. I'm rather new here, so if I make any mistakes or violate etiquette, then I'd like to apologize in advance. My question is rather simple, but it seems the answer isn't, and it's difficult to phrase the question at all without an example. I've been google searching for the past two hours, and since I saw that most of the articles came from here, I figured I'd swing this one by everyone here. Basically, I would like to have items in my webcontrol, much like a datagrid does. For example... Thanks in advance for your patience and time
-
Hey everyone. I'm rather new here, so if I make any mistakes or violate etiquette, then I'd like to apologize in advance. My question is rather simple, but it seems the answer isn't, and it's difficult to phrase the question at all without an example. I've been google searching for the past two hours, and since I saw that most of the articles came from here, I figured I'd swing this one by everyone here. Basically, I would like to have items in my webcontrol, much like a datagrid does. For example... Thanks in advance for your patience and time
SilentSeraph wrote: Basically, I would like to have items in my webcontrol, much like a datagrid does. For example... Like this?[^] David Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy -
Hey everyone. I'm rather new here, so if I make any mistakes or violate etiquette, then I'd like to apologize in advance. My question is rather simple, but it seems the answer isn't, and it's difficult to phrase the question at all without an example. I've been google searching for the past two hours, and since I saw that most of the articles came from here, I figured I'd swing this one by everyone here. Basically, I would like to have items in my webcontrol, much like a datagrid does. For example... Thanks in advance for your patience and time
you can create a custom list of objects by creating a new class... public class MyCustomControlItems : object { private string myVar1=""; public MyCustomControlItems() { } public string MyVar1 { get { return myVar1; } set { myVar1=value; } } } you can add ad many specific attributes you would like to have for each item like I did with MyVar1. then in your custom control you can put an array of MyCustomControlItems like this: public class MyCustomControl : System.Web.UI.CustomControl (or w/e it is...) { private string html=""; public void RenderHtml(HtmlThingyMagig output) { output.write(html); } public MyCustomControlItems[] Items { get {bla..bla..bla... } set {bla..bla..bla... } } } i was too lazy to look up the exact namespaces for some of that stuff but thats the basic jist of it