calling function using repeater (asp.net 2.0)

S

sck10

Hello,

I am trying to call a function (c#) from the repeater tool and I am not sure
if I am calling the function correctly (since I am not getting the results
that I want).

Using
<asp:Literal id="ltrNewLine" text='<%# vbBlankRowMenu("strMenuType") %>'
runat="server" />

should send the value "Title" or "Link" to the function and it should return
the string to create an empty cell.

When I added the "Eval" part, I got the error:
text='<%# vbBlankRowMenu(Eval("strMenuType")) %>'
The best overloaded method match for 'mpColumn0302.vbBlankRowMenu(string)'
has some invalid arguments
C:\Inetpub\wwwroot\gsttcsharp\template\mpColumn0302.master

Any help with this would be appreciated.

Thanks, sck10


<!-- Repeater: Menu Structure -->
<asp:Repeater id="rptMenu" runat="server">
<HeaderTemplate>
<table border="0px" style="width:99%">
</HeaderTemplate>
<ItemTemplate>
<asp:Literal id="ltrNewLine" text='<%# vbBlankRowMenu("strMenuType")
%>' runat="server" />
<tr>
<td style="width:100%; text-align:left;"><%#Eval("strTarget")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater><br />


c# class
---------------------------------------------
public string strCategory = "NoParameter";

public string vbBlankRowMenu(string strRepeaterValue)
{
if (strRepeaterValue == "Title" && strCategory != "NoParameter")
{
strCategory = "Insert Line next time";
return "<tr><td width=600 colspan=3>&nbsp;</div></td></tr>";
}
else
{
strCategory = "Insert Line next time";
return null;
} // end if

}
 
S

sloan

your argument has to be an "object"


public string vbBlankRowMenu(object o)
{

string x = Convert.ToString(o);

}


PS

FYI, strRepeaterValue is hungarian notation, which isn't the preferred
notation anymore.
 
S

sck10

Thanks sloan,

By the way, is there a link that talks about the proper notation?

Thanks again...
 
W

Walter Wang [MSFT]

Hi,

You may take a look at following MSDN Library documentation:

#.NET Framework General Reference: Naming Guidelines
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/ht
ml/cpconnamingguidelines.asp



Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Staff online

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top