Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Dynamic control on aspx page, dynamic location

Reply
Thread Tools

Dynamic control on aspx page, dynamic location

 
 
Chris Thunell
Guest
Posts: n/a
 
      07-21-2004
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 <aspropDownList
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>

'</aspropDownList>

Response.Write("</TD>")

Response.Write(" </TR>")

Response.Write("</TABLE>")

End Sub



Any help would be greatly appreciated!
Chris Thunell
http://www.velocityreviews.com/forums/(E-Mail Removed)




 
Reply With Quote
 
 
 
 
Chris Thunell
Guest
Posts: n/a
 
      07-21-2004
Could you give me an example of that in vb please. I can't seem to get it
to work.

"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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 <aspxx>. You can get server control content with method
> RenderControl and use HtmlTextWriter class for rendering it to clients.
>
> Eliyahu
>
> "Chris Thunell" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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 <aspropDownList
> > 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>
> >
> > '</aspropDownList>
> >
> > Response.Write("</TD>")
> >
> > Response.Write(" </TR>")
> >
> > Response.Write("</TABLE>")
> >
> > End Sub
> >
> >
> >
> > Any help would be greatly appreciated!
> > Chris Thunell
> > (E-Mail Removed)
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      07-21-2004
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 <aspxx>. You can get server control content with method
RenderControl and use HtmlTextWriter class for rendering it to clients.

Eliyahu

"Chris Thunell" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 <aspropDownList
> 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>
>
> '</aspropDownList>
>
> Response.Write("</TD>")
>
> Response.Write(" </TR>")
>
> Response.Write("</TABLE>")
>
> End Sub
>
>
>
> Any help would be greatly appreciated!
> Chris Thunell
> (E-Mail Removed)
>
>
>
>



 
Reply With Quote
 
Edward
Guest
Posts: n/a
 
      07-21-2004
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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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 <aspxx>. You can get server control content with method
> > RenderControl and use HtmlTextWriter class for rendering it to clients.
> >
> > Eliyahu
> >
> > "Chris Thunell" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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 <aspropDownList
> > > 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>
> > >
> > > '</aspropDownList>
> > >
> > > Response.Write("</TD>")
> > >
> > > Response.Write(" </TR>")
> > >
> > > Response.Write("</TABLE>")
> > >
> > > End Sub
> > >
> > >
> > >
> > > Any help would be greatly appreciated!
> > > Chris Thunell
> > > (E-Mail Removed)
> > >
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Location, location, location =?Utf-8?B?VHJhY2V5?= Wireless Networking 2 02-17-2007 08:37 PM
NAT location and VPN termination location K.J. 44 Cisco 0 09-12-2006 02:17 PM
after an image is moved to a new location, how to delete the image at the old location? zxo102 Python 0 08-01-2006 04:58 PM
How to trick a page into running at a location different from it'sphysical location? Luke Dalessandro ASP .Net 0 01-15-2006 05:59 AM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM



Advertisments