473,287 Members | 1,650 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,287 software developers and data experts.

Trouble Passing Values from a repeater to a function.

OK I have poked around and have not found an answer to my problem . I
have a repeater that in it's <ItemTemplate> calls a function I want to
pass the current values from the repeater to the function. I have yet
to Figgure out how to get the Evals Data to goto the function as the
current code does not work. Producing an error of :

"System.InvalidOperationException: Databinding methods such as Eval(),
XPath(), and Bind() can only be used in the context of a databound
control."
Any Help Would keep me out of the lonney bin :) Thanks in advance.
This is the repeater
------------------------------------------------------------------------------------------------------------------------------------

<asp:Repeater ID="R2" runat="server" DataSourceID="SqlDataSource2" >

<HeaderTemplate>
<table border=0>
<br />
<br />
<tr>
<td align=left>
</HeaderTemplate>

<ItemTemplate>

<%Answers(Eval("AnswerType"),eval("AnswerID"),Eval ("Answer"))%>

</ItemTemplate>

<FooterTemplate>
</td>
</tr>
</table>
</FooterTemplate>

</asp:Repeater>
--------------------------------------------------------------------------------------------------------------------------------

And this is the function.
--------------------------------------------------------------------------------------------------------------------------------
Protected Sub Answers(ByVal At As String, ByVal AI As String, ByVal A
As String)

output = ""
Select Case AT
Case "radio"
output = output & "<input id=""RB"" type=""radio""
name=""" & AI & """ value=""" & A & """ />" & A & "<br />"
Case "text"
output = output & "<input id=""RB"" type=""text""
name=""" & AI & """ value=""" & A & """ /> <br />"
Case "other"
output = output & "<input id=""RB"" type=""radio""
name=""" & AI & """ value=""" & A & """ />" & A & "<br /> <input
id=""RB"" type=""text"" name=""" & AI & """ value=""" & A & """ /> <br
/>"

Case "list"

End Select
Response.Write(output & vbCrLf)
End Sub

May 18 '06 #1
0 1180

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

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
0
by: Kent P. Iler | last post by:
Hi, I have a data repeater that is returning a list of events. One of the things I want to do is give the user a way to edit or delete an event. My plan was to use an Imagebutton that would...
1
by: MattB | last post by:
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...
3
by: renil | last post by:
I have a repeater control that displays info. from a datatable. Each row in the repeater has a checkbox. Also, I have a delete linkbutton outside the repeater control. What I'm trying to do when...
8
by: Alan Silver | last post by:
Hello, I have a repeater that has code like this... <ItemTemplate> <asp:CheckBox ID="chkDelete" Text="" RunAt="server"/> .... other stuff goes here </ItemTemplate> There is a button below...
1
by: j.t.w | last post by:
Hi. I'm new to ASP.Net and I'm running into a simple problem (I think). I'm trying to get 2 values from 2 separate queries into 2 different variables. I would then like to take the difference...
2
by: mj.redfox.mj | last post by:
Hi, Pretty basic question, apologies but being a bit of a newbie I still don't know the answer to this kind of thing! I have a repeater which, upon databind calls a subroutine, as below: ...
2
by: rocketfire97 | last post by:
I'm trying to call a COM object using C# but having no luck getting values back for passed in ref objects. I've tried the same call using VB.NET and can get data back. How would I implement the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.