Solved

Custom Item Template Return in a nested repeater

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

627 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