473,407 Members | 2,676 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,407 software developers and data experts.

Howto Add Data in Repeater and read it in code-behind ?

Hi. I have the following puzzle:
I have in the DB a table name "Login_QAByPIN". In it I'll store, for
identification purposes, 6 questions with 6 answers for each
registered pin. On the registration page, I have the following HTML:

<asp:repeater ID="rptQA" runat="server">
<ItemTemplate>
<tr>
<td><%# Container.DataItem("Q") %></td> <td><asp:TextBox
ID="txtAnswer" runat="server" Width="98%"></asp:TextBox></td> </
tr>
</ItemTemplate>
</asp:repeater>

On registration, the user should be able to enter/edit the answers (in
txtAnswer) and on cmdRegister_Click I want to update my
"Login_QAByPIN" table. The code would be (SNIP):

For intCount = 1 To rptQA.Items.Count
cmd = New SqlCommand(strSprocName, cnSQL)
cmd.CommandType = CommandType.StoredProcedure

objSqlParam = New SqlParameter("@PIN", SqlDbType.NVarChar)
objSqlParam.Value = m_strPIN
cmd.Parameters.Add(objSqlParam)

objSqlParam = New SqlParameter("@QuestionID", SqlDbType.NVarChar)
objSqlParam.Value = intCount
cmd.Parameters.Add(objSqlParam)

objSqlParam = New SqlParameter("@EncryptedAnswer",
SqlDbType.NVarChar)
objSqlParam.Value = EncryptString(CType(rptQA.Items(intCount -
1).Controls(1), TextBox).Text)
cmd.Parameters.Add(objSqlParam)
cmd.ExecuteNonQuery()
Next intCount

My problem is that
CType(rptQA.Items(intCount - 1).Controls(1), TextBox).Text
is always blank.

How do I refer to the data the user entered ? I am not able to
retrieve it !

Thanks a lot for spending the time reading this.
Alex.
Nov 21 '07 #1
1 2858
I don't think that the Repeater supports data entry. You might look at the
DataList and DataGrid controls, or rethink your apporach using a form
instead of a table.

HTH,

Steve

"Radu" <cu*************@yahoo.comwrote in message
news:d0**********************************@41g2000h sh.googlegroups.com...
Hi. I have the following puzzle:
I have in the DB a table name "Login_QAByPIN". In it I'll store, for
identification purposes, 6 questions with 6 answers for each
registered pin. On the registration page, I have the following HTML:

<asp:repeater ID="rptQA" runat="server">
<ItemTemplate>
<tr>
<td><%# Container.DataItem("Q") %></td<td><asp:TextBox
ID="txtAnswer" runat="server" Width="98%"></asp:TextBox></td</
tr>
</ItemTemplate>
</asp:repeater>

On registration, the user should be able to enter/edit the answers (in
txtAnswer) and on cmdRegister_Click I want to update my
"Login_QAByPIN" table. The code would be (SNIP):

For intCount = 1 To rptQA.Items.Count
cmd = New SqlCommand(strSprocName, cnSQL)
cmd.CommandType = CommandType.StoredProcedure

objSqlParam = New SqlParameter("@PIN", SqlDbType.NVarChar)
objSqlParam.Value = m_strPIN
cmd.Parameters.Add(objSqlParam)

objSqlParam = New SqlParameter("@QuestionID", SqlDbType.NVarChar)
objSqlParam.Value = intCount
cmd.Parameters.Add(objSqlParam)

objSqlParam = New SqlParameter("@EncryptedAnswer",
SqlDbType.NVarChar)
objSqlParam.Value = EncryptString(CType(rptQA.Items(intCount -
1).Controls(1), TextBox).Text)
cmd.Parameters.Add(objSqlParam)
cmd.ExecuteNonQuery()
Next intCount

My problem is that
CType(rptQA.Items(intCount - 1).Controls(1), TextBox).Text
is always blank.

How do I refer to the data the user entered ? I am not able to
retrieve it !

Thanks a lot for spending the time reading this.
Alex.

Nov 22 '07 #2

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

Similar topics

0
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
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
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 ...
0
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...
9
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...
0
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%>...
2
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...
3
by: Sun | last post by:
as the subject, I 'd like to know how to include a piece of text as input in the source code so that I do not need to read in data from files. I remember there is some thing like this in Perl, have...
5
by: Gilles Ganault | last post by:
Hello Out of curiosity, I was wondering what happens with session data: I read that session data are saved on disk as eg. /var/sess_ID (which is already a performance issue since accessing a...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.