Solved

Custom Item Template Return in a nested repeater

Posted on 2004-04-12
3
286 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now