Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ASP.Net C# Accessing MM:DataSet via code inside a Repeater

New Here ,
Jan 17, 2008 Jan 17, 2008
Trying to acessing MM:DataSet via code inside a Repeater, but I'm only getting problems and errors when I'm attempting to do this.

I cannot seem to access the current item it is making, i need to do some number comparison in each item to determine if there is any problems with it.

Thanks for any help!
TOPICS
Server side applications
417
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 17, 2008 Jan 17, 2008
LATEST
"Nightw" <webforumsuser@macromedia.com> wrote in message
news:fmnnqs$f9i$1@forums.macromedia.com...
> Trying to acessing MM:DataSet via code inside a Repeater, but I'm only
> getting
> problems and errors when I'm attempting to do this.
>
> I cannot seem to access the current item it is making, i need to do some
> number comparison in each item to determine if there is any problems with
> it.
>
> Thanks for any help!
>
> <ASP:Repeater id="repeatMain" runat="server" DataSource='<%#
> dsTest.DefaultView %>'>
> <ItemTemplate>
> <%
> string sSomething = dsTest.FieldValue("Field", Container);
> sSomething += " added text";
> %>
> <tr>
> <td><%=sSomething%></td>
> </tr>
> </ItemTemplate>
> </ASP:Repeater>
>

You can use the ItemDataBound event of the repeater control to evaluate the
item after it has received data
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.itemdatabound.aspx

<script language="C#" runat="server">
void repeatMain_ItemCreated(Object Sender, RepeaterItemEventArgs e) {
// access the dataRow to which the item is bound
DataRow theDataRow = (DataRow)e.Item.DataItem;

//Add a literalcontrol with the added text
switch (e.Item.ItemType) {
case ListItemType.Item:
case ListItemType.AlternatingItem:
e.Item.Controls.Add(new LiteralControl(" added text"));
break;
}
}
</script>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines