Render blocks and DataBinder making me CRAZY!!!!!

L

lh

I'm trying to pass the values from the databinder.eval statmetn into a
method in the codebehind. The code below is within a Repeater.
The error that i'm currently getting is
Compiler Error Message: CS1502: The best overloaded method match for
'projectName.dspBranchAdministration.ShowPreview(string)' has some invalid
arguments

What is wrong?

Thanks


//asp.net within repeater class
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem,"vcBranch")%></td> //shows
properly
<td><a href='dspEditBranch.aspx?intBranch=<%#
DataBinder.Eval(Container.DataItem,"ridBranch")%>&chk=<%#
projectName.Utility.GetRandomString(DataBinder.Eval(Container.DataItem,"ridB
ranch").ToString())%>' class="button">Edit</a></td>
<%# ShowPreview(DataBinder.Eval(Container.DataItem,"vcBranch"))%>
//doesnt work
</tr>
</ItemTemplate>


//in codebehind
protected string ShowPreview(string sitehost)

{

return "<td>wtf</td>";

}
 
R

Rick Strahl [MVP]

If you have real complex expressions it sometimes works better if you create
a method at the form level and call that instead of nesting statements too
deep in the databinding expressions. I've had major headaches with this as
well and using a simplified method usually solves the problem. Most likely
that method will also be faster as it won't have to eval expressions in many
cases only the single method call.

Actually, looking at your code I think the problem is that the parameters to
your funciton need to be properly cast. Try using (string) in front of the
Databinder.Eval().

Regards,

+++ RIck ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
 
L

lh

Doh! That did it. Thanks
Rick Strahl said:
If you have real complex expressions it sometimes works better if you create
a method at the form level and call that instead of nesting statements too
deep in the databinding expressions. I've had major headaches with this as
well and using a simplified method usually solves the problem. Most likely
that method will also be faster as it won't have to eval expressions in many
cases only the single method call.

Actually, looking at your code I think the problem is that the parameters to
your funciton need to be properly cast. Try using (string) in front of the
Databinder.Eval().

Regards,

+++ RIck ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
----------------------------------
Making waves on the Web



projectName.Utility.GetRandomString(DataBinder.Eval(Container.DataItem,"ridB
 

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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top