473,385 Members | 1,400 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,385 software developers and data experts.

Dynamic control on aspx page, dynamic location

I have an aspx web form with a table that i'm sending via response.write...
in one of the cells i would like to put a dynamically created server
control. The amount of rows is variable... so i could have 10 rows /
controls. How do i create a server control that goes into the appropriate
grid cell?

Example:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

Response.Write("<TABLE id='Table1' cellSpacing='1' cellPadding='1'
width='300' border='1'>")

Response.Write("<TR>")

Response.Write("<TD>Test1</TD>")

Response.Write("<TD>test 2</TD>")

Response.Write("<TD>test 3</TD>")

Response.Write("<TD>")

'insert dynamically created server checkbox control <asp:CheckBox
id='CheckBox1' runat='server'></asp:CheckBox></TD>

Response.Write("</TR>")

Response.Write("<TR>")

Response.Write("<TD>test 4</TD>")

Response.Write("<TD>test 5</TD>")

Response.Write("<TD>test 6</TD>")

Response.Write("<TD>")

'insert dynamically created dropdown server control <asp:DropDownList
id='DropDownList1' runat='server'>

'<asp:ListItem></asp:ListItem>

'<asp:ListItem Value='VA'>VA</asp:ListItem>

'<asp:ListItem Value='MD'>MD</asp:ListItem>

'<asp:ListItem Value='DC'>DC</asp:ListItem>

'</asp:DropDownList>

Response.Write("</TD>")

Response.Write(" </TR>")

Response.Write("</TABLE>")

End Sub

Any help would be greatly appreciated!
Chris Thunell
ct******@pierceassociates.com


Nov 18 '05 #1
3 1742
Chris,

Response.Write emits html for the client. A server control is processed on
the server and is rendered to the client as html. Browsers don't know
anything about <asp:xxx>. You can get server control content with method
RenderControl and use HtmlTextWriter class for rendering it to clients.

Eliyahu

"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
I have an aspx web form with a table that i'm sending via response.write... in one of the cells i would like to put a dynamically created server
control. The amount of rows is variable... so i could have 10 rows /
controls. How do i create a server control that goes into the appropriate
grid cell?

Example:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

Response.Write("<TABLE id='Table1' cellSpacing='1' cellPadding='1'
width='300' border='1'>")

Response.Write("<TR>")

Response.Write("<TD>Test1</TD>")

Response.Write("<TD>test 2</TD>")

Response.Write("<TD>test 3</TD>")

Response.Write("<TD>")

'insert dynamically created server checkbox control <asp:CheckBox
id='CheckBox1' runat='server'></asp:CheckBox></TD>

Response.Write("</TR>")

Response.Write("<TR>")

Response.Write("<TD>test 4</TD>")

Response.Write("<TD>test 5</TD>")

Response.Write("<TD>test 6</TD>")

Response.Write("<TD>")

'insert dynamically created dropdown server control <asp:DropDownList
id='DropDownList1' runat='server'>

'<asp:ListItem></asp:ListItem>

'<asp:ListItem Value='VA'>VA</asp:ListItem>

'<asp:ListItem Value='MD'>MD</asp:ListItem>

'<asp:ListItem Value='DC'>DC</asp:ListItem>

'</asp:DropDownList>

Response.Write("</TD>")

Response.Write(" </TR>")

Response.Write("</TABLE>")

End Sub

Any help would be greatly appreciated!
Chris Thunell
ct******@pierceassociates.com

Nov 18 '05 #2
Could you give me an example of that in vb please. I can't seem to get it
to work.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Chris,

Response.Write emits html for the client. A server control is processed on
the server and is rendered to the client as html. Browsers don't know
anything about <asp:xxx>. You can get server control content with method
RenderControl and use HtmlTextWriter class for rendering it to clients.

Eliyahu

"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
I have an aspx web form with a table that i'm sending via

response.write...
in one of the cells i would like to put a dynamically created server
control. The amount of rows is variable... so i could have 10 rows /
controls. How do i create a server control that goes into the appropriate grid cell?

Example:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

Response.Write("<TABLE id='Table1' cellSpacing='1' cellPadding='1'
width='300' border='1'>")

Response.Write("<TR>")

Response.Write("<TD>Test1</TD>")

Response.Write("<TD>test 2</TD>")

Response.Write("<TD>test 3</TD>")

Response.Write("<TD>")

'insert dynamically created server checkbox control <asp:CheckBox
id='CheckBox1' runat='server'></asp:CheckBox></TD>

Response.Write("</TR>")

Response.Write("<TR>")

Response.Write("<TD>test 4</TD>")

Response.Write("<TD>test 5</TD>")

Response.Write("<TD>test 6</TD>")

Response.Write("<TD>")

'insert dynamically created dropdown server control <asp:DropDownList
id='DropDownList1' runat='server'>

'<asp:ListItem></asp:ListItem>

'<asp:ListItem Value='VA'>VA</asp:ListItem>

'<asp:ListItem Value='MD'>MD</asp:ListItem>

'<asp:ListItem Value='DC'>DC</asp:ListItem>

'</asp:DropDownList>

Response.Write("</TD>")

Response.Write(" </TR>")

Response.Write("</TABLE>")

End Sub

Any help would be greatly appreciated!
Chris Thunell
ct******@pierceassociates.com


Nov 18 '05 #3
you'd better use Table class to generate the output.

Dim tbl as Table
Dim row as TableRow
Dim cell as TableCell

cell.Controls.Add ( your server control )

row.Cells.Add( cell )

tbl.Rows.Add( row )

you'll get the result you need in the client window.

Could you give me an example of that in vb please. I can't seem to get it
to work.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Chris,

Response.Write emits html for the client. A server control is processed on
the server and is rendered to the client as html. Browsers don't know
anything about <asp:xxx>. You can get server control content with method
RenderControl and use HtmlTextWriter class for rendering it to clients.

Eliyahu

"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
I have an aspx web form with a table that i'm sending via

response.write...
in one of the cells i would like to put a dynamically created server
control. The amount of rows is variable... so i could have 10 rows /
controls. How do i create a server control that goes into the

appropriate grid cell?

Example:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

Response.Write("<TABLE id='Table1' cellSpacing='1' cellPadding='1'
width='300' border='1'>")

Response.Write("<TR>")

Response.Write("<TD>Test1</TD>")

Response.Write("<TD>test 2</TD>")

Response.Write("<TD>test 3</TD>")

Response.Write("<TD>")

'insert dynamically created server checkbox control <asp:CheckBox
id='CheckBox1' runat='server'></asp:CheckBox></TD>

Response.Write("</TR>")

Response.Write("<TR>")

Response.Write("<TD>test 4</TD>")

Response.Write("<TD>test 5</TD>")

Response.Write("<TD>test 6</TD>")

Response.Write("<TD>")

'insert dynamically created dropdown server control <asp:DropDownList
id='DropDownList1' runat='server'>

'<asp:ListItem></asp:ListItem>

'<asp:ListItem Value='VA'>VA</asp:ListItem>

'<asp:ListItem Value='MD'>MD</asp:ListItem>

'<asp:ListItem Value='DC'>DC</asp:ListItem>

'</asp:DropDownList>

Response.Write("</TD>")

Response.Write(" </TR>")

Response.Write("</TABLE>")

End Sub

Any help would be greatly appreciated!
Chris Thunell
ct******@pierceassociates.com



Nov 18 '05 #4

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

Similar topics

0
by: Martin | last post by:
Hi. I had a very frustrating afternoon and evening but I have got it all under control now so all of a sudden I am in a good mood. I want to share some insights on output caching with you lot. ...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
4
by: TS | last post by:
I am creating a User control and i create some dynamic controls in the init handler. one of the controls is a custom validator which i assign a serverValidate event handler. I usally always do my...
2
sanjib65
by: sanjib65 | last post by:
I try to create a custom control that will say, Hello + ComputerUserName. I have added in my App_Code folder a WelcomeLabel.cs file: // WelcomeLabel.cs using System; using...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.