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

  • Thread starter Thread starter lh
  • Start date Start date
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>";

}
 
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/
 
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
 
Back
Top