Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Render blocks and DataBinder making me CRAZY!!!!!

Reply
Thread Tools

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

 
 
lh
Guest
Posts: n/a
 
      10-17-2004
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(s tring)' 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.Eva l(Container.DataItem,"ridB
ranch").ToString())%>' class="button">Edit</a></td>
<%# ShowPreview(DataBinder.Eval(Container.DataItem,"vc Branch"))%>
//doesnt work
</tr>
</ItemTemplate>


//in codebehind
protected string ShowPreview(string sitehost)

{

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

}


 
Reply With Quote
 
 
 
 
Rick Strahl [MVP]
Guest
Posts: n/a
 
      10-18-2004
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


"lh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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(s tring)' 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.Eva l(Container.DataItem,"ridB
> ranch").ToString())%>' class="button">Edit</a></td>
> <%# ShowPreview(DataBinder.Eval(Container.DataItem,"vc Branch"))%>
> //doesnt work
> </tr>
> </ItemTemplate>
>
>
> //in codebehind
> protected string ShowPreview(string sitehost)
>
> {
>
> return "<td>wtf</td>";
>
> }
>
>



 
Reply With Quote
 
 
 
 
lh
Guest
Posts: n/a
 
      10-18-2004
Doh! That did it. Thanks
"Rick Strahl [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
> "lh" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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(s tring)' 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.Eva l(Container.DataItem,"ridB
> > ranch").ToString())%>' class="button">Edit</a></td>
> > <%# ShowPreview(DataBinder.Eval(Container.DataItem,"vc Branch"))%>
> > //doesnt work
> > </tr>
> > </ItemTemplate>
> >
> >
> > //in codebehind
> > protected string ShowPreview(string sitehost)
> >
> > {
> >
> > return "<td>wtf</td>";
> >
> > }
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing rails render method outside of view / Decorating render Glenn Gillen Ruby 0 11-17-2006 02:30 PM
Making an email link with DataBinder.Eval Nathan Sokalski ASP .Net 1 07-11-2005 07:17 AM
procs/blocks - blocks with procs, blocks with blocks? matt Ruby 1 08-06-2004 01:33 AM
Page.Render do not render complete page Lau Lei Cheong ASP .Net 1 05-15-2004 04:10 AM



Advertisments