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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:29:27+00:00 2026-06-19T04:29:27+00:00

asp.net and C# here I have the columns from a gridview control when the

  • 0

asp.net and C#

here I have the columns from a gridview control

when the user clicks either button i need to pass the values for CaseID, CaseworkerID, EventDate and Code to a stored procedure

but how do i pass multiple parameters to my onclick method ????

<columns>
<asp:BoundField DataField="CaseID" HeaderText="CaseID" Visible = "False" />
<asp:BoundField DataField="caseworkerID" HeaderText="CwID" Visible = "False" />
<asp:BoundField DataField="CaseWorker" HeaderText="Case Worker" />
<asp:BoundField DataField="EventDate" HeaderText="Event Date" />
<asp:BoundField DataField="Code" HeaderText="Code" />
  <asp:TemplateField HeaderText="ADD">
       <ItemTemplate> 
                    <asp:Button  ID="AddUnit" runat="server" Text=" +1 " onserverclick="AddUnit_Click"/>
        </ItemTemplate> 
   </asp:TemplateField> 

<asp:BoundField DataField="TotalUnits" HeaderText="Total Units" />

  <asp:TemplateField HeaderText="DDT">
       <ItemTemplate> 
          <asp:Button ID="DdtUnit" runat="server" Text=" -1 " onserverclick="DdtUnit_Click"/>
        </ItemTemplate> 
   </asp:TemplateField> 


<asp:BoundField DataField="EventType" HeaderText="Event Type" />
<asp:BoundField DataField="UnitCost" HeaderText="Unit Cost" />
<asp:BoundField DataField="TotalCost" HeaderText="Total Cost"/>

EDIT:
so I now have this

            <ItemTemplate> 
                <asp:Button  ID="AddUnit" runat="server" Text=" +1 " 
                CommandName="AddUnit" 
                CommandArgument='<%# Eval("CaseID")+ ";" + Eval("caseworkerID")+ ";" + Eval("EventDate")+ ";" + Eval("Code")%>'/>
            </ItemTemplate> 

thats a good start

  • 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-19T04:29:28+00:00Added an answer on June 19, 2026 at 4:29 am

    Pretty much what you want to do is create a commandargument thats deliminated by a special character(s). When you handle the event, pull out the command argument from the event (e) and split it. (As utkarshs answer shows, use the gridviews rowcommand event, not an onclick)

    This can cause issues if the commandargument data actually contains the same character you used for a deliminator. Just one suggestion though (we do this sometimes when we know someting like a productId won’t contain a pipe (|) )

    EDIT:
    So your button should be something like…

      <asp:button CommandArgument='<%# Eval("someValue") + " | " 
                  + Eval("someOtherValue") + " | " %>'  
                 CommandName="whatever" runat="server" text="FOO BAR" />
    

    Then in your code behind where your grid id is gridId

    protected void gridId_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "btnname")
        {
            string[] differentValues = e.CommandArgument.ToString().Split("|");           
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET GridView which is populated from a SQL Server database. This
I have an ASP.Net GridView control on an ASPX page hosted on a SharePoint
I have a GridView control in an asp.net 3.5 webpage, the following code executes
ASP.NET newbie here I have coded up an ASP.NET website and running on win'08
I have in here an old web application written in ASP.Net 2.0 + AJAX.
Interesting one here. I have an ASP.NET 1.1 project that contains a web service
Here's another one for you to help me solve: I have an ASP.NET website
Here's what I'm trying to do. I have an ASP.NET MVC web application, where
So, here's what I'm working on. I have an ASP.NET web app, in which
I am having a similar as the user here: ASP.NET MVC 3.0 WebGrid -

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.