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

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

Dynamically Binding Header of Repeater Control

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :ASP.Net
Hi , I am stuck up into following Issue while binding Repeater control dynamically from database I have repeater control which I want to populate from database.. asp:Repeater id="Repeater1" runat="server">   <HeaderTemplate>      <table border="1">         <tr bgcolor="#ffcc99">            <th><asp:label id="Lname" runat ="server" text = "???"  ></asp:label></th> <th><asp:label id="Fname" runat ="server" text = "???"  ></asp:label></th>         </tr>   </HeaderTemplate>   <ItemTemplate>      <tr bgcolor="#ffcccc">        <td><%# DataBinder.Eval(Container.DataItem, "Col1") %></td>        <td><%# DataBinder.Eval(Container.DataItem, "Col2") %></td>      </tr>   </ItemTemplate>   <FooterTemplate>   </table>   </FooterTemplate></asp:Repeater&g

View Complete Post

More Related Resource Links

Dynamically (on client side) populating data control (repeater) when dropdown item is selected

Hello!I'm currently working on a project and I want to make as much things as possible performing on client side - with as little loading as possible.The project consist of three "main" pages. On one page I use jQuery DataTable plugin which is working great. One page has tabs (using jQuery). I want to put datacontrol (repeater) on this site and when  user selects one item in dropdown, data in repeater loads on client side, without performing the action on server.I wonder if this is possible and if somebody can give me some case to help with?Thanks!I hope I was clear enough. all the best

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.

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.

Adding new items to a Repeater control with transitions?



I am currently in the process of writing a facebook type 'activity feed' for a site. Currently I am binding the last 10 items to a repeater control, which contains a usercontrol representing each item. This works fine but there are a couple of requiremnts that are giving me problems and wondered if the the good people of the forum could make some suggestions.

The requirement is that when a user clicks a refresh button any new events are added to the top of the list, the previous items drop down and the equivalent number of old items drop off the bottom, all with nice slider transitions.

I have put the repeater inside of an update control and are able to handle the transitions by using RegisterStartup script to drop jquery calls onto the page for the slider. However I cannot find a way to dynamically add or remove new datarows to the repeater. I need the old items to stay in the repeater and be pushed down by the new items, so completely refreshing the datasource seems like a bad idea.

I was thinking about maybe storing the datasource in the viewstate and adding rows to that, maybe with an extra column on the end which stores what transition is needed on the databind for my jquery, but there will be a 'View more items' link at the bottom of the page, so I am worried that the list could get pretty large and there

using the linqDataSource control programmatically (dynamically)



my scenario is this: I want to use the linqDataSource control to bind data to a gridview for it's efficient built-in paging and sorting features *but* I don't want the data to be bound until the user has input various search parameters, so I need to bind the data from a button click event. Also, the search options will be somewhat complex in that there will be several optional search parameters, via various dropdowns and textboxes, so I can't just declaratively/statically setup all the WHERE parameters on the linqDataSource (at least I'm assuming I can't, or that it may result in poor performance if I do and just assign default values like the everything wildcard '%' for the cases the user doesn't use a particular search parameter). Given that brief description, here is an example of what I'm doing, but with only one WHERE parameter for simplicity, the real code will be adding anywhere from 1 to about 12 WHERE parameters depending on how the user sets the search options in the GUI.

the linqDataSource on the aspx page:

<asp:LinqDataSource ID="ldsMain" runat="server" 
        Select="new (field1, field2, field3, etc..)" 

Persist data in a dynamically populated ListBox in a user control


Hi All,

I am trying to persist data in a dynamically populated ListBox in a user control. Here are the details

I have a user control which contains a a listBox and button. On Page_Load of user control I am populating the ListBox control with some values. On Click of button, I am trying to fetch the values which I have selected in ListBox. Though this seems very simple and straight forward I am unable to fetch values.

My Page_Load Function

void Page_Load(object sender, EventArgs e)










My Click Function

Protected Void Button1_Click(object sender, EventArgs e)


       string strValue = listBox.SelectedValue



I have placed brake point at Page_Load and on click function, I am seeing that the moment the breakpoin

Extreme ASP.NET: The Only Data-binding Control You'll Ever Need


Fritz Onion demonstrates how the ListView control in ASP.NET 3.5 makes data-binding tasks easier with support for styling with CSS, flexible pagination, and a full complement of sorting, inserting, deleting, and updating features.

Fritz Onion

MSDN Magazine March 2008

Extend ASP.NET: Simplify Data Binding In ASP.NET 2.0 With Our Custom Control


The wwDataBinder control addresses simple control data binding--binding simple form controls like textboxes, checkboxes, and the selected values of list controls to individual data or object values.

Rick Strahl

MSDN Magazine December 2006

Find a header control


Via RowDataBound, how to find a control in the header row?

This is what I have but not working!!!

If e.Row.RowType = DataControlRowType.Header Then
  Dim cbHeader As CheckBox = CType(GV_update.HeaderRow.FindControl("HeaderLevelCheckBox"), CheckBox)
End If


Dynamically load user control without postback


Hi all,

