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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:56:15+00:00 2026-05-12T22:56:15+00:00

I have the the GridView’s column looking like that: <Columns> <asp:TemplateField HeaderText=Opcje> <ItemTemplate> <asp:LinkButton

  • 0

I have the the GridView’s column looking like that:

         <Columns>
            <asp:TemplateField HeaderText="Opcje">
                <ItemTemplate>
                    <asp:LinkButton runat="server" Text="Accept" ID="AcceptBtn" CommandName="Accept"/>
                    <asp:LinkButton runat="server" Text="Deny" ID="DenyBtn" CommandName="Deny"/> 
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>

while a new row is being created, I want to change both LinkButton’s CommandArgument property:

    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        ((LinkButton)e.Row.FindControl("AcceptBtn")).CommandArgument = myFiles[fileIndex].Name;
        ((LinkButton)e.Row.FindControl("DenyBtn")).CommandArgument = myFiles[fileIndex].Name;
    }

The problem is, the code seems to be not changing anything, when I click on the AcceptBtn, the code below is invoked:

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Accept")
        {
            string ss = (string)e.CommandArgument;
            ...
        }
    }

ss = “”. Why ? If the page is PostedBack, both CommandArguments are cleared ?

  • 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-12T22:56:15+00:00Added an answer on May 12, 2026 at 10:56 pm

    Try setting the CommandArgument in the RowDataBound event instead of RowCreated.

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

Sidebar

Related Questions

Well, I have GridView with editable field like 'TemplateField' with DropDownList. My code: <Columns>
I have Gridview like this. Here is my last column Gridview code; <EditItemTemplate> <asp:TextBox
I have a gridview like below: <asp:GridView DataKeyNames=TransactionID AllowSorting=True AllowPaging=TrueID=grvBrokerage runat=server AutoGenerateColumns=False CssClass=datatable Width=100%
I have a gridview inside an updatepanel. It has a TemplateField column with radiobutton:
I have gridview in my asp.net 3.5 application [C#]. Which looks like this: <asp:GridView
I have a gridview with checkbox inside asp:TemplateField . I wish to select multiple
I have GridView and Button controls nested inside a Panel . <asp:Panel ID=PanelPopUp runat=server>
I have GridView with Template Column.Inside the template column i have asp:hiddenfield. I am
i have gridview in my asp.net webform. i bind my database to gridview like
I have a Gridview like this picture. Easyly in my last column, i keep

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.