PC Review


Reply
Thread Tools Rate Thread

changing the content of header template while the page is loading

 
 
Ramesh
Guest
Posts: n/a
 
      4th Feb 2004
I am using a datalist control in my page and it has a header template.
In the header template I have a table control with table rows and
table cells. While the page is loading I am trying to change the
contents of one of the cells. By using Page.FindControl() I am getting
an error message that it cannot find an instance of an object.
I am giving the page code and code behind.

I am trying to insert a literal control in the table cell with
id="celltwo", but not able to do so. Any one has any answers.

-----------------------
<%@ Page Language="vb" AutoEventWireUp ="False"
Codebehind="WebForm2.aspx.vb" Inherits="ATMTransactions.WebForm2"%>



<html><head>
<title>PageControlsAdd</title>
</head>
<body>
<form id="f1" runat="server">
<aspatalist id="list" runat="server">
<headertemplate>
<asp:Table id="t5" runat="server" GridLines="both"
BorderWidth="1px">
<asp:TableRow>
<asp:TableCell id="cellone">Cell 1</asp:TableCell>
<asp:TableCell id="celltwo">Cell 2</asp:TableCell>
</asp:TableRow>
</asp:table>
<asp:Button id="joincrowd" text="Join The Crowd" runat="server"/>
</headertemplate>
</asp:datalist>
</form>
</body>
</html>


-------------- Code behind---------------------
Public Class WebForm2
Inherits System.Web.UI.Page
Protected WithEvents t5 As System.Web.UI.WebControls.Table
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form
Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

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


' This example just injects some plain text
Dim whatever As control

whatever = Page.FindControl("celltwo")
whatever.Controls.Add(New LiteralControl("Surpris"))

' This example injects some table rows and cells


End Sub

End Class
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Loading flash content into a web page Tor Inge Rislaa Microsoft ASP .NET 4 19th Apr 2007 09:44 AM
Changing page header to group header =?Utf-8?B?S2F0aWU=?= Microsoft Access 1 7th Feb 2007 09:42 PM
Header/footer part of a template for changing information =?Utf-8?B?S2F5?= Microsoft Word Document Management 2 11th Feb 2006 03:36 PM
Loading all content on same page =?Utf-8?B?VmxhZA==?= Microsoft Frontpage 1 11th Oct 2004 05:42 AM
changing the contents of a header template while the page is loading Ramesh Microsoft Dot NET Framework 0 3rd Feb 2004 09:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:20 PM.