Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Custom Item Template Return in a nested repeater

Posted on 2004-04-12
3
Medium Priority
?
298 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
vinayakrishna earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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