calling function using repeater (asp.net 2.0)

Discussion in 'ASP .Net' started by sck10, Jul 27, 2006.

  1. sck10

    sck10 Guest

    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

    }
    sck10, Jul 27, 2006
    #1
    1. Advertising

  2. sck10

    sloan Guest

    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\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
    >
    > }
    >
    >
    sloan, Jul 27, 2006
    #2
    1. Advertising

  3. sck10

    sck10 Guest

    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\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
    >>
    >> }
    >>
    >>

    >
    >
    sck10, Jul 27, 2006
    #3
  4. 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 (, 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.
    Walter Wang [MSFT], Jul 28, 2006
    #4
  5. sck10

    sck10 Guest

    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/default.asp?url=/library/en-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.
    >
    sck10, Jul 28, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kent P. Iler
    Replies:
    0
    Views:
    610
    Kent P. Iler
    Mar 7, 2004
  2. Replies:
    0
    Views:
    2,862
  3. Andreas Lagemann
    Replies:
    8
    Views:
    460
    Mike Wahler
    Jan 10, 2005
  4. tiwy
    Replies:
    0
    Views:
    426
  5. sck10
    Replies:
    1
    Views:
    5,432
    Steven Cheng[MSFT]
    Jul 31, 2006
Loading...

Share This Page