Need help binding data to GridView control inside a Repeater control


How do I bind data to a GridView control that is inside a Repeater control?


3/6/2009 9:49:00 PM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 17

Looks like I bind the data to the Repeater control then handle binding individual sets of data to GridViews in the Repeater's OnItemDataBound event. Is this correct?

If so, how do I pull the data back into DataTable in the OnItemDataBound event so that I can further process it i.e. slice it up so that I can bind it to multiple GridViews?


3/6/2009 10:10:02 PM

Hi SamU,

Yes, you can handle ItemDataBound event of Repeater to generate the data source of inner GridView. The data source (such as DataTable) of GridView is usually generated by a primary key from the outer Repeater, so you can get this value from the DataItem in each item in ItemDataBound then do a query with sql statement to return a DataTable. This is the common way. Or you can use DataSource control to bind the inner GridView and set select parameter in it. Then you can assign to this select parameter in ItemDataBound event of Repeater.


Qin Dian Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
3/11/2009 4:50:45 AM

Similar Artilces:

Help Req: !!! :- On Disabling Controls Present inside a Gridview control
Hi All, We have A requirement Where we have disable controls inside a grid.These controls can be textbox, DropDownlist (in TemplateField), ComandField present inside the grid.We have to call a generic method for doing the same .(since it can be done for multiple grid.) PFB the code snippet we use. Which disables all the controls inside the page.The bolded part of the code is used to loop inside a grid view.(Not Working.)Is this ideal way to deal with the requirement.Or can someone suggest be a better way.        public void DisableMe(Page p1, st...

Bind Data to an Image Control not in a Data Presentation Control
I've been searching for two days but I don't really know what to search for.I'm making a site for a photographer.  The Default.aspx page displays Albums by showing a title, image and description from the database table Albums. Click an album to view the contents and it passes the QueryString which is AlbumName.  The ViewAlbum.aspx page uses the QueryString to display an UpdatePanel holding a Large Image and a Repeater full of dynamically filled ImageButtons for thumbs.  Both are from the database table Photos and are retrieved using an ObjectDataSource. Click the ...

Calendar Control inside Repeater, Handling Child control events in parent Data Control
Hi all,I've been researching a problem i have for a couple of days now and i'm still not sure how to even start to handle it.I'm essentially trying to build a page that will display custom form fields/controls for individual items/rows inside a repeater.I've got a fairly complex calendar i need to have working inside each individual row of the Repeater. The calendar is set up to fire the following events: OnDayRender="Calendar2_DayRender" OnSelectionChanged="Calendar2_SelectionChanged" OnVisibleMonthChanged="Calendar2_VisibleMonthChanged"My first question is how do i go about handling these...

Getting the control id of a control inside gridview control
 uhmm.. a little bit confusing regarding my subject because i dont know how to say the way my problem is how can i get the id of a control (e.g. textbox) inside the gridview... and the textbox is in the templatefield... is there any way i can get its id??  hoping i could get a reply as soon as possible... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =) What do you want's to do by getting the id of the Text box? Do you want's to find particular Textbox with certain id ? Kamran ShahidSr. Software Engineer(MCP,,MC...

Data presentation control in another Data presentation control
 Hello,I want to make a menu with datalist or gridview control.Basically,the menu will be like this,Categories     Sub Categories.For example, for COMPUTING category there will be NOTEBOOKS DESKTOPS etc.There will be a image for CATEGORIES and linkbuttons with Subcategories.If I put a datalist inside a datalist and a link button inside the second datalist visually it satisfies my need.However,CommandArguments come from database to linkbutton.Andwhen one of these command buttons is cliked it must go to proper page.I dont know how to wrie an event_handler ,specifically, for...

How to bind data on the control inside another control?
NullReferenceException was thrown when I execute the following code: Dim cboCRTCostType As DropDownList = CType(Me.grdTrainingCosts.FindControl("cboCRTCostType"), DropDownList) With cboCRTCostType .DataTextField = "Type" .DataValueField = "Type" .DataSource = dtCRTCostType .DataBind() End With grdTrainingCosts is a data grid control hosting the drop down list control. It blown out on the creation of the drop down list: cboCRTCostType. Any idea why? I ...

Finding LinkButton Control inside of Repeater control!!! Help
I have LinkButtons in which are placed inside of a repeater control. I am trying to be able to retrieve that linkbuttons .text value in a onclick event. Here is my HTML code:---------------------------------------------------------            <asp:repeater id="topics" runat="server">                <itemtemplate>                   <asp:LinkButton id="TopicLink1"  OnClick="_TopicClick"&...

Need help in UpdateProgress Control inside ModalPopup Control
 Hi All,        I need to show the progress control inside ModalPopup Control.  Everytime I hit the button, the modalpopup should show the progress while the background code of the button is working.  Modalpopup dialog show disappear when the background executing is done.  For modalpopup control I set the targetcontrolID as the ID of the button.          When I click the button, the modalpopup dialog show up.  But it doesn't trigger the background code of the button.  Do I miss anythi...

Edit data with GridView Control ? or another control ? help
I use GrivView in ASP.Net 2.0 to show data from DataTable. And i want to edit some fields in some rows. How can I do it? If i touch EDIT button - all columns, which have ReadOnly=false, switch into EDIT mode. But I want, that in first raw I can edit 2,3 column and in second row only 3 column. How can I do it ? ...

User control inside another user control data binding problem
Hi allmy problem that drives me crazy for already 2 days is the following...I have a page default.aspx, user control UserProfilesList.ascx, and another user control UserPic.ascx inside the first one like this (UserProfilesList.ascx) <asp:DataList ID="UserPicsDataList" RepeatColumns="5" runat="server"> <ItemTemplate> <uc1:UserPic ID="UserPicViewer" UserId='<%# Eval("ID") %>' runat="server" /> </ItemTemplate></asp:DataList>----------------------------------------------------...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

Binding controls inside the datalist control
Hi All, I am trying to render flash movie files inside a data list contol which is bounded to the database. What i wanna to do is to get the value from the data list as itme index and then render the falsh movie file accordingly. I have a fucntion for that render for flash file. My problem is that i want to make a call to that render function from my data list. To hold that flash file i am using a place holder in the web form. i come to a solution where i am using objF = (PlaceHolder)e.Item.FindControl("FlashObj"); Render(objF); its working but i am not convienced with that. is the...

How do I bind data to a control in the CreateUserWizard control?
Hi,  Does anybody know of any example of how to bind data to a control in the CreateUserWizard control? I found some good articles on customizing the the CreateUserWizard control but none of them give me an example of going to a database table and binding that data retrieved to custom list control like a drop down list to display to the user in the CreateUserWizard control? Thanks!! I found some examples of how to do this, although I wish I knew what is the prefered way to customize or extend membership data, ie your own membership provider, or just writing to a table af...

ajax control in data presentation controls
can i add ajax controls (MaskedEdit) to presentation controls (dataGrid, dataForm)?? Hi,of course. But keep in mind that those controls are extenders, so you append them to an existing control. Just convert your GridView / DetailsView-fields into templated fields and add the extender you'd like to use to the controls.RegardsMarco Buerckel Don't forget to mark posts that were helpful as answers. Actually, if you looked at the source code for the Masked Edit Extender, you'd see  [TargetControlType(typeof(TextBox))]Meaning, targeting any control type other than textboxes...

Web resources about - Need help binding data to GridView control inside a Repeater control -

GridView SelectedItem Binding Gotcha in WinRT
Last night when I was doing some WinRT hacking I was trying to setup databinding to the selected item in the GridView control and I ran into ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Advanced Search Gridview Latest News Releases All ...

CNW Group
... Services Beyond the Wire About CNW my CNW CNW Access CNW Directories Financials Webcasts Events my CNW All News Releases Advanced Search Gridview ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Add a Filter Gridview Latest News Releases All Today ...

New CmdLets of Powershell 2.0
New CmdLets of Powershell 2.0

Price Drop: Softbox
... objects- create product reflection- changing the background with something more interestingUse it as:- softbox- honeycomb softbox- gridview ...

Profile.aspx: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 25 Oct 2012 - Upcoming stories is a community based news site edited by our members. It specialises in .NET development techniques, technologies and tools including ...

View Features - ExtendASP
Call 847-681-9827 or Request a Demo View Features Testimonials Pricing About Us Coming Soon ExtendASP exposes every feature, more than any other ...

Resources last updated: 11/28/2015 2:57:01 PM