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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:35:05+00:00 2026-06-02T17:35:05+00:00

I have an UpdatePanel , in it a GridView , and in it a

  • 0

I have an UpdatePanel, in it a GridView, and in it a Repeater. There is a button to add comment. This button post backs but id does not run the function code behind. Here is my code

<updatepanel>
    <gridview>
        <repeater>
            <asp:Button ID="kitapVarYorumEkle" runat="server"  
                 CommandArgument='<%#Eval("id") %>' 
                 CommandName='<%# GridView1.Rows.Count.ToString() %>' 
                 Text="Yorum ekle" class="blueButton" 
                 OnClick="kitapVarYorumEkle_Click"  />
        </repeater>
    </gridview>
</updatepanel>

Code inside the js is:

protected void kitapVarYorumEkle_Click(object sender, EventArgs e)
{
        kitapVarYorum temp = new kitapVarYorum();

        if (Session["id"] != null)
        {
            temp.uyeId = Convert.ToInt32(Session["id"]);
        }

        Button btn = (Button)sender;
        temp.kitapVarId = Convert.ToInt32(btn.CommandArgument);

        string text = "";

        GridViewRow row = GridView1.Rows[Convert.ToInt32(btn.CommandName)];

        if (row != null)
        {
            TextBox txt = row.FindControl("txtYorum") as TextBox;

            if (txt != null)
            {
                text = txt.Text;
            }
        }

        temp.icerik = text;
        var db = Tools.DBBaglanti();
        db.kitapVarYorums.InsertOnSubmit(temp);
        db.SubmitChanges();

        // Page.Response.Redirect(Page.Request.Url.ToString(), true);
    }
}

I have tried it outside the the controls and it works

  • 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-06-02T17:35:07+00:00Added an answer on June 2, 2026 at 5:35 pm

    Have you tried the ItemCommand approach?

    <asp:Button  
         CommandArgument='<%#Eval("id") %>'
         CommandName="yourCommandNameOfChoice" 
         Text="Yorum ekle" 
         ID="kitapVarYorumEkle" 
         class="blueButton" runat="server"  
         OnClick="kitapVarYorumEkle_Click"  />
    

    now add an ItemCommand event for your repeater:

     protected void yourRepeater_ItemCommand(object source , RepeaterCommandEventArgs e)
     {
         switch(e.CommandName)
         {
               case "yourCommandNameOfChoice":
                   // Your Code Here 
                   break;
         }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple situation that does not work. Gridview is nested inside updatepanel
I have an UpdatePanel containing a GridView which contains a button in the HeaderTemplate
I have a GridView in an UpdatePanel (ASP.Net 2.0) . I have this code
I have a TemplateField in a GridView in an UpdatePanel with a button called
I have a problem with this that works for one button and not for
I have a gridview inside an updatepanel. It has a TemplateField column with radiobutton:
I have a gridview within an updatepanel which allows paging and has a linkbutton
I have an updatepanel which after clicking one button is submitting the page. The
I have an UpdatePanel which has a Repeater inside it, and inside of the
I have a asp:UpdatePanel with a asp:Button and a asp:TextBox : <asp:UpdatePanel ID=UpdatePanel1 runat=server>

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.