This problem in bind occurs when repeater inside contentplaceholder. If repeater is out contentplaceholder, the bind is sucessfull. But I don't know why? I want use repeater inside contentplaceholder in my master page.
In MasterPages, ContentPlaceHolders can not be filled. They will be replaced by the what is in the Content of the page that uses it. So whatever you put inside ContentPlaceHolder Control will not be created.
What do you mean by using Repeater inside ContentPlaceHolder in MasterPage? (I mean functionally. What is the meaning of the Repeater to the Content that is to be in the PlaceHolder.)
Superguppie.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
Marked as answer by psicodelics on May 15, 2012 01:26 PM
psicodelics
Member
1 Points
7 Posts
Problem Bind Repeater
May 10, 2012 03:06 PM|LINK
I try to bind repeater in master page!
But I receive error message NullReferenceException. I see the repeater is nul, but i don't why?
If transfer code out master page and bind repeater is successfull.
cheruku.sai
Member
44 Points
12 Posts
Re: Problem Bind Repeater
May 10, 2012 03:38 PM|LINK
In master page in which method you are binding the repeater So that you are getting the error?
psicodelics
Member
1 Points
7 Posts
Re: Problem Bind Repeater
May 10, 2012 04:04 PM|LINK
psicodelics
Member
1 Points
7 Posts
Re: Problem Bind Repeater
May 10, 2012 04:05 PM|LINK
psicodelics
Member
1 Points
7 Posts
Re: Problem Bind Repeater
May 10, 2012 04:23 PM|LINK
Here my code to bind repeater, my access database use entity framework:
psicodelics
Member
1 Points
7 Posts
Re: Problem Bind Repeater
May 10, 2012 04:58 PM|LINK
headshot9x9
Member
45 Points
68 Posts
Re: Problem Bind Repeater
May 11, 2012 02:54 AM|LINK
Hi psicodelics
in Masterpage , we have contenplaceholder , in this here inherit child_page
I will give you specific examples of this problem
//THis is code master page <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:ContentPlaceHolder id="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <table border=1 cellpadding=0 cellspacing=0 width=100%> <tr> <td>Button A</td> <td>Textbox A</td> </tr> <tr> <td>Button B</td> <td><asp:ContentPlaceHolder ID=child_form runat=server></asp:ContentPlaceHolder></td> </tr> <tr> <td>DataList 1</td> <td>Repeater 1</td> </tr> <tr> <td>GridView 1</td> <td>Button B</td> </tr> </table> </form> </body> </html> // And Defaul inherit Master Page <%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="child_form" Runat="Server"> <asp:Repeater ID=rpt_A runat=server> <ItemTemplate> <table> <tr> <td><%# Eval("Name")%></td> </tr> </table> </ItemTemplate> </asp:Repeater> </asp:Content> //Page_load MasterPage Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'load data in repeater 1 'load data in Datalist 1 'load data in Gridview 1 End Sub //And page_load Default.aspx Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Load data in repeater A End SubIn Master Page , we can input many contenplaceholder , but not code inside
we can just add the code into the page, where they inherited masterpage
superguppie
All-Star
48225 Points
8679 Posts
Re: Problem Bind Repeater
May 14, 2012 03:07 PM|LINK
In MasterPages, ContentPlaceHolders can not be filled. They will be replaced by the what is in the Content of the page that uses it. So whatever you put inside ContentPlaceHolder Control will not be created.
What do you mean by using Repeater inside ContentPlaceHolder in MasterPage? (I mean functionally. What is the meaning of the Repeater to the Content that is to be in the PlaceHolder.)
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.