Friday, October 26, 2007

EmptyRepeater - Repeater with Empty Template

When I'm using ASP.NET Repeater instead of I can't find EmptyDataTemplate like in GridView. I've implemented Repeater with Empty template.


using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Gnilly.Controls
{
public class EmptyRepeater : Repeater
{
private ITemplate _emptyTemplate;

public ITemplate EmptyTemplate
{
get { return _emptyTemplate; }
set { _emptyTemplate = value; }
}

protected override void CreateControlHierarchy( bool useDataSource )
{
IEnumerable data = GetData();
if ( EmptyTemplate != null && data != null && !data.GetEnumerator().MoveNext() )
{
WebControl control = new WebControl( HtmlTextWriterTag.Div );
EmptyTemplate.InstantiateIn( control );
Controls.Add( control );
}
else
{
base.CreateControlHierarchy( useDataSource );
}
}
}
}

3 comments:

Kiquenet said...

Hi all,

for me, don't work if use in UpdatePanel (Ajax) .

Any solution ?? thanks.

Suman Biswas said...

Hi,
I have tried to get contacts from my Gmail, Hotmail and yahoo id, but it failed!

For Gmail getting error 401:Unauthorised,

and for Hotmail getting error -
The remote name could not be resolved: 'cumulus.services.live.com'.

My gamil id ends with @gmail and for hotmail id is @hotmail.

For yahoo it telling not supported my yahoo id ends with @yahoo.co.in

Can you help me to solve the issue?


Thanks in advance,
Suman

Unknown said...

Hi there are using WordPress for your blog platform? I'm new to the blog world but I'm trying to get started and set up my own. Do you need any HTML coding knowledge to make your own blog? Any help would be greatly appreciated!
file data recovery