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

  • SEARCH
  • Home
  • 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 6944223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:16:48+00:00 2026-05-27T13:16:48+00:00

I have a repeater. i want to get empid when i click on its

  • 0

I have a repeater. i want to get empid when i click on its any row.? how can i ?
My code is:-

<table id="table1" class="yui" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                    <th>
                        <a href='#' title="Click Header to Sort">Emp name #</a>
                    </th>
                    <th>
                        <a href='#' title="Click Header to Sort">emp sal</a>
                    </th>
                    <th>
                        <a href='#' title="Click Header to Sort">emp address</a>
                    </th>

                </tr>
            </thead>
            <tbody>
                <asp:Repeater ID="Repaddressorbbl" runat="server" OnItemCommand="Repaddressorbbl_ItemCommand">
                    <ItemTemplate>
                        <tr id="gh" style="cursor: pointer" onclick="Select(this);">
                            <td style="text-align: center;">
                                <%#Eval("empname")%>
                            </td>
                            <td style="text-align: center;">
                                <%# Eval("empsal")%>
                            </td>
                            <td style="text-align: center;">
                                <%# Eval("empadd")%>
                            </td>
                               </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </tbody>
            <tfoot>
                <tr id="pagerOne1">
                    <td colspan="4">
                        <img src="_assets/img/first.png" class="first" />
                        <img src="_assets/img/prev.png" class="prev" />
                        <input type="text" class="pagedisplay" />
                        <img src="_assets/img/next.png" class="next" />
                        <img src="_assets/img/last.png" class="last" />
                        <select class="pagesize">
                            <option selected="selected" value="100">100</option>
                            <option value="200">200</option>
                            <option value="400">400</option>
                        </select>
                    </td>
                </tr>
            </tfoot>
        </table>
  • 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-27T13:16:49+00:00Added an answer on May 27, 2026 at 1:16 pm

    YOu have to create manual postback. But for this to work always, your repeater should bind always, i.e. during each postback.

    The following code snippets may guide you.

    using System;
    
    namespace PostbackRef.Web
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (IsPostBack)
                {
                    string arg = Request["__EVENTARGUMENT"];
                    if (string.IsNullOrEmpty(arg) == false)
                    {
                        if (arg.StartsWith("row"))
                        {
                            string v = arg.Substring(arg.IndexOf("#") + 1);
                            txtSelected.Text = v;
                        }
                    }
                }
                //Have to bind repeater always
                Repeater1.DataBind();
            }
    
            protected string getPostbackReference(string Name)
            {
                return ClientScript.GetPostBackEventReference(this, "rowEvent#" + Name);
            }
        }
    }
    

    The aspx markup looks like this:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="PostbackRef.Web._Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            p
            {
                font-size: 12pt;
            }
            p:hover
            {
                background-color: Gray;
                font-weight: bold;
                color: White;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:Repeater ID="Repeater1" runat="server" DataSourceID="ObjectDataSource1">
                <ItemTemplate>
                    <p onclick="<%# getPostbackReference((string)Container.DataItem) %>">
                        <%# Container.DataItem %></p>
                </ItemTemplate>
            </asp:Repeater>
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetNames"
                TypeName="PostbackRef.Web.MyDs"></asp:ObjectDataSource>
            <asp:HiddenField ID="hfValue" runat="server" />
        </div>
        <div>
            Clicked : 
            <asp:TextBox ID="txtSelected" runat="server"></asp:TextBox>
        </div>
        </form>
    </body>
    </html>
    

    I’ve used an ObjectDataSource which returns a string array of names, but the choice of datasource is entirely yours. Here I’ve used just for e.g. sake.

    Note that I am calling Repeater1.Databind() on Page_Load irrespective of postback or not. There are probably better ways to do this. But most of the code came exactly here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one control named thumbviewer inside repeater. I want to set its imageurl
I have a Repeater with a LinkButton for each row. I want to be
I have a repeater control, and I want to put an unknown number of
I have Repeater Control and in that i have code like this <div runat=server
I have Repeater Control as shown below. <asp:Repeater ID=rptCategory runat=server> <HeaderTemplate> <h2 class=art-logo-text style=margin-bottom:
I have a repeater bind by the data coming from database. Now on click
I have a repeater which will have a link button per row here is
I have a nested repeater Because of that no control in my code is
I have a Question class: class Question { public int QuestionNumber { get; set;
I have a blank Repeater nested inside a column in a GridView and want

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.