Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7703853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:33:12+00:00 2026-05-31T23:33:12+00:00

i want set class for repeater when doPostBack for those dataID i wan but

  • 0

i want set class for repeater when doPostBack for those dataID i wan but dun noe can/cannot?
below code is just for example showing:

<body>
  <form id="form1" runat="server">
      <asp:ScriptManager ID="ScriptManager1"  EnablePartialRendering="true"  runat="server" EnablePageMethods="true" />
     <asp:UpdatePanel ID="UpdatePanel2" runat="server" >
                <ContentTemplate>
                      <asp:Repeater ID="Repeater1" runat="server" DataSourceID="dsInbox">
                        <ItemTemplate>
                          <tr id="trInbox"> 
                            <td width="370px" height="25px"><div align="left" class="style95">&nbsp;<%# DisplaySubject(Eval("inbSubject").ToString(), Eval("inbMsg").ToString())%></div></td> 
                            <td width="80px" height="25px"><div align="left" class="style95">&nbsp;<%# Eval("inbCreatedAt","{0:MM-dd-yyyy}") %></div></td> 
                            <td width="94px" height="25px"><div align="left" class="style95">&nbsp;<%# Eval("DataId") %></div></td> 
                          </tr>   
                        </ItemTemplate>
                        </asp:Repeater>
                        </ContentTemplate>

            </asp:UpdatePanel>   

in behind Code C# i can create the class/style i wan

 protected void Page_Load(object sender, EventArgs e)
    {
            if (IsPostBack)
            {
                Repeater1.DataBind();
               //find the data row ID and set class/style when loaded
            }

        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:33:14+00:00Added an answer on May 31, 2026 at 11:33 pm

    If you are wanting to set a class per each row bound, and need the data ID, then your best approach is to handle it as each row is bound:

    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="dsInbox"
                  OnItemDataBound="Repeater1_ItemDataBound">
    

    and in code-behind:

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
            MyType myItem = (MyType)e.Item.DataItem;
            var dataId = myItem.DataId;
            // Do whatever you need here.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I dynamically set @class in an ActionLink? I want to do @Html.ActionLink(Pricing,
I'm creating some entities (class) for my project and I want to set a
I have a base class for all my textboxes and I want to set
I have a static variable partner in the class. And I want to set
I want set Listbox background to transparent but not working Is there any idea?
I want to set an active class for a CSS image menu. I tried
i want to set a specific class to any packets that come from a
As my title, I want set multiple conditions in will_paginate, that's my model's code
i have a div who have class black_overlay. i want to set them to
I want to set another class for the clicked menu-part. Clicking generates url with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.