I need urgent help. (c#coding)

In my base page, I have a dropdownlist control which loads different usercontrols on selectedindexchanged event.

While loading these usercontrols, my page postbacks all the page. I used updatepanel but again same problem.

Is there any way to load controls without postback? I Really need help as soon as possible.

Here is my code:

protected void Page_Init(object sender, EventArgs e)
        if (Session["control"] != null)
            string c = Session["control"].ToString();
            if (c == "1")
                iuc = (IlkogretimUC)LoadControl("~/Controls/Ilkogretim.ascx");
                dl.SelectedValue = Session["control"].ToString();
            else if (c == "2")
                luc = (LiseUC)LoadControl("~/Controls/LiseUC.ascx");
                dl.SelectedValue = Session["control"].ToString();
            else if (c == "3")
                youc = (YuksekokulUC)LoadControl("~/Controls/Yuksekokul.ascx");

Child control in Repeater



     I am trying to find a child control from a repeater control's child control. I have the following structure like a top control is a repeater, below which is a Panel and below this is a DateControl(custom control).

I want to find the DateControl.

<asp:Repeater runat="server"
                       <asp:Panel ID="pnlAddDependent"

                                  <xyz:DateControl runat="server" ID="dfDepBirthDate"


When iam trying like this, i am getting the "Object Reference not set error". Please help, it is urgent.

if (this.rptMembers.FindControl("pnlAddDependent").FindContro

Help with updating database with values from Repeater control using c#


Hello, I'm new to ASP.NET 3.5 with C#. I really need some help.

I used a Repeater control to create a simple (editable) list where, when a user logs in, they can edit their list of expenses.  The ASP page works fine.

 My issue is with the code-behind.  I am really confused with how to extract the values from the repeater control. The FindControl method does not seem to be working.  Also, the code I am using resets my 'Amount' values back to 0.00. (0.00 is the amount the user sees when they first encounter the page).

 Here's a portion of the code on the ASP page:

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"





<td><asp:Label ID="lblExpId" runat="server"  Text='<%# Bind("ExpId") %>'></asp:Label> </td>

 <td><asp:Textbox ID="lblExpense" runat="server" Width= "190px" Text='<%# Bind("ExpenseName") %>'></asp:Textbox> </td>

 <td><asp:Textbox ID="txtAmount" runat="server" Width= "100px"

Want to Create Table Dynamically With text Control in WinForm Csharp

Hello To All... from Many Days i m tryng to create a simple table using csharp in WinForm.Which will include textbox in each cell according the Passed No of Col & Row. but not getting the proper result. Actually i want to trace each cell data and want to save each cell data to data base : eg. in cell 11(1col & 1row) i m having Combobox which having some item list and when the user select the list item the data will save to the database. Regards, Praveen    What is the Key of Life ... Its Sharing Your Thought & Knowledge ...

Binding an event method from a control in a seperate window

How would you bind a event method from a control back to a seperate window?  I have a ActiveX control hosted in a WindowsFormsIntegration wrapper.  That is operating in its own window along with all its events.  The properties of the control are handled by a class that defines the dependency objects (thanks Bob) to provide a view model between it and a window with controls for setting/getting those properties.  Since events constrained to Window 2, is it possible to bind the events back to Window 1?

Binding byte[] to image control in navigation application leaks

Hi there, I have a (minimal) navigation application with two pages. Page1 contains an image. Switching between pages is done via a buttonhandler in code behind, for instance, (this.NavigationService.Navigate(new Page2())) The image is loaded in code behind via: private void LoadImage() { string fileName = "./images/image.bmp"; if (!new FileInfo(fileName).Exists) throw new Exception("File name doesn't exist"); using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { this.ImageData2 = new byte[fs.Length]; fs.Read(this.ImageData2, 0, System.Convert.ToInt32(fs.Length)); fs.Close(); } } ImageData2 is a byte[] property that sends a propertychange event on changing. ImageData2 is bound to an image in xaml: <Image Grid.Row="1" Source="{Binding Path=ImageData2, Mode=OneTime}"/> When we unload Page1 the following clean up code is executed private void Page_Unloaded(object sender, RoutedEventArgs e) { this.ImageData2 = null; GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } Now, when I start changing pages, I expect the Page we leave to unload, so the GC removes the byte array. However, it doesn't. Am I missing something? Binding the image to a BitmapImage (ImageData1, as you might have guessed:-) ) doesn't leak.

jQuery Rating Control in Repeater - Not Duplicating per Record

Hi Everyone,There is a similar instance of this @ http://forums.asp.net/p/1380776/2919093.aspx#2919093 However I haven't had a response, maybe due to the age of the topic, but the problem is different in the sense I am not using AJAX Rating Control, I am using radio buttons contained in a Div named Ratings, which is picked up by jQuery to style to radio buttons accordingly. The output is that it will put the stars on the first record but anything after just shows origional unstyled radio buttons. Just thinking off the top of my head, but does anything need to be put in the ItemDataBound event? The jQuery for the stars etc were attained from the link below:http://orkans-tmp.22web.net/star_rating/index.html#demos=&main-menu=0&demo-tabs=3 Here is my code:.ASPX:<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Admin_Test" Title="Untitled Page" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="CPCHeader" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="AdminCPC" Runat="Server"> <asp:R
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