.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

creating repeater programatically - onItemCommand

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :ASP.Net

 I am writing an application that requires a recursive programatic creation of a repeater multiple times inside of itself, working in vs 2005, asp.net 2.0 and visual basic.


it looks like this





placeholder contains a repeater I create programatically which inturn also looks like






that placeholder refers to the programtically created repeater.  Thus the process is recursive and can grow based on user interaction.




So far I have been able to have the "runtime created" repeater be generated and I have even been able to bind data to objects inside of the repeater which was good progress.

so while the programatically created repeater appears to be working as expected I am having a difficult time getting repeater objects (in this case a linkbutton) to fire a command - which would typically be set in markup as CommandName="fire" (susbtitue 'fire' for whatever you like)

in markup it's easy to set a repeaters onItemCommand equal to an appropriate function/sub but since there is not markup as the repeater is created on demand in codebehind this is not an option.

I suspected repeater.ItemCommand mi

View Complete Post

More Related Resource Links

Creating Paging for a Repeater Control

A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.

Creating an AJAX Repeater in ASP.NET MVC

The "TaskList" is a tried an true example of the most basic thing that you can do in any framework. Unfortunately, I had some problems finding a really good example of all the steps necessary to get a task list to work in ASP.NET MVC 1.0.

Creating a new site sharepoint 2010 under parent site with my custom template Programatically using

