• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

Custom Item Template Return in a nested repeater

I'm new at this and I'm not sure if I'm even doing it right.
I'm tring to find out if an event has been chosen. I've tried everything and I keep getting CS1502: The best overloaded method match for 'System.Convert.ToString(object)' has some invalid arguments error. My code is:

 <asp:repeater id="parentRepeater" runat="server">

     <span class="week"> <%# DataBinder.Eval(Container.DataItem,"Title") %></span><br><br>

      <!-- start child repeater -->
      <asp:repeater id="childRepeater" datasource='<%# ((DataRowView)Container.DataItem)
      .Row.GetChildRows("myrelation") %>' runat="server" EnableViewState="true">

<table width="100%"  border="0" cellspacing="5">
    <td width="7%">

<%# CheckEvent(Convert.ToInt32(DataBinder.Eval(Container.DataItem,"[\"EventID\"]")))%>
<td width="93%"><strong><%# DataBinder.Eval(Container.DataItem,"[\"EventName\"]")%>

      <!-- end child repeater -->


I've set up the function as:
public void CheckEvent(int ids) {

//I'm trying to have it check to see if the event was chosen after the page has been submitted.
if(IsPostBack) {

I've taken everything out of the function, but it still doesn't work. The error comes up at the line the function was called on.


1 Solution

I have used a similar nested repeater in my application and it works fine.

The .aspx page is as below:

      ------                                                <input type="hidden" name="Test" value='<%#CheckEvent(DataBinder.Eval(Container.DataItem, "ID")) %>'>

In the .aspx.cs page I have used the event like this:

protected void CheckEvent(Object Id)
     //You can do your conversion here
     //int versionNo = Convert.ToInt32(Id);



Hope this helps.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now