Solved

Custom Item Template Return in a nested repeater

Posted on 2004-04-12
3
287 Views
Last Modified: 2008-03-03
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">
   <itemtemplate><br>

     <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">

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

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


         </itemtemplate>
      </asp:repeater>
      <!-- end child repeater -->

   </itemtemplate>
</asp: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.

Thanks!

0
Comment
Question by:dpopovich
3 Comments
 
LVL 1

Accepted Solution

by:
vinayakrishna earned 500 total points
ID: 10917828
Hi,

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

The .aspx page is as below:

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

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);

     
     if(Page.IsPostBack)
     {
              Response.Write("Yes");
      }
     else
     {
             Response.Write("No");
      }

}

Hope this helps.

0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WKHTMLTOPDF - --disable-smart-shrinking not working 10 90
Problem!!! 8 33
Problem with SelectList in .NET MVC application 1 16
RegEx with optional part 4 24
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question