Solved

Custom Item Template Return in a nested repeater

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

12 Experts available now in Live!

Get 1:1 Help Now