Hi, I have a parent website under which i want to create subsites on the fly using visual studio 2010. The subsites which i want to create have a common stuructre(in temrs of lists & custom). So i saved the template in sharepoint 2010,it becomes wsp and goes into soution gallery. Now how do i use this template say mytemplate.wsp,to create site in visual studio. i tried this using (SPSite site = new SPSite ("http://infml01132:5566/sites/VRND " ))             {                 using (SPWeb web = site.OpenWeb())                 {                                       SPWebTemplateCollection myTemplates = site.GetCustomWebTemplates(Convert .ToUInt32(web.Locale.LCID));                     //SPWebTemplateCollection temlates1 = site.GetCustomWebTemplates(1033);                     //SPWebTemplateCollectio

Javascript error when creating XsltListViewWebPart programatically


Hi everyone,

I am receiving a Javascript error when attempting to use the context menu on any XsltListViewWebPart that is added to a page programatically.

The JS error is:


Message: 'listTemplate' is null or not an object
Line: 2
Char: 102472
Code: 0
URI: http://teamsite.domain.com/_layouts/1033/core.js?rev=c3ROI4x%2BKHVTMbn4JuFndQ%3D%3D

The code I am using to add the webpart to the page is:


private static void AddListViewWebPart(string siteCollUrl, string siteRelativeUrl, String pageUrl, string listName, string webPartTitle, String zoneId, int zoneIndex, string viewName, PartChromeType chromeType, string toolbarType)
  using (SPSite site = new SPSite(siteCollUrl))
   using (SPWeb web = site.AllWebs[siteRelativeUrl])
    SPLimitedWebPartManager lwpm = web.GetLimitedWebPartManager(pageUrl, PersonalizationScope.Shared);
    SPList list = web.Lists[listName];
    XsltListViewWebPart lvwp = new XsltListViewWebPart();
    lvwp.ListId = list.ID;
    lvwp.ViewGuid = list.Views[viewName].ID.ToString("B").ToUpper(CultureInfo.InvariantCulture);
    lvwp.AllowClose = false;
    lvwp.AllowConnect = false;
    lvwp.AllowEdit = false;
    lvwp.AllowHide = false;
    lvwp.AllowMinimize =

Creating MS Word Document programatically in sharepoint foundation as Link Button on Master Page?



Can any body help me how to create a new document programatically for OnClick of  a LinkButton on my Homepage  as per the requirement.

I had installed MS OfficeWebApps on my Development Server which its working fine but the "Create Document " is on Top Ribbon for which the link should be on the right side of the Content Page of Home.Aspx as per the req.

Pls guide me how to achieve this.


Thanks in Advance !!!!




Thanks in Advance !!! Cheers !!! Praveen

Repeater disapears and OnItemCommand not firing


<asp:Repeater ID="rpProducts" runat="server"   OnItemDataBound="rpProducts_OnItemDataBound" OnItemCommand="rpProducts_OnItemCommand">
<asp:Label ID="Label10" AssociatedControlID="lblProduct" runat="server" Text="Product:" CssClass="label2" />
             <asp:Label ID="lblProduct" runat="server"/>
               <asp:Label ID="lblProductID" runat="server" visible="false"/>
              <asp:LinkButton ID="btnDeleteProduct" CommandName=&

Creating SPContentDatabase programatically using Object Model


Hi I m trying to create a content database programatically but getting the error "Object reference not set to an instance of an object."

any help would be highly appriciated....

Thanks in Advance.....

Creating Folder Programatically - Error


Dearn all,

I have installed SharePoint Server 2010 and I am developing a Windows application in Visual Studio 2008 C#.

What I want is to create a folder in the SharePoint site:

I am getting the following error while debuggin:

[System.UnauthorizedAccessException] = {"<nativehr>0x80070005</nativehr><nativestack></nativestack>"}

Please Find below part of my Code:




using (SPSite oSPsite = new SPSite(strTargetWebS

Hello Mr. MVP can you please reply to my questions,,,,,,"Creating SPContentDatabase programatically

Hi m trying to Create a SPContentDatabase programatically using Object Model, but getting error of "
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Deployment;

namespace CreateContentDB
  public partial class Test2 : System.Web.UI.Page
    SPWebApplication webApplication;
    //SPContentDatabaseCollection contentDBs;
    string nameDB = "CNB";
    protected void Page_Load(object sender, EventArgs e)


    protected void Button1_Click(object sender, EventArgs e)
      Uri WebAppUri = new Uri("http://amit:5003");

      SPWebApplication webApplication = SPWebApplication.Lookup(WebAppUri);

      SPContentDatabaseCollection contentDBs = webApplication.ContentDatabases;

      foreach (SPContentDatabase contentDB in contentDBs)

        if (contentDB.Status == SPObjectStatus.Online)
          contentDB.Status = SPObjectStatus.Disabled;
      //SPSite siteCollection = webApplication.Sites.Add();
    private void CreateContentDatabase(string suffix)

Programatically creating a custom Channel Sink Provider


I have the following remoting configuration to set in a custom channel sink provider:


    <channel ref="tcp" port="0">
      <formatter ref="b

Creating your SharePoint Governance Plan

One of the most common questions that I get from prospects as I'm talking to them about the creation of a governance plan and process is what does it look like. In other words, there are materials available which describe what should be in a governance plan but there isn't a ton of guidance on what the process of creating a governance plan and process are.

Use jQuery and ASP.NET AJAX to build a client side Repeater

By sending only data to the client, you can profoundly reduce the size of what you send and see a substantial increase in performance. You also allow yourself the ability to easily add features like light-weight sorting and paging on the client. This can not only improve your users' experience, but reduce server load and bandwidth requirements.

Use jQuery and ASP.NET AJAX to build a client side Repeater

By sending only data to the client, you can profoundly reduce the size of what you send and see a substantial increase in performance. You also allow yourself the ability to easily add features like light-weight sorting and paging on the client. This can not only improve your users' experience, but reduce server load and bandwidth requirements.

To that end, I'm going to walk you through these four steps to effectively implementing a client side Repeater, using ASP.NET AJAX and jQuery:

ASP.NET Repeater Combined with jQuery FAQ Plugin Demo

The plugin is really straight forward. You just have to add your FAQ items in a header element such as an h2 and content sections in spans. This could be done in a pure HTML page or the FAQ items and content could be pulled from a database or XML file like I did in the download. Once the markup is built, the plugin does the rest. It will hide the content sections, add click events to the headers to open and close the content sections, toggle the plus/minus symbols and build the index shown on the right if you want.

ASP.NET repeater control - databind with style

even used the inline editing features, which I at the time thought was the coolest way possible to write ASP.NET code ( I managed to write code to hide all other rows and only show the current one - the row being edited). With a nice looking EditTemplate it looked indeed very slick but it really turned into giant and hard to manage code behind files.

Displaying Data using ASP.NET 2.0 Repeater and C#

This tutorial will show you how to display data using the .NET Repeater Control, ASP.NET 2.0 and C#.NET

The Repeater control is a powerful tool and is easy to use.

First, you will need to import the System.Data.SqlClient namespace.

Hide a repeater in ASP.NET C# if the DataSource contains no items?

I have an ASP.NET page that uses a repeater nested within another repeater to generate a listing of data. It's to the effect of the following:
In the (C#) code-behind I'm basically using LINQ to pull a listing of information from an XML document and bind that information to the first repeater.

Searching for the answer to this, it seems the method is to determine whether the data for the nested repeater is empty. If it is, then you set the visibility of the repeater to false.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend