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 1045711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:01:43+00:00 2026-05-16T16:01:43+00:00

I have a repeater: <asp:Repeater ID=rpt_Items OnItemCommand=rpt_Items_ItemCommand runat=server> <ItemTemplate> <div class=item> <div class=fr> <asp:TextBox

  • 0

I have a repeater:

        <asp:Repeater ID="rpt_Items" OnItemCommand="rpt_Items_ItemCommand" runat="server">
            <ItemTemplate>
                <div class="item">
                    <div class="fr">
                        <asp:TextBox ID="tb_amount" runat="server">1</asp:TextBox>
                        <p>
                            <%# Eval("itemPrice") %>
                        </p>
                        <asp:LinkButton ID="lb_buy" CommandName="buy" runat="server">buy</asp:LinkButton>
                    </div>
                    <asp:HiddenField ID="hdn_ID" Value='<%# Eval("itemID") %>' runat="server" />
                </div>
            </ItemTemplate>
        </asp:Repeater>

On the repeater commandargument i want to get the textbox and the hiddenfield but how do i do this?

protected void rpt_Items_ItemCommand(object sender, RepeaterCommandEventArgs e)
{
    if (e.CommandName == "buy")
    {
        //ADD ITEM TO CART
        Response.Write("ADDED");


        Product getProduct = db.Products.FirstOrDefault(p => p.ProductID == id);
        if (getProduct != null)
        {
            CartProduct product = new CartProduct()
            {
                Name = getProduct.ProductName,
                Number = amount,
                CurrentPrice = getProduct.ProductPrice,
                TotalPrice = amount * getProduct.ProductPrice,
            };
            cart.AddToCart(product);
        }

    }
}

Thanks a bunch!

  • 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-16T16:01:44+00:00Added an answer on May 16, 2026 at 4:01 pm

    You don’t have to pass it through the Command Argument, you can use e.Item.FindControl() inside your rpt_Items_ItemCommand method, as in:

    TextBox tb_amount = (TextBox)e.Item.FindControl("tb_amount");
    HiddenField hdn_ID = (HiddenField)e.Item.FindControl("hdn_ID");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my repeater item template: <asp:Repeater ID=Linksrepeater runat=server> <HeaderTemplate><h2>Links</h2><ul> </HeaderTemplate> <ItemTemplate> <li><%#Container.DataItem(Category)%></li> </ItemTemplate>
I have two nested repeaters in my *.aspx page. <asp:Repeater runat=server id=rptMain> <ItemTemplate> <h1><%#DataBinder.Eval(Container.DataItem,
I have this repeater: <asp:Repeater ID=rptContentPageGetAll runat=server OnLoad=rptContentPagesGetAll_Load> <HeaderTemplate> <ul class=contentPageTree> </HeaderTemplate> <ItemTemplate> <li><%#
i have a repeater than creates a table: <itemtemplate> <tr id=theTableRow runat=server> <td> <asp:LinkButton
I have a repeater that contains a Telerik RadComboBox: <asp:Repeater ID=rpt runat=server> <ItemTemplate> <telerik:RadComboBox
I have a repeater like this: <asp:Repeater runat=server ID=pde> <HeaderTemplate></HeaderTemplate> <ItemTemplate> <asp:Literal runat=server ID=literal1></asp:Literal>
I have a Repeater control in my aspx page: <asp:Repeater ID=repeater runat=server EnableViewState=false> <ItemTemplate>
i have a repeater that will output a series of items: <asp:repeater ... runat=Server>
I have a repeater that displays some data from a SQL query: <asp:Repeater runat=server
I have an Asp.Net repeater, which contains a textbox and a checkbox. I need

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.