Trouble Passing Values from a repeater to a function.

T

tenaka2k

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top