OK, never mind my last post. It was easy enough to refer to the table the
repeater is bound to, but I made a big, incorrect assumption in that post.
In my last post I thought I was successfully getting values from the
textboxes in my repeater. It turns out I am not and I can't see what I'm
doing wrong. I've had this problem before and just ended up taking a
different route to avoid it. Now I REALLY need to figure out what I'm doing
wrong.
This is for a configurable web survey form that is driven by SQL server
tables.
The repeater is coded like this:
<asp:repeater id=rptQuestions runat="server" DataSource="<%# DsQuestions1
%>" DataMember="que stions">
<ItemTemplate >
<b>
<%#Convert.ToSt ring(DataBinder .Eval(Container .DataItem, "qNum"))%>
. </b></td>
<%# DataBinder.eval (Container.Data item, "question") %>
</td>
<br>
<asp:TextBox ID="ans" Runat="server" />
</ItemTemplate>
<HeaderTemplate >
<b>Please answer as concisely as possible </b>
<br>
<br>
</HeaderTemplate>
<FooterTemplate >
</FooterTemplate>
<SeparatorTempl ate>
<br />
<hr>
<br />
</SeparatorTempla te>
</asp:repeater>
-----------------------------------
It renders as I would expect using the values from the database. I also have
a "Submit" button. This is the click event:
Private Sub btnSubmit_Click (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnSubmit.Click
Dim strAns As String, i As Int16, dtQs As DataTable
Dim aAns(rptQuestio ns.Items.Count - 1, 2) As String
dtQs = DsQuestions1.Ta bles("questions ")
For i = 0 To rptQuestions.It ems.Count - 1
Dim currentTextBox As TextBox _
= CType(rptQuesti ons.Items(i).Fi ndControl("Ans" ),
WebControls.Tex tBox)
'load up an array with answers and corresponding question IDs
aAns(i, 0) = currentTextBox. Text
aAns(i, 1) = Convert.ToStrin g(dtQs.Rows(i)( "qID"))
Next
End Sub
------------------------------------
So when I look at the values in my array, the values from the datatable (the
"qID" value) is being correctly assigned. My problem is the
currentTextBox. text is always = "" even when there is text in the box. Can
anyone tell me why I'm not getting the entered values? Please?
Thanks!
Matt 1 3833
FYI - the problem was I was not putting the repeater.databi nd inside a If
Not IsPostBack condition. Hope that helps if anyone eles hits this issue.
Matt
MattB wrote: OK, never mind my last post. It was easy enough to refer to the table the repeater is bound to, but I made a big, incorrect assumption in that post.
In my last post I thought I was successfully getting values from the textboxes in my repeater. It turns out I am not and I can't see what I'm doing wrong. I've had this problem before and just ended up taking a different route to avoid it. Now I REALLY need to figure out what I'm doing wrong.
This is for a configurable web survey form that is driven by SQL server tables.
The repeater is coded like this:
<asp:repeater id=rptQuestions runat="server" DataSource="<%# DsQuestions1 %>" DataMember="que stions"> <ItemTemplate > <b> <%#Convert.ToSt ring(DataBinder .Eval(Container .DataItem, "qNum"))%> . </b></td> <%# DataBinder.eval (Container.Data item, "question") %> </td> <br> <asp:TextBox ID="ans" Runat="server" /> </ItemTemplate> <HeaderTemplate > <b>Please answer as concisely as possible </b> <br> <br> </HeaderTemplate> <FooterTemplate > </FooterTemplate> <SeparatorTempl ate> <br /> <hr> <br /> </SeparatorTempla te> </asp:repeater> ----------------------------------- It renders as I would expect using the values from the database. I also have a "Submit" button. This is the click event:
Private Sub btnSubmit_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSubmit.Click Dim strAns As String, i As Int16, dtQs As DataTable Dim aAns(rptQuestio ns.Items.Count - 1, 2) As String
dtQs = DsQuestions1.Ta bles("questions ")
For i = 0 To rptQuestions.It ems.Count - 1 Dim currentTextBox As TextBox _ = CType(rptQuesti ons.Items(i).Fi ndControl("Ans" ), WebControls.Tex tBox) 'load up an array with answers and corresponding question IDs aAns(i, 0) = currentTextBox. Text aAns(i, 1) = Convert.ToStrin g(dtQs.Rows(i)( "qID")) Next End Sub ------------------------------------
So when I look at the values in my array, the values from the datatable (the "qID" value) is being correctly assigned. My problem is the currentTextBox. text is always = "" even when there is text in the box. Can anyone tell me why I'm not getting the entered values? Please?
Thanks!
Matt This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: The Plankmeister |
last post by:
Hi...
I'm trying my hardest to understand fully how sessions work and how best to
use them. However, all I can find is information that doesn't tell me
anything other than that sessions store information between pages, which I
knew already. I want to know HOW sessions work! If anybody has any good
links to material that explains sessions fully, then please send those links
this way!
I'm particularly interested in the...
|
by: The Plankmeister |
last post by:
I'm sure this should work:
echo preg_replace("/(\w)(\!w)(\w)/","\\1\. \\3","this is.a test.to see. if
it. works");
It should output:
this is. a test. to see. if it. works
But it doesn't. The string is unaltered. What am I doing wrong?
|
by: Wired Earp |
last post by:
I don't get it. First of all, it claims to run on a JRE. This is obviously
a fraud, it even says so when you attempt to start it: "The JAVA_HOME
variable should point to a JDK and not a JRE". I can accept that, being
new to it all and not really caring, but things are
going downhill rather fast from here. I'm installing a simple webapp
in the the the webapps folder, complete with a context.xml in the
conf folder. My servlet behaves just as...
|
by: The Plankmeister |
last post by:
Hi...
I'm attempting to keep everything I write compliant with xhtml 1.0 strict.
And It's very bizarre. Why on earth won't this validate:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
|
by: Jim Moe |
last post by:
Hello,
I am (slowly) in the process of changing a table-based layout to
CSS/div-based. One area that uses tables a lot is the main nav menu. I
have discovered that tables have advantage: all browsers display them the
same.
I created a CSS to use <ul> as the list container rather than <table>.
It works quite well -- in Mozilla. With IE V5 or 6 extra spacing is added
between each button image and the large spaces are compressed; it is...
| |
by: Henry Rollins |
last post by:
This is driving me nuts.
I have created a Class Assembly in .NET C# which is to be used by
traditional ASP pages. I registered it just fine with the regASM command
and it work - about 2/3 of the time. The rest of the time I launch the
site and the following error is generated:
'80070002'
|
by: Cliff Williams |
last post by:
How are people managing multiple, interdependent projects in the same
solution? If I have to rebuild my solution file one more time, I think
my head is going to spin around and pop off.
I've seen tools like Nant around, but it seems to have a pretty big
learning curve. Is it easier than I think? How does it integrate with
debugging? Are there other tools?
BTW, I've read dozens of posts describing similar problems along with
the...
|
by: Toby Mathews |
last post by:
Hi there,
I have a problem with a C# AP.NET app. running on my local machine,
Sporadically (but more and more frequently) I get the above error message
when code running on my laptop trys to connect to our SQL Server, which is
located elsewhere. The same code NEVER does this on our development and live
machines (both of which are in the same hosting facility as the SQL Server),
and other app's that I write/run locally, and that connect...
|
by: RWC |
last post by:
Hi Folks,
I have a windows 2000 server installation, IIS is running and the ASP.NET
1.1 SDK has been installed. I'm reading a book on ASP.NET and the lessons
call for the first line to read <%@ Page Language="VB"%>. When I save the
page and run it (from a remote machine) I get the following message;
"The scripting language 'VB' is not found on the server."
I haven't been able to find ANY other solution. When I type this into
|
by: darrel |
last post by:
I'm using some validators for a form.
I'm noticing that it writes the text out to the browser as a SPAN with it's
visibility set to none. The problem is that it still takes up space, so I
have gigantic gaps in my form. It SHOULD be set to display: none instead. Is
this a setting in the control somewhere or is this just a huge oversight on
MS's part?
If the latter, any suggestions for a workaround? Perhaps wrapping the
validator in a...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
| |
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...
|
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...
| |