Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Scripting / June 2005

Tip: Looking for answers? Try searching our database.

probs with response.write and web controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doug - 22 Jun 2005 02:51 GMT
Neither of these statements will properly render a control.  The control,
flat out , is not there, when the form rendering has completed.  Is there a
trick to get this to work, or am I flat out of luck?

Response.Write("    <asp:image id=""img1"" runat=""server"" Height=""25""
Width=""26"" ImageUrl=""" + image + """></asp:image>")

Response.Write("<asp:HyperLink id=""HyperLink1"" runat=""server"">Mail
History</asp:HyperLink>")

The reason I am doing this is becuase I've got one of these going on
<% for i = 0 to whatever%>
<table
  'bunch of junk goes here
</table>
bryce_db - 25 Jun 2005 07:30 GMT
If you're willing to use code behind to instantiate controls, you can declare
webcontrols (or the literal - which allows you to manually insert any valid
html) as noted below..

On the .aspx page:
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>

In the code-behind page:

protected System.Web.UI.WebControls.PlaceHolder PlaceHolder1;
   
private void Page_Load(object sender, System.EventArgs e)
{
for(int i=0; i<6; i++)
{
HyperLink hlnk = new HyperLink();
hlnk.NavigateUrl = "http://www.msn.com";
hlnk.Text = "msn" + i;
LiteralControl ltrBR = new LiteralControl("<hr>");
PlaceHolder1.Controls.Add(hlnk);
PlaceHolder1.Controls.Add(ltrBR);
}
}

> Neither of these statements will properly render a control.  The control,
> flat out , is not there, when the form rendering has completed.  Is there a
[quoted text clipped - 11 lines]
>    'bunch of junk goes here
> </table>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.