Access HeaderTemplate and FooterTemplate Controls

How to access controls in  HeaderTemplate and FooterTemplate

We are using ASP .NET, C# here in this example.

Lets take this repeater as an example. 

<asp:Repeater ID="rpt" runat="server">
    <HeaderTemplate>
       <asp:CheckBox ID="chk1" runat="server" />
    </HeaderTemplate>
    <ItemTemplate>
       HELLO
    </ItemTemplate>
    <FooterTemplate>
      
<asp:CheckBox ID="chk2" runat="server" />
    </FooterTemplate>
</asp:Repeater>

 

You can access the header and footer item controls on ItemCreated or even ItemDataBound. But not when you iterate through the repeater items like this:

foreach(RepeaterItem ri in rpt.Items)

{
    if (ri.ItemType == ListItemType.Header)
    {
        CheckBox chk1 = (CheckBox)ri.FindControl("chk1");

       chk1.Checked=true;
    }
    if (ri.ItemType == ListItemType.Footer)
    {
        CheckBox chk2 = (CheckBox)ri.FindControl("chk2");

       chk2.Checked=true;
    }
}

 

This will simply not work.

Without going through the explanation why it does not work, let see how we can get it work.

If you have a footer and header template defined in the repeater, header is item with index 0 and footer is the last item. Bearing that in mind, we can simply access the header and footer controls as follows:

CheckBox chk1 = (CheckBox)rpt.Controls[0].FindControl("chk1");
chk1.Checked = true;
CheckBox chk2 = (CheckBox)rpt.Controls[rpt.Controls.Count - 1].FindControl("chk2");
chk2.Checked = true;

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: WebCosmo
Posted on: 7/17/2008 at 11:08 AM
Categories: Programming / Coding
E-mail |  Stumble it! |  Propeller it! |  Digg it! |  del.icio.us |  Technorati
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Marketing - Brothel Style

Few days ago a car dealer offered free gun or gas for his car buyers. Now a Nevada brothel is trying to market their business by offering free petrol.

Clients of the Shady Lady Ranch will get a $50 petrol voucher if they fork out $300 -- worth about one hour's worth of services -- at the brothel in Beatty, Nevada, 130 miles (209 km) northwest of Las Vegas.

Owner James Davis said he already has had to order another $1,000 set of petrol vouchers because the first $1,000 were spent in one week.

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: WebCosmo
Posted on: 7/8/2008 at 5:37 PM
Categories: Advertising / Marketing
E-mail |  Stumble it! |  Propeller it! |  Digg it! |  del.icio.us |  Technorati
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Marketing Goes to Ass Now

Ass-vertising is a new ad medium from a crazy advertising agency, NightAgency, which is based on a simple philosophy; "if you want to be seen, go where people are already looking". It involves putting a logo, a web address, or a brief message on the seat of a pair of bikini style panties. The panties are then worn by beautiful girls and ready to show your message to the target.

As shown part of a ass advertising campaign on the picture, bunch of shapely asses paraded outside Grand Central Station in New York to promote the New York Health and Racquet Club and a class they offer, called, appropriately, "Booty Call."

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: WebCosmo
Posted on: 7/5/2008 at 5:45 PM
Categories: Advertising / Marketing
E-mail |  Stumble it! |  Propeller it! |  Digg it! |  del.icio.us |  Technorati
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

What are you thinking?

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: WebCosmo
Posted on: 7/2/2008 at 5:32 PM
Categories: Funny / Bizarre / Odd / Strange
E-mail |  Stumble it! |  Propeller it! |  Digg it! |  del.icio.us |  Technorati
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Frogs Married to Bring Rain in India

Villagers in India marry two frogs to please the rain Gods - in the hopes the region will get good monsoon rains.

The villagers believe that it is due to God's blessings that they receive rainfall on time.

They organised the marriage of frogs to celebrate the occasion and expressed their gratitude to God so that they continue to be blessed with rains in future too.

Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: WebCosmo
Posted on: 6/29/2008 at 4:47 AM
Categories: Funny / Bizarre / Odd / Strange
E-mail |  Stumble it! |  Propeller it! |  Digg it! |  del.icio.us |  Technorati
Post Information: Permalink | Comments (2) | Post RSSRSS comment feed

Performance Based Marketing

In today's world without marketing no business can go far. Wrong marketing strategy could cost a business loose lot of money. A common case scenario is businesses loosing lot of money before they can find the right marketing strategy. In most cases its a trial and error process.

If you had to pay for only the leads you get from a marketing wouldn't that be nice? Lets say you are selling computers on your website. If you could choose a marketing plan that you have to pay only if you sell a computer wouldn't that be great? Thats what the recent marketing trend "Lead Generation Marketing" provides.

Good Sides of Lead Generation:

  • Determine pricing on a per lead basis
  • Pay only for the leads that are received
  • For new businesses its a great way of building a customer base.

Who is it for?

Lead Generation marketing is most effective for service oriented businesses. If  you have a blog you like to market its probably not a good idea to use it, but if you sell shoes for example this type of marketing could be very effective for you. Industries like real estate, insurance agencies, educational institutions, office suppliers, furniture stores etc could greatly benefit from Lead Generation marketing.

How is it done? 

Lead Generation marketing companies use marketing on multiple mediums like Tv, Internet, Radio, Viral, Event marketing etc.

SimplyIdeas.com

Simply Ideas is a company that offer the service of providing qualified leads to businesses by Lead Generation marketing. According to the Simply Ideas company website personal touch, highly analytical research, using search engine marketing as core strategy, delivering results are some significant aspects of the company services to mention.

For more information about Simply Ideas visit http://www.simplyideas.com/

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: WebCosmo
Posted on: 6/28/2008 at 1:25 PM
Categories: Reviews
E-mail |  Stumble it! |  Propeller it! |  Digg it! |  del.icio.us |  Technorati
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Fish Marketing

Lot of times you will hear people asking for marketing advice "where can I market my website?". In most cases people feel hopeless as they are new in marketing.

Answer is actually very simple "go where the salmon are". If you wanna fish salmon you gotta go where the salmon are. You can try everywhere but your best chances of getting salmon is going where they live.

In simple words this means you have to find out your target audience, then find out where they gather, then market there. Some niches are easy to work with, some are really difficult. Like some fishes are available in many places, some audience are also spread over.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: WebCosmo
Posted on: 6/27/2008 at 6:34 PM
Categories: Advertising / Marketing
E-mail |  Stumble it! |  Propeller it! |  Digg it! |  del.icio.us |  Technorati
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed