473,799 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Edit data in a repeater?

Hi All

I am trying to find a way of displaying data in a datatable in such a way that ALL rows (only about 5 - 10) are editable and are updated from a single button press. I thought the best way would be to use a repeater to display the data in textboxes, then when the button is pressed to iterate through the repeater control and find all the text boxes and update the DB with the values, but I have come across a couple of problems

The main one that I need to solve is: how do I find each textbox control when I postback the data on the button press? If anyone has done this before, or has a better way of doing it, I would be grateful if you let me know

The repeater code on my page is

<asp:Repeater id="rptThreads " runat="server"> <HeaderTemplate ><table cellSpacing="1" cellPadding="1" border="0"></HeaderTemplate> <ItemTemplate>< TR><TD width="200">Doc Type(s)</TD><TD><asp:Tex tBox Text='<%# Container.DataI tem("file_type" ) %>' size="60" runat="server"> </asp:TextBox><as p:TextBox Text='<%# Container.DataI tem("max_thread s") %>' size="5" runat="server"> </asp:TextBox></TD></TR></ItemTemplate><F ooterTemplate></table></FooterTemplate> </asp:Repeater>
Nov 18 '05 #1
2 4268
You can use
Repeater.Items[i].FindControl("c ontrolName") and cast it to the respective
control.

Av.
"Steve" <ms**@zuna.co.u k> wrote in message
news:64******** *************** ***********@mic rosoft.com...
Hi All,

I am trying to find a way of displaying data in a datatable in such a way
that ALL rows (only about 5 - 10) are editable and are updated from a
single button press. I thought the best way would be to use a repeater to
display the data in textboxes, then when the button is pressed to iterate
through the repeater control and find all the text boxes and update the DB
with the values, but I have come across a couple of problems.

The main one that I need to solve is: how do I find each textbox control
when I postback the data on the button press? If anyone has done this
before, or has a better way of doing it, I would be grateful if you let me
know.

The repeater code on my page is:

<asp:Repeater id="rptThreads " runat="server"> <HeaderTemplate ><table
cellSpacing="1" cellPadding="1"
border="0"></HeaderTemplate> <ItemTemplate>< TR><TD width="200">Doc
Type(s)</TD><TD><asp:Tex tBox Text='<%# Container.DataI tem("file_type" ) %>'
size="60" runat="server"> </asp:TextBox><as p:TextBox Text='<%#
Container.DataI tem("max_thread s") %>' size="5"
runat="server"> </asp:TextBox></TD></TR></ItemTemplate><F ooterTemplate></table></FooterTemplate> </asp:Repeater>

Nov 18 '05 #2
There is some code demonstrating exactly what you describe in the
following article:

http://odetocode.com/Articles/116.aspx

HTH,

--
Scott

On Fri, 14 May 2004 03:56:02 -0700, "Steve" <ms**@zuna.co.u k> wrote:
Hi All,

I am trying to find a way of displaying data in a datatable in such a way that ALL rows (only about 5 - 10) are editable and are updated from a single button press. I thought the best way would be to use a repeater to display the data in textboxes, then when the button is pressed to iterate through the repeater control and find all the text boxes and update the DB with the values, but I have come across a couple of problems.

The main one that I need to solve is: how do I find each textbox control when I postback the data on the button press? If anyone has done this before, or has a better way of doing it, I would be grateful if you let me know.

The repeater code on my page is:

<asp:Repeate r id="rptThreads " runat="server"> <HeaderTemplate ><table cellSpacing="1" cellPadding="1" border="0"></HeaderTemplate> <ItemTemplate>< TR><TD width="200">Doc Type(s)</TD><TD><asp:Tex tBox Text='<%# Container.DataI tem("file_type" ) %>' size="60" runat="server"> </asp:TextBox><as p:TextBox Text='<%# Container.DataI tem("max_thread s") %>' size="5" runat="server"> </asp:TextBox></TD></TR></ItemTemplate><F ooterTemplate></table></FooterTemplate> </asp:Repeater>


--
Scott
http://www.OdeToCode.com
Nov 18 '05 #3

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

Similar topics

0
5014
by: Naveen | last post by:
Hi, Is the data repeater and datalist control available for win forms? if not, then are there any alternatives available? -Naveen
1
2015
by: VIswanathan S | last post by:
Hi All! How to use Data Repeater in VB.NET? Data Fields are Employee Number Name Photo Date of Joining Salary
0
3318
by: Nilesh W | last post by:
Hi I am using data repeater in my application to display data. Header template for data repeater I want add at run time because the header text for item columns read from some other resources Then how to add header template with header text for each column in data repeater at run time Thanks and regard Nilesh W
0
1042
by: hsr | last post by:
I'm trying to find a way to only display a fixed amount of characters from one field in a data repeater. The field that is read into the dataset is much larger, but I only want to display say the first 50 characters when the datarepeater is bound and displayed. Is there a way to set the number of characters in a repeater column?
9
1876
by: Robby | last post by:
In my opinion the VB6 Data Repeater has to be the most versatile control ever released by Microsoft. They also sharee this opinion when they released it but I have not been able to find its .Net equivalent. I have found a weaker versions of it in the web controls called Repeater, DataList and DataGrid. However, I have not found anything in the form controls. I can not port to .Net without it. I have an enterprise application that...
0
876
by: SimonZ | last post by:
I have data repeater. One of the row is defined: <ItemTemplate> <asp:TableCell > <%If viewState("type") = "3" then%> <%# writeLine(DataBinder.Eval(Container.DataItem, "name")%> <%else%> <%# writeLine1(DataBinder.Eval(Container.DataItem,
2
1218
by: mikeyatsony | last post by:
Hi all... I've been training a little on the whole ASP.NET and would like to know how someone would use the data repeater like this: For example, I have some data coming from a table and let's say for some of the rows, I would like to show a website for the company if they had that level of membership but for others, I would like to HIDE the website for the company. It could be as easy as a BIT field in the table like SHOWURL, if...
1
24931
by: ortega.rad | last post by:
I have a form which allows you to select a record. That record has other records asscociated with it via a table. The asscociated records of the record selected on the main form are shown in a subform. This all works fine. But then, when I try to edit a record in the subform It does not let me. I have a dropdown box, but cannot select from it... does anyone know why this is, and what I could do to fix it?
3
2695
by: lisles | last post by:
i need to edit data from the databse through a form.my code is below <?php require_once "../inc/functions.php"; require_once "../inc/vars.inc.php"; sessionCheck(); session_start(); $old_sessionid = session_id(); //i've added these lines
1
1951
by: Craig Borri | last post by:
I have 2 data repeaters with various controls. One repeater has a checkbox, and there is a corresponding text box on the other. The check box has an onclick that will run javascript to blank out the corresponding text box when it is unchecked. This all works fine if there are 200 or fewer items on the destination data repeater. When there are over 200 or so items, it seems to lose the text boxes on the later ones. There is no error. The...
0
9688
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10490
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10238
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9077
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4145
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.