Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > calling function using repeater (asp.net 2.0)

Reply
Thread Tools

calling function using repeater (asp.net 2.0)

 
 
sck10
Guest
Posts: n/a
 
      07-27-2006
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\mpColumn030 2.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

}


 
Reply With Quote
 
 
 
 
sloan
Guest
Posts: n/a
 
      07-27-2006
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.




"sck10" <> wrote in message
news:%...
> 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\mpColumn030 2.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
>
> }
>
>



 
Reply With Quote
 
 
 
 
sck10
Guest
Posts: n/a
 
      07-27-2006
Thanks sloan,

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

Thanks again...


"sloan" <> wrote in message
news:...
> 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.
>
>
>
>
> "sck10" <> wrote in message
> news:%...
>> 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\mpColumn030 2.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
>>
>> }
>>
>>

>
>



 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      07-28-2006
Hi,

You may take a look at following MSDN Library documentation:

#.NET Framework General Reference: Naming Guidelines
http://msdn.microsoft.com/library/de...us/cpgenref/ht
ml/cpconnamingguidelines.asp



Regards,
Walter Wang (, 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.

 
Reply With Quote
 
sck10
Guest
Posts: n/a
 
      07-28-2006
Thanks Walter...


"Walter Wang [MSFT]" <> wrote in message
news:...
> Hi,
>
> You may take a look at following MSDN Library documentation:
>
> #.NET Framework General Reference: Naming Guidelines
> http://msdn.microsoft.com/library/de...us/cpgenref/ht
> ml/cpconnamingguidelines.asp
>
>
>
> Regards,
> Walter Wang (, 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.
>



 
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
Calling function using repeater (vb vs. c#) sck10 ASP .Net 1 07-31-2006 03:02 AM
Repeater Using Javascript Referencing a Column in the Repeater rwoo_98@yahoo.com ASP .Net 0 02-26-2005 05:02 PM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
calling virtual function results in calling function of base class... Andreas Lagemann C++ 8 01-10-2005 11:03 PM
calling virtual function results in calling function of base class ... tiwy C++ 0 01-09-2005 11:17 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57