473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Help with repeater and datagrid

Hi I need help to display and edit data in a data grid within a repeater.
The code is below:

Sub dgrdEvents_EditCommand(sender As Object, e As DataGridCommandEventArgs)
dgrdEvents.EditItemIndex = e.Item.ItemIndex
BuildList()
End Sub
<asp:Repeater ID="rptEvents" RunAt="server">
<ItemTemplate>
<p><strong><%# Container.DataItem("summary") %></strong>
<asp:DataGrid id="dgrdEvents" Width="500" BorderWidth="0" CellPadding="3"
CellSpacing="0" DataKeyField="event_id"
DataSource='<%# FilterEvents( Container.DataItem("event_id") ) %>
OnEditCommand="dgrdEvents_EditCommand"

<Columns>
<asp:BoundColumn Visible="False" HeaderText="" DataField="eventdate_id"
SortExpression="eventdate_id" />
<asp:TemplateColumn HeaderText="Start Date">
<ItemTemplate>
<asp:label Text='<%# Container.DataItem("start_date") %>' runat="server"
/>
</ItemTemplate>
<EditItemTemplate>
<asp:Textbox id="txtStartdate" Columns="8" Text='<%#
Container.DataItem("start_date") %>' runat="server" />
</EditItemTemplate>
<ItemTemplate>
<asp:label Text='<%# Container.DataItem("end_date") %>' runat="server"
/>
</ItemTemplate>
<EditItemTemplate>
<asp:Textbox id="txtEnddate" Columns="8" Text='<%#
Container.DataItem("end_date") %>' runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn EditText="Edit" UpdateText="Save"
CancelText="Cancel" />
</Columns>
</asp:DataGrid>
</ItemTemplate>
</asp:Repeater>
Clicking on the Edit link should open an item (eg. start date) of the data
grid for editing. I am getting this error:
"Name 'dgrdEvents' is not declared
.....
Line 109: dgrdEvents.EditItemIndex = e.Item.ItemIndex".

If datagrid is not in a repeater the code above works fine. I understand
that because of the nature of a repeater the id of given data grid is not
known and I cannot set it statically. So my quesiton is how can I open a
given row in a grid for editing, given that this grid resides inside of a
repeater.
Thank you
Nov 18 '05 #1
2 1775
dump the repeater and use a datalist
Nov 18 '05 #2
This is not my app and I cant really make these kind of changes, at the end
if there is no alternative I would have to, but I think there should be a
way. Unfortunately, I am a novice and have to learn as I go...
"Josh" <so*****@microsoft.com> wrote in message
news:Oe**************@TK2MSFTNGP10.phx.gbl...
dump the repeater and use a datalist

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
2
by: Daniel | last post by:
I'm new to .Net and all of its abilities so I hope this makes sense. Basically I'm confused on when is the appropriate time to use web forms controls vs. regular HTML. For example in ASP...
7
by: Scott Schluer | last post by:
Hi All, I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a combination of a couple datagrids to...
4
by: News | last post by:
I have a page with many controls. Among these controls there is a table which is a datagrid with nested repeater inside. My problem is that I can not use DataGridCommandEventArgs to get datagrid...
3
by: WebMatrix | last post by:
I am struggling with implementing somewhat complicated UI web-control. I explored Repeater, but I am not sure if it's the best way to go. I am leaning towards writing my own custom control and...
1
by: Ryan Ternier | last post by:
I'm having the issue is when I re-bind my repeater to show the changes done to it from the code behind. I'm binding this repeater from a DataTable that is stored in the ViewState for now. It...
3
by: gg77 | last post by:
Hi, I don't have much knowledge of the table control. I am basically trying to use a table thats populated with data rows from a dataSet but currently things aren't working for me. below is...
2
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox...
1
by: Hans Merkl | last post by:
Hi, I must be missing something here. In a DataList and DataGrid I can use the property DataKeys to identify the selected element and get to its values. But I can't find a way to do the same in...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.