473,320 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

.NET 2.0 Web Controls

This may be one of those simple questions, but I can't seem to find the
answer.

I want to create a control, called AdminForm, for example, then this will
render a table header and footer. Then I was the developer to be able to
drop other controls into this. But so they render between the header and
footer of the table. Then the controls have <tr> in them and everything will
be lined up correctly. My code is a follows, can someone point me in the
right direction?
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Text;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace IX4Controls

{

[DefaultProperty("Text")]

[ToolboxData("<{0}:IX4FormControl
runat=server></{0}:IX4FormControl>")]

public class IX4FormControl : WebControl

{

[Bindable(true), Category("Appearance"), DefaultValue(""),
Description("Header for the Form"), Localizable(true)]

public virtual String FormHeader

{

get

{

string s = (string)ViewState["FormHeader"];

return (s == null) ? "" : s;

}

set

{

ViewState["FormHeader"] = value;

}

}

protected override void CreateChildControls()

{

//Start the table

Literal startTableRow = new Literal();

startTableRow.Text = "<table><tr><td align=\"center\"
colspan=\"2\">";

this.Controls.Add(startTableRow);

//Label for form header

Label lab1 = new Label();

lab1.Text = FormHeader;

lab1.ForeColor = this.ForeColor;

this.Controls.Add(lab1);

//End of header

Literal endTableLit = new Literal();

endTableLit.Text = "</td></tr>";

this.Controls.Add(endTableLit);


I WANT USER CONTROLS TO BE ADDED HERE USING THE DESIGN VIEW.
//Aend of table

Literal endTableLit = new Literal();

endTableLit.Text = "</table>";

this.Controls.Add(endTableLit);

//call the parent method

base.CreateChildControls();

}

}

}

Any Ideas?

Regards,

Lewis Harvey


Nov 19 '05 #1
0 1035

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
0
by: Mark Johnson | last post by:
Sometimes Controls that have been added to a GroupBox do not show up. What I am doing : 1) I am not using the designer, but create all the Controls per hand: groupBoxProdukt_01 = new...
3
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event...
1
by: Robert Howells | last post by:
Perhaps I'm just too new at this to pull it off, or perhaps it's just bad architecture. I'd appreciate some feedback on the the wisdom (or lack thereof) in attempting the following: I'm not new...
10
by: Sacha Korell | last post by:
I'm trying to load a drop-down list with all DropDownList control names from another page. How would I be able to find those DropDownList controls? The FindControl method will only find a...
6
by: dhnriverside | last post by:
Hi peeps, I'm trying to create some controls textboxes at runtime, based on the number of items in a IETreeView that are checked. That I can do, I've got a place holder and I can create the...
66
by: Cor | last post by:
Hi, I start a new thread about a discussion from yesterday (or for some of us this morning). It was a not so nice discussion about dynamically removing controls from a panel or what ever. It...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
15
by: Arpan | last post by:
Consider the following code which retrieves data from a SQL Server 2005 DB table & displays it in a DataGrid: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.