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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:27:17+00:00 2026-06-05T21:27:17+00:00

I want to set a CommandArgument for a Gridview but if I run the

  • 0

I want to set a CommandArgument for a Gridview but if I run the programm an error occured.

Here is my ButtonField declaration:

<asp:ButtonField Text="Löschen" CommandName="Deleterecord"  ButtonType="Button" CommandArgument=<% Eval("userId") %>  /> 

and this is the error:

Parser Error Message: Literal content ('<asp:ButtonField Text="Löschen" CommandName="Deleterecord"  ButtonType="Button" CommandArgument=') is not allowed within a 'System.Web.UI.WebControls.DataControlFieldCollection'.

EDIT:

with these block of code I fill my Gridview:

protected void Button2_Click(object sender, EventArgs e)
        {
            Guid g = Guid.Parse("ef7a9f97-6a9a-44c6-ac38-82a5d06c394e");
            RoutesManager rm = new RoutesManager(g);
            rm.GetAllRoutes();
            List<Route> result;
            result=rm.GetAllRoutes();

            GridView1.DataSource = result;
            GridView1.DataBind();

        }

and this is GetallRoutes:

 public List<Route> GetAllRoutes()
        {
            var inputParams = new Dictionary<string, object>();
            var xmlHelper = new XmlHelper();
            var result = new List<Route>();

            inputParams.Add("UserId", _userId);

            DataTable dt = _dbhelper.Select("SELECT * FROM ROUTES WHERE UserId=@UserId", inputParams);

            foreach (DataRow row in dt.Rows)
            {
                var xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(row[XmldocPosition].ToString());               
                result.Add(xmlHelper.ConvertXmlDocumentToRoute(xmlDoc.ToXDocument()));
            }

             return result;

}

My grid view full with this block of code ,I put a link button in my Gridview for each Row and I want if the user click this button only this row is deleted from DB and Gridview

  • 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-05T21:27:19+00:00Added an answer on June 5, 2026 at 9:27 pm

    You are missing

    • A closing bracket
    • Double quotes on the userID
    • Single quote to contain the resulting value of CommandArgument

      <asp:ButtonField Text="Löschen" CommandName="Deleterecord" ButtonType="Button" CommandArgument='<%# Eval("userId") %>' />

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

Sidebar

Related Questions

I want set Listbox background to transparent but not working Is there any idea?
i want set class for repeater when doPostBack for those dataID i wan but
i have a problem, i want set text of a UILabel or UItextView or
I want to set the Text of a TextBlock in my StatusBar before making
I have a subclass from control and I want set text for that. When
Here's a simple question. I have a jqGrid that's working great but I want
i have a gridview width a boundfield: <asp:BoundField DataField=Nome HeaderText=Nome SortExpression=Nome /> i want
I want set error validation to input field manually in controller example: if ($remainTime
I want set run a file with cron at 12:03:37 every day. How do
I want set default icon of some extension by C#. But this gives me

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.